PICdb MEDS Extraction ETL
This pipeline extracts the Paediatric Intensive Care (PIC) database v1.1.0 from PhysioNet into the MEDS format. PIC holds 12,881 neonatal and paediatric patients and 13,449 hospital admissions from the Children's Hospital of Zhejiang University School of Medicine (2010–2018). It was built from the ETL_MEDS_Template and uses the config-only layout introduced by MEDS-Extract 0.7.
Usage
PIC is a credentialed dataset. You need a PhysioNet account that has signed the PIC data use agreement.
pip install git+https://github.com/rvandewater/PICdb_MEDS.git
export DATASET_DOWNLOAD_USERNAME=$PHYSIONET_USERNAME
export DATASET_DOWNLOAD_PASSWORD=$PHYSIONET_PASSWORD
meds-extract-run spec=PICdb output_dir=$MEDS_OUTPUT_DIR
When you run this, the program will:
- Download the v1.1.0 tables (
V1.1.0/*.csv, about 1.2 GB) from PhysioNet into$MEDS_OUTPUT_DIR/.meds_extract_run/raw_input. Files that already exist and match their checksums are skipped, so an interrupted download resumes. Passdownload_dest_dir=$RAW_INPUT_DIRto keep the raw data somewhere durable and reuse it across runs. - Build the MEDS cohort from those files and write it to
$MEDS_OUTPUT_DIR(data/andmetadata/). All transformations, joins and metadata extraction are declared insrc/PICdb_MEDS/event_configs.yaml.
If you already have the PhysioNet release on disk, skip the download and point input_dir at the
release root, the directory that contains V1.1.0/:
meds-extract-run spec=PICdb output_dir=$MEDS_OUTPUT_DIR \
do_download=false input_dir=/path/to/paediatric-intensive-care-database-1.1.0
To parallelize the stages, pass a runner file:
printf 'parallelize:\n n_workers: 8\n launcher: joblib\n' >runner.yaml
meds-extract-run spec=PICdb output_dir=$MEDS_OUTPUT_DIR stage_runner_fp=runner.yaml
Run meds-extract-run --help for every option.
How this ETL is defined
The package contains no Python. The whole ETL is one MESSY (MEDS-Extract Specification Syntax YAML)
file, src/PICdb_MEDS/event_configs.yaml. It declares:
sources:: where the raw data lives (the PhysioNet release, restricted toV1.1.0/*.csv).etl:: the dataset name and sharding options.- One block per raw table: how each row becomes one or more MEDS events, and which dictionary tables describe the resulting codes.
pyproject.toml registers the file with MEDS-Extract's MEDS_extract.pipelines entry-point group under
the name PICdb. That registration is what makes spec=PICdb work. No pre-MEDS step is needed: every
PIC table already carries SUBJECT_ID, and every timestamp has the same format.
Events
| Table | Event codes | Notes |
|---|---|---|
PATIENTS |
GENDER//{gender}, MEDS_BIRTH, MEDS_DEATH |
Death time is the earliest ADMISSIONS.DEATHTIME, falling back to DOD. |
ADMISSIONS |
HOSPITAL_ADMISSION//{dept}, HOSPITAL_DISCHARGE//{dept}, INSURANCE//…, ETHNICITY//…, ADMISSION_DIAGNOSIS//ICD10_CN//{code} |
ED times equal admit/discharge times in every row, so there are no separate ED events. |
ICUSTAYS |
ICU_ADMISSION//{careunit}, ICU_DISCHARGE//{careunit} |
|
DIAGNOSES_ICD |
DIAGNOSIS//ICD10_CN//{code} |
Placed at hospital discharge. seq_num and diag_category are kept as columns. |
LABEVENTS |
LAB//{itemid}//{unit} |
numeric_value, text_value and flag are kept. |
CHARTEVENTS |
CHART//{itemid}//{unit} |
|
INPUTEVENTS |
FLUID_INPUT//{unit} |
PIC records only fluid intake amounts here, with no item ID. |
OUTPUTEVENTS |
OUTPUT//{itemid}//{unit} |
|
PRESCRIPTIONS |
MEDICATION//START//{drug}//{dose unit}, MEDICATION//END//{drug} |
Uses the English drug name. The dose is the numeric_value. |
MICROBIOLOGYEVENTS |
MICROBIOLOGY//SPECIMEN//{spec_itemid}, MICROBIOLOGY//ORGANISM//{org_itemid}, MICROBIOLOGY//SUSCEPTIBILITY//{ab_itemid}//{S/I/R…} |
The MIC dilution is the numeric_value. Organism and specimen IDs are kept as columns. |
OR_EXAM_REPORTS |
EXAM//{type}//{item} |
Uses the exam time, or the report time when the exam time is missing. |
EMR_SYMPTOMS |
SYMPTOM//{symptom}//{+/-} |
Symptoms extracted by NLP from clinical notes. |
SURGERY_INFO |
SURGERY//START//{name}, SURGERY//END//{name}, ANESTHESIA//START//{method}, ANESTHESIA//END//{method} |
|
SURGERY_VITAL_SIGNS |
SURGERY_VITAL//{itemid} |
Intra-operative monitoring. Units are in the code metadata (unit). |
A missing unit or susceptibility interpretation becomes UNK in the code. A row with a missing
identifying component (for example, no organism) produces no event for that component.
Code metadata
metadata/codes.parquet describes every code except MEDS_BIRTH and MEDS_DEATH, and links codes to
PIC's dictionary tables:
description: one English description per code, from one of two routes.- PIC dictionaries: the English label from
D_LABITEMS(labs),D_ICD_DIAGNOSES(diagnoses) orD_ITEMS(chart, output and intra-operative vital items, organisms, antibiotics, and the specimen IDsD_ITEMSlists). These are joined when the ETL runs; nothing from them is copied into this repository. - Templates: every other code gets a
_selftemplate in the event config. The template restates the code's parts in words and names the PIC column they come from, for exampleICU admission; first care unit: PICU, paediatric ICU (PIC ICUSTAYS.FIRST_CAREUNIT). The wording follows the PhysioNet PIC documentation and the PIC paper (Zeng et al. 2020, CC BY 4.0). The paper names the five ICUs and says whatINPUTEVENTSholds. The PhysioNet page explains the+/-symptom attribute and the "Other" ethnicity group. A specimen ID thatD_ITEMSdoes not list gets a description saying so; its Chinese name is inspec_type_desc_cn. MEDS_BIRTHandMEDS_DEATHhave no description. MEDS-Extract 0.7 attaches no metadata to a literal code, and the MEDS standard defines what these two mean.
- PIC dictionaries: the English label from
parent_codes:LOINC/…for lab items with a well-formed LOINC code, andICD10/…for diagnoses whose mapped code is a valid 3- or 4-character WHO ICD-10 code. Both come from PIC's own dictionaries (D_LABITEMS.LOINC_CODE,D_ICD_DIAGNOSES.ICD10_CODE). PIC's own extended codes (7+ characters) have no parent. Other vocabularies and same-dataset parents are added by suMEDS (next section).- Chinese source terms: kept in their own columns (
title_cn,label_cn,drug_name_cn,org_name_cn,spec_type_desc_cn,ab_name_cn,symptom_name_cn). Codes are always built from the English or ID columns. - Extra dictionary fields:
fluid,categoryandunit.
Enriching code metadata with suMEDS
External-ontology work lives in suMEDS, not in this ETL. The
package ships the rules for it, src/PICdb_MEDS/sumeds_rules.yaml (also installed as package data), which
suMEDS applies to a finished build (this needs suMEDS 0.4 or later, pip install "sumeds>=0.4"):
suMEDS-enrich "$MEDS_OUTPUT_DIR/metadata/codes.parquet" -o codes-enriched.parquet \
--rules src/PICdb_MEDS/sumeds_rules.yaml
The rules add, as VOCABULARY//CODE parents and same-dataset codes:
- ICD-O-3 morphology (
picdb-icdo3-morphology): diagnoses coded in the Chinese edition of ICD-O-3 (M80000/3; the PIC paper notes that diagnoses use both ICD-10 and ICD-O-3) get the OMOP ICDO3 histology code (ICDO3//8000/3). suMEDS's versioned ontology data (sumeds-ontologies, pinned release) has no ICD-O-3 pack, so this is a tag that is validated only when Athena is configured (--athena-csv). - Same-dataset parents (
picdb-diagnosis-prefix,picdb-admission-diagnosis-prefix): a diagnosis code gets the nearest shorter code of the same family that exists in the build, skipping dots, for exampleDIAGNOSIS//ICD10_CN//A18.000+underDIAGNOSIS//ICD10_CN//A18.000.
The ETL alone writes no ICDO3 parents and no same-dataset parents; run suMEDS to get them.
Data notes
- Shifted dates. Dates are shifted 50–100 years into the future per patient. Years between 2049 and 2119 are expected, and intervals within a patient are preserved.
- Release layout. The v1.1.0 release ships the current tables under
V1.1.0/. The gzipped files at the release root are the superseded v1.0.0 tables, and this ETL does not read them. - Swapped column names. In
PRESCRIPTIONS, the CSV headerDRUG_NAMEholds the Chinese name andDRUG_NAME_ENthe English one. The bundled SQL scripts name these columns differently. - Many-to-many microbiology IDs. Item IDs and their Chinese names do not map one-to-one, so codes
use the item IDs. Expect MEDS-Extract warnings that some codes have several
*_cnvalues; those values are aggregated into lists. - Uninformative columns.
LANGUAGE,RELIGIONandMARITAL_STATUShold a single value across the release and are not extracted. - Local diagnosis codes. Diagnoses use PIC's extended Chinese ICD-10 codes (
ICD10_CN), so they do not yet line up with standard ICD-10 codes in other datasets. Valid standard codes are attached asparent_codes. Mapping equivalent codes to standard ICD-10 needs a MEDS-Extract feature; see #1.
Testing
PIC has no open demo release. Instead, tests/e2e_synthetic_test.py writes a few fully synthetic rows
with PIC's exact headers and layout, runs meds-extract-run spec=PICdb over them, and checks the
events, times, values and code metadata it produces. That includes checking that the output validates
against meds.CodeMetadataSchema. tests/test_code_descriptions.py checks the config itself: every
event block declares exactly one description, a _self description reads only the code's own parts,
and parents use OMOP vocabulary prefixes. tests/test_sumeds_rules.py loads sumeds_rules.yaml with
suMEDS, which rejects a malformed rule, and applies each rule through suMEDS to synthetic codes built
from the code templates in the event config.
uv sync --group dev
uv run pytest tests/ -v
uv run pre-commit run --all-files
Releasing
A release bumps the version in pyproject.toml with uv version --bump, commits it with the updated
CITATION.cff and pushes a tag of that exact version, which publishes to PyPI and creates the GitHub
release. See RELEASING.md for choosing the bump, the
full release commands, and recovering from a failed release.
Citation
If you use this ETL, please cite the PIC database and its descriptor paper:
@article{PhysioNet-picdb-1.1.0,
author = {Li, Haomin and Zeng, Xian and Yu, Gang},
title = {{Paediatric Intensive Care database}},
journal = {{PhysioNet}},
year = {2020},
month = nov,
note = {Version 1.1.0},
doi = {10.13026/32x9-wv38},
url = {https://doi.org/10.13026/32x9-wv38}
}
@article{zengPICPaediatricspecificIntensive2020,
title = {{{PIC}}, a Paediatric-Specific Intensive Care Database},
author = {Zeng, Xian and Yu, Gang and Lu, Yang and Tan, Linhua and Wu, Xiujing and Shi, Shanshan and Duan, Huilong and Shu, Qiang and Li, Haomin},
year = 2020,
month = jan,
journal = {Scientific Data},
volume = {7},
number = {1},
pages = {14},
publisher = {Nature Publishing Group},
issn = {2052-4463},
doi = {10.1038/s41597-020-0355-4},
copyright = {2020 The Author(s)},
langid = {english},
}
See also CITATION.cff.
Metadata
Release files for PICdb-MEDS 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| picdb_meds-0.0.3.tar.gz | 22.8 kB | With provenance | Details for picdb_meds-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| picdb_meds-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for picdb_meds-0.0.3-py3-none-any.whl |
Total release size: 38.6 kB
Release files / picdb_meds-0.0.3.tar.gz
| Download URL | picdb_meds-0.0.3.tar.gz |
|---|---|
| Size | 22.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e6316e889447b42565b34f0d976828e4f382f04e6e1f714c9802b54dc715a9f
|
|
BLAKE2b-256 checksum How to use checksums |
0551056cc6b9943d71b3cb150bdc6042cd2c31c8dc235368db2f608152ec0426
|
| 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 4, 2026.
Transparency logRelease files / picdb_meds-0.0.3-py3-none-any.whl
| Download URL | picdb_meds-0.0.3-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cb11e1596b7a799e8820b5d83e92e8e6acc7fb98e652466ce65ab8a89160963
|
|
BLAKE2b-256 checksum How to use checksums |
dec2bcba9ad4ec03b7bbd8ddd618869b4cd55847ac85f9c77471d916c6c3ede3
|
| 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 4, 2026.
Transparency logSecurity for PICdb-MEDS 0.0.3
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.
Attestation for picdb_meds-0.0.3.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 4, 2026.
Transparency logA 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.