Clinical AI toolkit that treats medical codes as first-class citizens
A Python toolkit that modularizes the mess of EHR data into reusable datasets, tasks, and models so researchers stop reinventing the healthcare preprocessing wheel.

What it does\nPyHealth is a modular deep learning framework built specifically for clinical predictive modeling. It ingests raw electronic health record datasets like MIMIC-III, MIMIC-IV, and eICU, then pushes them through a five-stage pipeline—datasets, tasks, models, trainer, and metrics—to run experiments the authors claim can fit in about ten lines of code. It also ships a standalone medical code mapper for translating between ontologies like ICD-9-CM and ATC.\n\nThe interesting bit\nMost ML frameworks treat healthcare data as an afterthought; PyHealth inverts that by making medical codes, patient visits, and drug interactions native primitives rather than awkward pandas workarounds. The dataset and task layers are deliberately decoupled, so you can swap a mortality-prediction task for a readmission one without touching your MIMIC data loader.\n\nKey highlights\n- 33+ pre-built models including RETAIN, SafeDrug, GAMENet, and Transformer variants\n- Native support for MIMIC-III/IV, eICU, OMOP-CDM, SleepEDF, and other clinical datasets\n- Built-in medical code ontology lookups and cross-mapping via pyhealth.medcode\n- Data processing layer advertised as roughly three times faster than pandas\n- Five-stage pipeline designed to let researchers mix, match, or override individual stages\n\nCaveats\n- PyHealth 2.0 requires Python 3.12 or 3.13, which locks out anyone stuck on older Python versions\n- The README itself warns that it may be out of date and redirects to external documentation\n- Some modules are noted as still being enriched, so the API surface may be shifting\n\nVerdict\nGrab this if you are a healthcare ML researcher tired of writing one-off EHR preprocessing scripts. Skip it if you are looking for a general-purpose deep learning framework or need guaranteed long-term API stability.
Frequently asked
- What is sunlabuiuc/PyHealth?
- A Python toolkit that modularizes the mess of EHR data into reusable datasets, tasks, and models so researchers stop reinventing the healthcare preprocessing wheel.
- Is PyHealth open source?
- Yes — sunlabuiuc/PyHealth is open source, released under the MIT license.
- What language is PyHealth written in?
- sunlabuiuc/PyHealth is primarily written in Python.
- How popular is PyHealth?
- sunlabuiuc/PyHealth has 1.6k stars on GitHub.
- Where can I find PyHealth?
- sunlabuiuc/PyHealth is on GitHub at https://github.com/sunlabuiuc/PyHealth.