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
pip install cohortlint
Optional formats and ontology mapping:
pip install "cohortlint[ontology]"
pip install "cohortlint[anndata]"
Worked example
Create a starter configuration:
cohortlint init --output cohortlint.yaml
Declare the biological effect and technical batch variables:
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:
cohortlint check --config cohortlint.yaml --format html --output report.html
Apply only safe metadata rewrites and record provenance:
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 threshold1: findings at or above--fail-on2: 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 for the threat model and reporting process.
Development
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, and dependency licences are recorded in docs/dependencies.md.
Metadata
Release files for cohortlint 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cohortlint-0.1.0.tar.gz | 36.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cohortlint-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.3 kB
Release files / cohortlint-0.1.0.tar.gz
| Download URL | cohortlint-0.1.0.tar.gz |
|---|---|
| Size | 36.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a48af8fd7c87182d114f9422ed7e6bb59d430e7225c1b3a1152821d1b2f67e0e
|
|
BLAKE2b-256 checksum How to use checksums |
e1a882c44c447e076724d74c951a68c4b16c1ea065b022b2dcf2f156d3443c99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency logRelease files / cohortlint-0.1.0-py3-none-any.whl
| Download URL | cohortlint-0.1.0-py3-none-any.whl |
|---|---|
| Size | 37.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bca288cf3fb805620e63f3fd6bccd8b82e08050d0f8bc5f80930a19f6211116d
|
|
BLAKE2b-256 checksum How to use checksums |
692ae0730485f82d834aecc579c97a32296fd8dc7d2b8862318d50bd9549d235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency log