alterlab-pyhealth

Installation
SKILL.md

PyHealth: Healthcare AI Toolkit

Overview

PyHealth is a comprehensive Python library for healthcare AI that provides specialized tools, models, and datasets for clinical machine learning. Use this skill when developing healthcare prediction models, processing clinical data, working with medical coding systems, or deploying AI solutions in healthcare settings.

Version gotcha (read first). This skill targets PyHealth 2.x (pin pyhealth==2.0.1). The 2.0 rewrite changed the API in ways the wider web (and pre-2024 tutorials) get wrong:

  • Tasks are classes you instantiate, e.g. MortalityPredictionMIMIC4(), DrugRecommendationMIMIC3()not the old snake-case mortality_prediction_mimic4_fn functions. Pass the instance to dataset.set_task(task).
  • Datasets take an explicit tables=[...] list (e.g. tables=["diagnoses_icd", "procedures_icd", "prescriptions"]).
  • Models require label_key= in addition to feature_keys= and mode=. Common feature keys for EHR tasks are "conditions", "procedures", "drugs".
  • Metric names have no _score suffix: pr_auc, roc_auc, f1; multilabel/drug-rec use the *_samples family (jaccard_samples, f1_samples, pr_auc_samples, ddi). Pass metrics=[...] to the Trainer constructor, and monitor= one of those names.
  • 2.0.1 requires Python 3.12 or 3.13 (>=3.12,<3.14). When unsure of a class/arg name, check the current source rather than trusting older snippets.

When to Use This Skill

Invoke this skill when:

Installs
56
GitHub Stars
61
First Seen
Apr 12, 2026
alterlab-pyhealth — alterlab-ieu/alterlab-academic-skills