Skip to main content

INSPIRE-MEDS

PyPI - Version codecov tests code-quality python Static Badge license PRs contributors DOI

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:

  • age is 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_time appears only on the rows of the admission during which the patient died, while allcause_death_time is 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

inspire_meds-1.0.0.tar.gz (186.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inspire_meds-1.0.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

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

Hashes for inspire_meds-1.0.0.tar.gz
Algorithm Hash digest
SHA256 673f1ecf3d51e3392da56fdc9ec59a88e5417192e22b3efe5f3753b71da5ef5f
MD5 3fe099b620d0ad68ef43f77aa216ac99
BLAKE2b-256 9bd2c1118be71a218f8ee31c45648148a01f84865edcdbfd49b8fc78327a95c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for inspire_meds-1.0.0.tar.gz:

Publisher: python-build.yaml on rvandewater/INSPIRE_MEDS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for inspire_meds-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 048192c4fd07d8641bd773754c1feb00396d3183035f21f55ceae47e35e599d7
MD5 c85c7600780e3be7ac002b250225938e
BLAKE2b-256 780c0a37050023394f974d1194c3983b5b911dc5c2ce09cf71b7966f2a0ee36d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.0

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page