Skip to content

ehrlint v1.0.0

Latest

Choose a tag to compare

@DanPalBCM DanPalBCM released this 13 Nov 17:49
· 1 commit to main since this release

ehrlint v1.0.0

First public release of ehrlint: lint your clinical prediction task before you train on it.

Post-index features, outcome codes entered during the index encounter, treatment proxies, immortal time and patient overlap across splits are the most common reasons clinical models look excellent in a paper and fail in deployment. Cohort-extraction tools help you define a task; ehrlint audits one that already exists.

ehrlint audit --data meds/ --task task.yaml --splits splits.json --out report/

A non-zero exit code means your CI caught a leaky task.

Install

pip install ehrlint
pip install "ehrlint[meds]"    # adds MEDS schema validation
pip install "ehrlint[all]"     # everything

Requires Python 3.11+.

Two rules the tool is built around

  • Evidence or nothing. Every finding cites the concrete rows that triggered it, plus the query that found them, so any finding can be reproduced by hand.
  • A skipped check is not a passed check. Skips are reported with a reason, above the findings.

The checks

LK001 post-index features · LK002 same-encounter outcome · LK003 outcome proxy · LK004 immortal time · LK005 split overlap · LK006 temporal split · LK007 label definition · LK008 encounter group · LK009 duplicate subjects · LK010 horizon violation.

Also in this release

  • Ingests MEDS datasets (verified against meds 0.4.1) and OMOP CDM extracts (parquet or CSV).
  • Reports as a self-contained offline HTML file, plus Markdown, JSON and findings JSONL.
  • ehrlint synth generates clean synthetic cohorts. ehrlint.inject plants any of the ten leaks and returns the affected subjects as ground truth.
  • Performance: 100,000 subjects audited in 9.3 s, and 10.3 M events in 67.5 s.
  • A worked walkthrough on the public MIMIC-IV demo.

Quality

547 tests at 94% coverage on Python 3.11–3.13. Every check is tested against an injector that plants exactly the leak it looks for.

Known limitations

A clean audit does not mean a valid task. LK001 cannot see your feature pipeline without --features. Proxies are yours to declare. Duplicate detection is deterministic, not probabilistic. See the limitations page.

Full changelog: https://github.com/DanPalBCM/ehrlint/blob/main/CHANGELOG.md
Documentation: https://danpalbcm.github.io/ehrlint/