Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions pyhealth/datasets/configs/mimic4_ehr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ tables:
- "race"
- "discharge_location"
- "dischtime"
- "deathtime"
- "hospital_expire_flag"

icustays:
Expand Down Expand Up @@ -117,3 +118,84 @@ tables:
- "hcpcs_cd"
- "seq_num"
- "short_description"

transfers:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] New MIMIC-IV tables are not exercised by any dataset-level test

The six tables added here (transfers, microbiologyevents, chartevents, outputevents, inputevents, procedureevents) are only read through hand-built Patient objects in tests/core/test_yaib_mimic4.py. No test loads them through MIMIC4EHRDataset, runs YAIB's pre_filter through set_task, or checks the config column names against a real table layout. The demo fixture in test-resources/core/mimic4demo has none of these tables, while existing MIMIC-IV task tests (tests/core/test_mimic4_los.py, tests/core/test_mimic4_dka.py) run set_task on that fixture. Fix: add minimal CSV fixtures for these tables (or extend the demo fixture) and one set_task test per task family, including the missing-table ValueError path through the real loader.

file_path: "hosp/transfers.csv.gz"
patient_id: "subject_id"
timestamp: "intime"
attributes:
- "hadm_id"
- "transfer_id"
- "eventtype"
- "careunit"
- "outtime"

microbiologyevents:
file_path: "hosp/microbiologyevents.csv.gz"
patient_id: "subject_id"
timestamp: "chartdate"
attributes:
- "hadm_id"
- "micro_specimen_id"
- "charttime"
- "spec_itemid"
- "spec_type_desc"
- "test_itemid"
- "test_name"
- "org_itemid"
- "org_name"

chartevents:
file_path: "icu/chartevents.csv.gz"
patient_id: "subject_id"
timestamp: "charttime"
attributes:
- "hadm_id"
- "stay_id"
- "itemid"
- "value"
- "valuenum"
- "valueuom"

outputevents:
file_path: "icu/outputevents.csv.gz"
patient_id: "subject_id"
timestamp: "charttime"
attributes:
- "hadm_id"
- "stay_id"
- "itemid"
- "value"
- "valueuom"

inputevents:
file_path: "icu/inputevents.csv.gz"
patient_id: "subject_id"
timestamp: "starttime"
attributes:
- "hadm_id"
- "stay_id"
- "itemid"
- "endtime"
- "amount"
- "amountuom"
- "rate"
- "rateuom"
- "patientweight"
- "orderid"
- "linkorderid"
- "ordercategoryname"
- "statusdescription"

procedureevents:
file_path: "icu/procedureevents.csv.gz"
patient_id: "subject_id"
timestamp: "starttime"
attributes:
- "hadm_id"
- "stay_id"
- "itemid"
- "endtime"
- "value"
- "valueuom"
- "statusdescription"
7 changes: 7 additions & 0 deletions pyhealth/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
VariantClassificationClinVar,
)
from .patient_linkage_mimic3 import PatientLinkageMIMIC3Task
from .yaib_mimic4 import (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] New public tasks have no API docs entry

Five public task classes are exported here, but no docs/api/tasks/*.rst file or docs/api/tasks.rst toctree entry is added, unlike other task modules such as InHospitalMortalityMIMIC4. Add an autoclass page per task (or one for the module) so the new tasks appear in the API reference.

YAIBAKIMIMIC4 as YAIBAKIMIMIC4,
YAIBKidneyFunctionMIMIC4 as YAIBKidneyFunctionMIMIC4,
YAIBLengthOfStayMIMIC4 as YAIBLengthOfStayMIMIC4,
YAIBMortalityMIMIC4 as YAIBMortalityMIMIC4,
YAIBSepsisMIMIC4 as YAIBSepsisMIMIC4,
)


def __getattr__(name: str):
Expand Down
Loading
Loading