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}
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inspire_meds-1.0.0.tar.gz.
File metadata
- Download URL: inspire_meds-1.0.0.tar.gz
- Upload date:
- Size: 186.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
673f1ecf3d51e3392da56fdc9ec59a88e5417192e22b3efe5f3753b71da5ef5f
|
|
| MD5 |
3fe099b620d0ad68ef43f77aa216ac99
|
|
| BLAKE2b-256 |
9bd2c1118be71a218f8ee31c45648148a01f84865edcdbfd49b8fc78327a95c5
|
Provenance
The following attestation bundles were made for inspire_meds-1.0.0.tar.gz:
Publisher:
python-build.yaml on rvandewater/INSPIRE_MEDS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inspire_meds-1.0.0.tar.gz -
Subject digest:
673f1ecf3d51e3392da56fdc9ec59a88e5417192e22b3efe5f3753b71da5ef5f - Sigstore transparency entry: 2685635572
- Sigstore integration time:
-
Permalink:
rvandewater/INSPIRE_MEDS@7fcd0b575b5a542559e72ace6a95ed3ec9cba93c -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/rvandewater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-build.yaml@7fcd0b575b5a542559e72ace6a95ed3ec9cba93c -
Trigger Event:
push
-
Statement type:
File details
Details for the file inspire_meds-1.0.0-py3-none-any.whl.
File metadata
- Download URL: inspire_meds-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
048192c4fd07d8641bd773754c1feb00396d3183035f21f55ceae47e35e599d7
|
|
| MD5 |
c85c7600780e3be7ac002b250225938e
|
|
| BLAKE2b-256 |
780c0a37050023394f974d1194c3983b5b911dc5c2ce09cf71b7966f2a0ee36d
|
Provenance
The following attestation bundles were made for inspire_meds-1.0.0-py3-none-any.whl:
Publisher:
python-build.yaml on rvandewater/INSPIRE_MEDS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inspire_meds-1.0.0-py3-none-any.whl -
Subject digest:
048192c4fd07d8641bd773754c1feb00396d3183035f21f55ceae47e35e599d7 - Sigstore transparency entry: 2685635979
- Sigstore integration time:
-
Permalink:
rvandewater/INSPIRE_MEDS@7fcd0b575b5a542559e72ace6a95ed3ec9cba93c -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/rvandewater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-build.yaml@7fcd0b575b5a542559e72ace6a95ed3ec9cba93c -
Trigger Event:
push
-
Statement type: