Metadata-Version: 2.4
Name: cohortlint
Version: 0.1.0
Summary: Pre-integration metadata diagnostics for multi-cohort omics studies
Project-URL: Homepage, https://github.com/Aristotheles/CohortLint
Project-URL: Repository, https://github.com/Aristotheles/CohortLint
Project-URL: Issues, https://github.com/Aristotheles/CohortLint/issues
Author: CohortLint contributors
License: MIT License
        
        Copyright (c) 2026 CohortLint contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: bioinformatics,metadata,omics,quality-control
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.11
Requires-Dist: jinja2>=3.1
Requires-Dist: numpy<2.4,>=1.26
Requires-Dist: openpyxl>=3.1
Requires-Dist: pandas>=2.1
Requires-Dist: pydantic>=2.5
Requires-Dist: pyyaml>=6.0
Requires-Dist: scipy>=1.11
Requires-Dist: typer>=0.12
Provides-Extra: anndata
Requires-Dist: anndata>=0.10; extra == 'anndata'
Provides-Extra: dev
Requires-Dist: bandit>=1.7; extra == 'dev'
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: hypothesis>=6.90; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pandas-stubs>=2.1; extra == 'dev'
Requires-Dist: pip-audit>=2.7; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: twine>=5.1; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: ontology
Requires-Dist: text2term>=4.1; extra == 'ontology'
Description-Content-Type: text/markdown

# CohortLint

CohortLint checks cohort metadata immediately before multi-cohort omics integration. It
finds unit mismatches, inconsistent vocabularies, missing covariates, non-estimable study
designs, and privacy-hygiene risks without reading expression matrices or attempting batch
correction.

## Installation

```bash
pip install cohortlint
```

Optional formats and ontology mapping:

```bash
pip install "cohortlint[ontology]"
pip install "cohortlint[anndata]"
```

## Worked example

Create a starter configuration:

```bash
cohortlint init --output cohortlint.yaml
```

Declare the biological effect and technical batch variables:

```yaml
version: 1
cohorts:
  - name: berlin
    path: data/berlin.csv
    sample_id: patient_id
  - name: hannover
    path: data/hannover.tsv
    sample_id: sample_id
schema:
  age:
    type: numeric
    unit: years
    range: [0, 120]
    required: true
  condition:
    type: categorical
    role: biological
    required: true
  batch:
    type: categorical
    role: technical
    required: true
privacy:
  k_anonymity_threshold: 5
output:
  lang: en
```

Run diagnostics and produce an escaped standalone HTML report:

```bash
cohortlint check --config cohortlint.yaml --format html --output report.html
```

Apply only safe metadata rewrites and record provenance:

```bash
cohortlint harmonize --config cohortlint.yaml \
  --output merged.csv --mappings mappings.sssom.tsv
```

`harmonize` never rewrites design findings. Complete batch-condition confounding cannot be
repaired computationally.

## Exit codes

- `0`: clean or below the configured fail threshold
- `1`: findings at or above `--fail-on`
- `2`: invalid configuration, unreadable input, or unsafe output target

## Security and privacy

Privacy findings are heuristics and are not compliance assessments. P001 reports counts,
never matching identifier values. HTML output uses autoescaping and a restrictive Content
Security Policy. See [SECURITY.md](SECURITY.md) for the threat model and reporting process.

## Development

```bash
python -m pip install -e ".[dev]"
ruff check .
mypy
pytest --cov=cohortlint
bandit -r src
pip-audit
```

The rule catalogue is generated in [docs/rules.md](docs/rules.md), and dependency licences
are recorded in [docs/dependencies.md](docs/dependencies.md).
