Skip to content

Add INSPIRE dataset — task-contract predicates + INSPIRE-MEDS 0.1.0#320

Open
florian6973 wants to merge 4 commits into
Medical-Event-Data-Standard:devfrom
florian6973:add-inspire-dataset
Open

Add INSPIRE dataset — task-contract predicates + INSPIRE-MEDS 0.1.0#320
florian6973 wants to merge 4 commits into
Medical-Event-Data-Standard:devfrom
florian6973:add-inspire-dataset

Conversation

@florian6973

Copy link
Copy Markdown
Collaborator

Add INSPIRE dataset — task-contract predicates + INSPIRE-MEDS 0.1.0

Registers the INSPIRE (VitalDB / SNUH) dataset. This builds on the work in #308 (its registration commits are included and preserved) and adds two corrections so INSPIRE works end-to-end against the shared tasks and the current PhysioNet layout.

Contents

  • INSPIRE dataset registration — README.md, dataset.yaml, refs.bib (from Add the INSPIRE dataset #308).

  • predicates.yaml — rewritten to the MEDS-DEV task contract. The original predicates matched zero events and could not drive any shared task:

    • codes had unit and name reversed (the ETL emits LAB//<name>//<unit>, e.g. LAB//creatinine//mg/dL, not unit-first);
    • structural predicates used ^X//.* regexes (copied from MIMIC-IV, whose codes carry a // suffix), but INSPIRE emits bare scalar codes (HOSPITAL_ADMISSION, ICU_ADMISSION, …);
    • predicate names (creatinine_mgdl, map_mmhg, …) didn't match the names the tasks reference, and there were no abnormally_* thresholds.

    This version uses the task-contract names + adds the threshold predicates (creatinine>1.3, sodium<135, bicarbonate<22, hemoglobin<13, wbc>11, platelets<150; MAP<65), with units transferred from MIMIC-IV (INSPIRE's native units are numerically equivalent). Verified against a full INSPIRE 1.4.2 build (data vocab + value distributions): 7 of 8 shared tasks resolve through ACES with non-degenerate thresholds — all except any ED-based task (INSPIRE has no ED encounters, so ED_registration/ED_discharge are intentionally omitted).

  • requirements.txtINSPIRE-MEDS==0.1.0 (was 0.0.13). 0.1.0 adds native reading of gzipped raw tables, so the current PhysioNet 1.4.x layout (operations.csv.gz, labs.csv.gz, …) builds with no manual decompression. Drop-in: same meds-transforms~=0.2.4 pin and a byte-identical event_configs.yaml, so the predicates above are unaffected.

Notes

  • Remaining step to advertise task support: add INSPIRE to each supported task's metadata.supported_datasets.
  • Happy to fold these two commits into Add the INSPIRE dataset #308 instead if the maintainers prefer — whatever's easier to review.

🤖 Generated with Claude Code

mmcdermott and others added 4 commits May 13, 2026 13:43
Rewrites the INSPIRE predicates so the shared MEDS-DEV tasks actually resolve
against a built INSPIRE cohort. Verified against a full INSPIRE v1.4.2 build
(100 shards, 3,230 codes; metadata/codes.parquet + value distributions).

The original predicates matched ZERO events and used non-contract names:
  - LAB / WARD_VITAL codes had unit and name reversed. Codes are built as
    "LAB//<item_name>//<unit>" / "WARD_VITAL//<item_name>//<unit>"
    (INSPIRE_MEDS/configs/event_configs.yaml), not unit-first.
  - Structural predicates used "^X//.*" regexes (copied from MIMIC-IV, whose
    codes carry a "//" suffix); INSPIRE emits BARE scalar codes -> use exact codes.
  - Predicate NAMES (creatinine_mgdl, sodium_meql, wbc_kul, platelets_kul,
    map_mmhg) did not match the names the tasks reference (creatinine, sodium,
    wbc, platelets, map, + abnormally_* thresholds), so no lab/vital task wired up.

Changes:
  - Structural: exact HOSPITAL_ADMISSION / HOSPITAL_DISCHARGE / ICU_ADMISSION /
    ICU_DISCHARGE.
  - Renamed to the task-contract names and added the missing abnormally_*
    threshold predicates (creatinine>1.3, sodium<135, bicarbonate<22,
    hemoglobin<13, wbc>11, platelets<150, map<65). Thresholds copied unchanged
    from MIMIC-IV — INSPIRE's native units are numerically equivalent
    (mmol/L==mEq/L, /nL==K/uL). Each threshold uses a single plain-string code
    (es-aces applies value_min/value_max only to plain codes), MAP as or(...) of
    per-code thresholds (mirrors MIMIC-IV).
  - Added bicarbonate (LAB//hco3//mmol/L) and hemoglobin (LAB//hb//g/dL), which
    were absent; both exist in the built cohort.
  - Dropped VITAL//pap_mbp//mmHg from MAP (pulmonary-artery, not systemic MAP).

This wires up all 8 shared tasks (abnormal_lab/{elevated_creatinine,hyponatremia,
metabolic_acidosis,anemia,leukocytosis,thrombocytopenia,hypotension}/first_24h and
mortality/in_icu/first_24h). Remaining step to advertise support: add INSPIRE to
each task's metadata.supported_datasets. INSPIRE has no ED encounters, so the
MIMIC ED_registration/ED_discharge predicates are intentionally omitted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
INSPIRE-MEDS 0.1.0 (PyPI, 2026-07-17) adds reading of gzipped raw tables, so the current
PhysioNet 1.4.x layout (operations.csv.gz, labs.csv.gz, ...) builds directly with no manual
decompression. Drop-in: 0.1.0 keeps the same meds-transforms~=0.2.4 pin and an identical
event_configs.yaml (code construction unchanged), so the predicates here are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@florian6973
florian6973 requested a review from mmcdermott July 20, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants