Skip to main content

SICdb_MEDS ETL

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

The SICdb dataset offers insights into over 27 thousand intensive care admissions, including therapies and data on preceding surgeries. Data were collected between 2013 and 2021 from four different intensive care units at the University Hospital Salzburg, having more than 3 thousand intensive care admissions per year on 41 beds. The dataset is deidentified and contains, amongst others, case information, vital signs, laboratory results and medication data. SICdb provides both aggregated once-per-hour and highly granular once-per-minute data, making it suitable for computational and machine learning-based research. (source: https://www.sicdb.com/Documentation/Main_Page)

Usage

pip install SICdb_MEDS
export DATASET_DOWNLOAD_USERNAME=$PHYSIONET_USERNAME
export DATASET_DOWNLOAD_PASSWORD=$PHYSIONET_PASSWORD

meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR

# or, if the release is already on disk
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR do_download=false input_dir=$RAW_INPUT_DIR

This one command runs the ETL and then enriches its code metadata with suMEDS (installed with this package): the spec ends with suMEDS's sumeds_enrich stage, which adds LOINC names and same-dataset diagnosis parents to metadata/codes.parquet. If it cannot (no internet, say), the ETL still succeeds, unenriched, and suMEDS-enrich $MEDS_COHORT_DIR finishes it later. Add skip_stages=[sumeds_enrich] for the plain ETL. See Enriching code metadata with suMEDS.

Waveform extraction is not currently supported; see #1.

Configuration

The entire ETL is described by one file, src/SICdb_MEDS/messy.yaml — a MESSY config carrying three sections:

  • sources: — where the raw data lives. meds-extract-download stages it, with SHA-256 verification and resumable transfers. This replaces the old hand-rolled download.py.
  • etl: — the dataset name plus curated stage options (n_subjects_per_shard), what metadata/dataset.json says about the dataset, and the suMEDS enrichment stage that runs after the ETL.
  • the event tables — what to extract, written in dftly expressions.

Because the config is registered under the MEDS_extract.pipelines entry-point group, the extraction half is runnable directly, without this package's CLI wrapper:

# Stage the raw data only:
meds-extract-download spec=SICdb output_dir=$RAW_INPUT_DIR

# Run the canonical 8-stage pipeline over already-pre-MEDS'd data:
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR download_key=null input_dir=$PRE_MEDS_DIR

There is no wrapper CLI and no pre-MEDS step. Both are gone: the archive is unpacked by the download layer, and offsets are resolved to absolute pseudo-timestamps in _table.cols. The package ships no Python at all -- the whole ETL is src/SICdb_MEDS/messy.yaml. A second entry point registers src/SICdb_MEDS/sumeds_rules.yaml with suMEDS under the same name, which is how the spec's enrichment stage finds them.

metadata/dataset.json gives the release's license and PhysioNet page (description_uri), and lists CaseID, the ICU admission key, under raw_source_id_columns. MEDS-Extract lists every other extension column (n_samples, ...) under other_extension_columns.

Code metadata

metadata/codes.parquet describes every code in the data. Every description is defined in messy.yaml and comes from SICdb's own tables or its documentation:

  • Codes that carry a d_references id (ADMISSION//…, DISCHARGE//…, LAB//…, MEDICATION//…, CASE_ATTR//…, DEVICE//…, VITAL//… and the other cases reference columns): the d_references entry, through a _metadata block keyed on the id. Lab codes also get the unit and the LOINC long name.
  • DIAGNOSIS//ICD10GM//…: cases.ICD10MainText.
  • Every other code (MEDS_BIRTH, MEDS_DEATH, SEX//…, ADMISSION_YEAR//…, ICU_ADMISSION, WEIGHT, SAPS3, HEART_SURGERY_…, …): a _self block whose description names the source column.

MEDS-Extract 0.8.0 rejects a _self block on a bare literal code (code: ICU_ADMISSION). The literal codes are therefore read from constant columns of cases._table.cols (_code_icu_admission: '"ICU_ADMISSION"'), and the emitted codes are unchanged. MEDS-Extract 0.8.1 accepts _self on a literal code (MEDS_extract#315), so these can become literals again.

The ETL writes the vocabulary parents that SICdb records itself:

  • ICD10GM/{ICD10Main} for a diagnosis with a canonical ICD-10-GM code.
  • LOINC/{LOINC_code} for a lab whose d_references.LOINC_code is a well-formed LOINC code.

Enriching code metadata with suMEDS

Vocabulary work lives in suMEDS rather than in this ETL. The package ships the rules for it, src/SICdb_MEDS/sumeds_rules.yaml, registered in suMEDS's sumeds.rules entry-point group under the same name as the MEDS-Extract spec, SICdb, so --rules SICdb works for any suMEDS command. The spec runs them as its last stage:

etl:
  post_stages:
    - sumeds_enrich: {rules: SICdb}

The stage replaces metadata/codes.parquet only once the enriched table is complete, and it stays valid MEDS code metadata. The LOINC data comes from suMEDS's ontology packs, fetched from GitHub on first use and cached; an Athena download (athena_csv, below) is the only source for ICD-10-GM.

metadata/dataset.json says whether a build is enriched: sumeds_enrichment.enriched is true (with the rules, pack source and coverage) or false (with the error and the retry command).

jq .sumeds_enrichment.enriched $MEDS_COHORT_DIR/metadata/dataset.json

Enrichment soft-fails: if it cannot run (a server without internet, for example), the ETL still succeeds with metadata/codes.parquet left exactly as MEDS-Extract writes it, and dataset.json records "enriched": false. The warning, with the command that finishes the enrichment, is in $MEDS_COHORT_DIR/.logs/pipeline.log, not on the console. MEDS-Extract marks the stage done either way, so running meds-extract-run again does not retry it. Enrich the build afterwards, with the rules and options of the failed run:

suMEDS-enrich $MEDS_COHORT_DIR
# Air-gapped: from a copy of the sumeds-ontologies packs directory
suMEDS-enrich $MEDS_COHORT_DIR --ontology-source /path/to/sumeds-ontologies/ontologies --offline

For the plain, unenriched ETL, leave the stage out with skip_stages=[sumeds_enrich]:

meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR skip_stages=[sumeds_enrich]

The stage takes the suMEDS-enrich options, spelled with underscores. Set them for one run with overrides=, as ++stage_cfg.<option> (the override reaches every stage of the pipeline, and only this one declares the option, hence the ++):

# Make a failed enrichment fail the run (exit code 1):
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR "overrides=['++stage_cfg.strict=true']"
# Also look codes up in your own OHDSI Athena download:
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR "overrides=['++stage_cfg.athena_csv=/path/to/athena']"
# Read the packs from a local copy (or set SUMEDS_ONTOLOGY_SOURCE=/path/to/ontologies):
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR "overrides=['++stage_cfg.ontology_source=/path/to/ontologies']"

On a cluster whose compute nodes have no internet access, fill a cache on shared storage once from a login node, then run with offline, so nothing tries the network:

# The same cache on the login node and the compute nodes:
export XDG_CACHE_HOME=/shared/project/cache
# On the login node, download the pinned pack release (about 30 MB):
suMEDS-enrich --prefetch --rules SICdb
# On a compute node:
meds-extract-run spec=SICdb output_dir=$MEDS_COHORT_DIR "overrides=['++stage_cfg.offline=true']"

The ETL already describes every code, and suMEDS never overwrites a value, so the descriptions stay SICdb's own. For SICdb, suMEDS adds:

  • LOINC names. The LOINC/… parents of LAB//… codes are looked up in suMEDS's LOINC pack, fetched from GitHub on first use and cached; no Athena download is needed. Each gets its LOINC long common name in parent_names (a map from parent code to name), and the lab code gets vocabulary_id LOINC and its concept_code. The stage option loinc_hierarchy (--loinc-hierarchy for suMEDS-enrich) also adds the LOINC Parts above the term as parents.
  • ICD-10-GM names, with an Athena download (athena_csv) only. suMEDS has no ICD-10-GM pack, so the ICD10GM/… parents of DIAGNOSIS//ICD10GM//… codes are resolved only from an Athena download that includes the vocabulary, which also gives the diagnosis codes their OMOP concept fields.
  • Same-dataset diagnosis parents, from the one rule of the file:
Rule Kind Adds
sicdb-diagnosis-icd10gm-prefix hierarchy, mode: prefix, ignore: "." the nearest shorter diagnosis code that also occurs in the data (DIAGNOSIS//ICD10GM//S62.60 gets DIAGNOSIS//ICD10GM//S62.6, else DIAGNOSIS//ICD10GM//S62)

Only canonical ICD-10-GM codes take part, the same shapes the ETL's ICD10GM/ parent accepts. The parents the ETL wrote keep their place at the start of parent_codes, and the added ones follow. The same rules work with suMEDS … --rules SICdb to build a privacy-masked code catalog of the output.

tests/test_sumeds_rules.py loads the rules by their registered name and runs the rule, offline, on codes that MEDS-Extract renders from messy.yaml. tests/test_run_with_enrichment.py runs meds-extract-run spec=SICdb with its enrichment stage on a small synthetic release (tests/conftest.py) with a local LOINC pack, and checks that the enrichment keeps every value the plain build (skip_stages=[sumeds_enrich]) wrote and is recorded in dataset.json. It also runs against an empty pack source, to check the soft failure and its suMEDS-enrich retry, and with strict.

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

Summary statistics

tests/regression/full_summary_stats.json is a meds_summary_stats fingerprint of the MEDS dataset this ETL builds from the full SICdb 1.0.8 release with meds-extract-run spec=SICdb, so its code-metadata coverage includes the suMEDS enrichment. It covers subject, event and measurement counts, digests of the code vocabulary, per-subject, value and time distributions, code-metadata coverage, the splits and the schema. It names no code and reports no cell of fewer than 20 subjects and no minimum or maximum, which is what makes it safe to publish. Because it is committed next to the ETL, its diff shows what an ETL change did to the output, and two ETL versions can be compared without access to the data.

Regenerate it in every pull request that changes the output, from a build of that branch:

# Build the release with this checkout, then summarize it
scripts/summary_stats.sh full --input-dir $RAW_INPUT_DIR
# Or summarize a build of this checkout you already have
scripts/summary_stats.sh full --meds-dir $MEDS_OUTPUT_DIR

Both print how the statistics changed against the committed baseline before overwriting it, and refuse a build whose enrichment failed (finish it with suMEDS-enrich first). Add --compare to check a build without writing anything; it exits 1 when tests/regression/policy.yaml flags an error. Rebuilding the same commit reproduces the baseline exactly, so any finding is a change in the output. CI cannot rebuild the credentialed release, so the Summary stats workflow only warns when a pull request changes src/ (the config or the suMEDS rules) without regenerating the baseline. A MEDS-Extract, suMEDS or polars upgrade can also move the output, so check it with --compare.

Development

See DEVELOPMENT.md for setup, tests, running the ETL locally, and the release process.

Citation

If you use this dataset, please cite the original publication below and the ETL (see cite this repository):

@article{rodemundHarnessingBigData2024,
title = {Harnessing {Big} {Data} in {Critical} {Care}: {Exploring} a new {European} {Dataset}},
volume = {11},
copyright = {2024 The Author(s)},
issn = {2052-4463},
shorttitle = {Harnessing {Big} {Data} in {Critical} {Care}},
url = {https://www.nature.com/articles/s41597-024-03164-9},
doi = {10.1038/s41597-024-03164-9},
language = {en},
number = {1},
urldate = {2024-04-04},
journal = {Scientific Data},
author = {Rodemund, Niklas and Wernly, Bernhard and Jung, Christian and Cozowicz, Crispiana and Koköfer, Andreas},
month = mar,
year = {2024},
note = {Publisher: Nature Publishing Group},
keywords = {Clinical trial design, Experimental models of disease},
pages = {320},
}

For the ETL:

@software{van_de_Water_SICdb_MEDS_ETL_2025,
author = {van de Water, Robin P.},
doi = {10.5281/zenodo.14893939},
license = {MIT},
month = feb,
title = {{SICdb\_MEDS ETL}},
url = {https://github.com/rvandewater/SICdb_MEDS},
version = {0.0.1},
year = {2025}
}

Metadata

Release files for SICdb-MEDS 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SICdb-MEDS 0.2.0
File Size Uploaded Provenance Actions
sicdb_meds-0.2.0.tar.gz 37.7 kB With provenance Details for sicdb_meds-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SICdb-MEDS 0.2.0
File Interpreter ABI Platform Actions
sicdb_meds-0.2.0-py3-none-any.whl Python 3 none any Details for sicdb_meds-0.2.0-py3-none-any.whl

Total release size: 60.5 kB

Release files / sicdb_meds-0.2.0.tar.gz

Download URL sicdb_meds-0.2.0.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0962b50fb68bcea68a0b8b04eda0cb9a62d1f88b1a476a286099d08f278d9b39
BLAKE2b-256 checksum
How to use checksums
2172f637c6333c3b49b8792915ddd047367c97c418b0d80ad21960a08a87631a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / sicdb_meds-0.2.0-py3-none-any.whl

Download URL sicdb_meds-0.2.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33af50db48c7de5f918ea0ca165c42c34b89995ef1b3bc4b1a2fb907cdbb61e2
BLAKE2b-256 checksum
How to use checksums
62e99b717767530c46a056bdf38a29be1c850aa51bd1a3277c9f78acc49f4877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for SICdb-MEDS 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sicdb_meds-0.2.0.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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