INSPIRE-MEDS
The INSPIRE dataset is a publicly available research dataset in perioperative medicine, which includes approximately 130,000 cases (50% of all surgical cases) who underwent anesthesia for surgery at an academic institution in South Korea between 2011 and 2020. This comprehensive dataset includes patient characteristics such as age, sex, American Society of Anesthesiologists physical status classification, diagnosis, surgical procedure code, department, and type of anesthesia. It also includes vital signs in the operating theatre, general wards, and intensive care units (ICUs), laboratory results from six months before admission to six months after discharge, and medication during hospitalization. Complications include total hospital and ICU length of stay and in-hospital death. This pipeline extracts the INSPIRE dataset (from physionet, https://physionet.org/content/inspire/) into the MEDS format.
Usage:
pip install INSPIRE_MEDS
export DATASET_DOWNLOAD_USERNAME=$PHYSIONET_USERNAME
export DATASET_DOWNLOAD_PASSWORD=$PHYSIONET_PASSWORD
MEDS_extract-INSPIRE $ROOT_OUTPUT_DIR
That downloads the raw INSPIRE files, builds a small derived table (see Birth and death), and runs the full eight-stage MEDS-Extract pipeline. To reuse a download you already have:
MEDS_extract-INSPIRE $ROOT_OUTPUT_DIR --raw-input-dir $RAW_INPUT_DIR --do-download false
Configuration
Nearly all of the pipeline is one file,
src/INSPIRE_MEDS/messy.yaml, registered under the
MEDS_extract.pipelines entry-point group. The one exception is described under
Birth and death below.
Pseudo-timestamps
INSPIRE ships no wall-clock times. Every time column is an offset in minutes, anchored per
patient at that patient's own first hospital admission — min(admission_time) is 0 for all
99,886 subjects. Each patient's anchor is then placed at one shared literal origin, the midpoint
of the study window (2011-01-01 .. 2020-12-31) = 2016-01-01.
So only relative differences within a subject are meaningful. The absolute dates in the MEDS output are not real dates, and comparing them across subjects is meaningless.
Null handling
A null component of a composite code drops the row under MEDS-Extract 0.7, where 0.6.x rendered
it as the literal UNK and kept the row. Components are therefore coalesced with ?? 'UNK'
wherever a null must not drop the row.
Two are deliberately left uncoalesced. route on medications is never null in the release (0 of
10,854,338 rows), so a coalesce would be dead code. The demographic codes drop rather than mint
an UNK category, because a missing demographic is not an observed value.
Birth and death
MEDS_BIRTH and MEDS_DEATH are properties of a subject, but INSPIRE records what they
derive from on operations, which is one row per operation:
ageis the age on the operation date, quantised to 5-year bins, so a patient with several operations in one admission can straddle a bin boundary and carry two ages.inhosp_death_timeappears only on the rows of the admission during which the patient died, whileallcause_death_timeis invariant across all their rows.
MESSY cannot reduce a table over its own rows — self-joins are rejected and dftly is strictly
row-wise — so INSPIRE_MEDS.pre_MEDS reduces operations to one row per subject and the config
joins it back. That is the only Python this package ships. It runs against a staging directory of
symlinks, so the checksum-verified download is never modified.
Was (pre_MEDS.py) |
Now |
|---|---|
ORIGIN_PSUEDOTIME |
_origin: ("2016-01-01"::?"%Y-%m-%d")::datetime |
+ pl.duration(minutes=offset) |
$_origin + $<col>::minutes |
.sort(admission_time).group_by(subject_id).first() |
self-join cols: {age: min, admission_time: min} plus an _is_first guard on the patient-level events |
min(inhosp_death_time, allcause_death_time) |
a dftly conditional |
MEDS-transforms settings
If you want to convert a large dataset, you can use parallelization with MEDS-transforms (the MEDS-transformation step that takes the longest).
Using local parallelization with the hydra-joblib-launcher package, you can set the number of workers:
pip install hydra-joblib-launcher --upgrade
Then, you can set the number of workers as environment variable:
export N_WORKERS=8
Moreover, you can set the number of subjects per shard to balance the parallelization overhead based on how many subjects you have in your dataset:
export N_SUBJECTS_PER_SHARD=100000
The MIMIC-IV OMOP Dataset
We use the demo dataset for MIMIC-IV in the OMOP format, which is a subset of the MIMIC-IV dataset. This dataset downloaded from Physionet does not include the standard dictionary linking definitions but should otherwise be functional
Particularities
- Care site is added to the visit as text
- Add support for care_site table (visit_detail)
Citation
Please cite the following original paper when using the INSPIRE dataset:
@article{PhysioNet-inspire-1.4.2,
author = {Lim, Leerang and Lee, Hyung-Chul},
title = {{INSPIRE, a publicly available research dataset for perioperative medicine}},
journal = {{PhysioNet}},
year = {2026},
month = jun,
note = {Version 1.4.2},
doi = {10.13026/1eay-yc85},
url = {https://doi.org/10.13026/1eay-yc85}
}
Also cite the ETL framework used to extract the dataset:
@software{van_de_Water_INSPIRE_MEDS_ETL_2025,
author = {van de Water, Robin Philippus},
doi = {10.5281/zenodo.14891940},
license = {MIT},
month = feb,
title = {{INSPIRE\_MEDS ETL}},
url = {https://github.com/rvandewater/INSPIRE_MEDS},
year = {2025}
}
For citing MEDS in general:
@article{mcdermott2026meds,
title={MEDS—An Emerging Data Standard and Ecosystem for Health AI Research},
author={McDermott, Matthew BA and Steinberg, Ethan and Fries, Jason A and van de Water, Robin P and Pang, Chao and Rockenschaub, Patrick and Renc, Pawel and Oh, Jungwoo and Stankevi{\v{c}}i{\=u}t{\.e}, Kamil{\.e} and Xu, Justin and others},
journal={NEJM AI},
volume={3},
number={6},
pages={AIra2501253},
year={2026},
publisher={Massachusetts Medical Society}
}
Metadata
Release files for INSPIRE-MEDS 1.0.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 | |
|---|---|---|---|
| inspire_meds-1.0.0.tar.gz | 186.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inspire_meds-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 199.0 kB
Release files / inspire_meds-1.0.0.tar.gz
| Download URL | inspire_meds-1.0.0.tar.gz |
|---|---|
| Size | 186.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
673f1ecf3d51e3392da56fdc9ec59a88e5417192e22b3efe5f3753b71da5ef5f
|
|
BLAKE2b-256 checksum How to use checksums |
9bd2c1118be71a218f8ee31c45648148a01f84865edcdbfd49b8fc78327a95c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 2, 2026.
Transparency logRelease files / inspire_meds-1.0.0-py3-none-any.whl
| Download URL | inspire_meds-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
048192c4fd07d8641bd773754c1feb00396d3183035f21f55ceae47e35e599d7
|
|
BLAKE2b-256 checksum How to use checksums |
780c0a37050023394f974d1194c3983b5b911dc5c2ce09cf71b7966f2a0ee36d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 2, 2026.
Transparency log