Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c21a4b7
Create multimodal_mimic4.py
will-pang Feb 20, 2026
a841929
More updates
will-pang Feb 21, 2026
327ffb4
Delete uv.lock
will-pang Feb 21, 2026
c5b46f2
Add docs
will-pang Feb 22, 2026
6d48013
Update multimodal_mimic4.py
will-pang Feb 22, 2026
4baf6ff
Initial push
will-pang Feb 22, 2026
7c7e737
Update multimodal_mimic4.py
will-pang Feb 22, 2026
9e20ae9
Update multimodal_mimic4.py
will-pang Feb 22, 2026
f372f92
Update multimodal_mimic4.py
will-pang Feb 22, 2026
064c10b
Update multimodal_mimic4.py
will-pang Feb 22, 2026
bb610bb
Update multimodal_mimic4.py
will-pang Feb 22, 2026
6325353
Add docs
will-pang Feb 22, 2026
32c66fb
Update multimodal_mimic4.py
will-pang Feb 23, 2026
22dad16
Create test_multimodal_mimic_4.py
will-pang Feb 25, 2026
11e09bf
Create test_multimodal_mimic_4.py
will-pang Feb 25, 2026
ad8b3a3
Update multimodal_mimic4.py
will-pang Feb 25, 2026
250b71d
Update multimodal_mimic4.py
will-pang Feb 25, 2026
305ef59
Update test_multimodal_mimic_4.py
will-pang Feb 25, 2026
5a52315
Update test_multimodal_mimic_4.py
will-pang Feb 25, 2026
6364b4d
Update multimodal_mimic4.py
will-pang Feb 25, 2026
9c283ea
Update test_multimodal_mimic_4.py
will-pang Feb 25, 2026
7074190
Update multimodal_mimic4.py
will-pang Feb 26, 2026
d24c51c
Delete tests/core/test_multimodal_mimic_4.py
will-pang Feb 26, 2026
6aa0de4
Delete tests/core/test_multimodal_mimic_4.py
will-pang Feb 26, 2026
92e9e12
- Move to a lazy import inside __call__ w/ an ImportError message, f…
Rian354 Mar 3, 2026
3c9bc3b
Create multimodal_mimic4.py task (#1)
will-pang Mar 4, 2026
a444240
Merge branch 'main' into wp/add-lab-events-icd-to-task
will-pang Mar 4, 2026
bbe225e
Update multimodal_mimic4.py
will-pang Mar 4, 2026
72c8d13
Merge branch 'wp/add-lab-events-icd-to-task' of https://github.com/Mu…
will-pang Mar 4, 2026
73d1f96
Add lab events and icd codes to multimodal_mimic4.py (#2)
will-pang Mar 4, 2026
b104a1d
Merge branch 'sunlabuiuc:master' into main
will-pang Mar 4, 2026
d2de087
Add initial task setup for CXR
will-pang Mar 5, 2026
eef323d
Small cleanup in CXR task creation
will-pang Mar 5, 2026
1d0e4ca
Make DEV to be a global variable
will-pang Mar 6, 2026
ef07c90
Call it DEV_MODE instead of DEV
will-pang Mar 6, 2026
b686e00
Default DEV_MODE to be True
will-pang Mar 6, 2026
77a906a
Update multimodal task
will-pang Mar 6, 2026
52bee63
Update multimodal_mimic4.py
will-pang Mar 6, 2026
506fc94
Update multimodal_mimic4.py
will-pang Mar 6, 2026
071bc44
Update multimodal_mimic4.py
will-pang Mar 6, 2026
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,7 @@ pyhealth/medcode/pretrained_embeddings/kg_emb/examples/pretrained_model
data/physionet.org/

# VSCode settings
.vscode/
.vscode/

# Local Data
local_data/
1 change: 1 addition & 0 deletions docs/api/tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ Available Tasks
Mutation Pathogenicity (COSMIC) <tasks/pyhealth.tasks.MutationPathogenicityPrediction>
Cancer Survival Prediction (TCGA) <tasks/pyhealth.tasks.CancerSurvivalPrediction>
Cancer Mutation Burden (TCGA) <tasks/pyhealth.tasks.CancerMutationBurden>
Multimodal Mortality Prediction (MIMIC-IV) <tasks/pyhealth.tasks.multimodal_mimic4>
12 changes: 12 additions & 0 deletions docs/api/tasks/pyhealth.tasks.multimodal_mimic4.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pyhealth.tasks.multimodal_mimic4
===================================

.. autoclass:: pyhealth.tasks.multimodal_mimic4.ClinicalNotesMIMIC4
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.tasks.multimodal_mimic4.ClinicalNotesICDLabsMIMIC4
:members:
:undoc-members:
:show-inheritance:
84 changes: 84 additions & 0 deletions examples/mortality_prediction/multimodal_mimic4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from datetime import datetime
from typing import Any, Dict, List, Optional
import os

# PyHealth Packages
from pyhealth.datasets import MIMIC4Dataset
from pyhealth.tasks.multimodal_mimic4 import ClinicalNotesMIMIC4, ClinicalNotesICDLabsMIMIC4, ClinicalNotesICDLabsCXRMIMIC4
from pyhealth.tasks.base_task import BaseTask

# Load MIMIC4 Files
# There's probably better ways dealing with this on the cluster, but working locally for now
# (see: https://github.com/sunlabuiuc/PyHealth/blob/master/examples/mortality_prediction/multimodal_mimic4_minimal.py)

TASK = "ClinicalNotesICDLabsCXRMIMIC4" # The idea here is that we want additive tasks so we can evaluate the value in adding more modalities

PYHEALTH_REPO_ROOT = '/Users/wpang/Desktop/PyHealth'

EHR_ROOT = os.path.join(PYHEALTH_REPO_ROOT, "local_data/local/data/physionet.org/files/mimiciv/2.2")
NOTE_ROOT = os.path.join(PYHEALTH_REPO_ROOT, "local_data/local/data/physionet.org/files/mimic-iv-note/2.2")
CXR_ROOT = os.path.join(PYHEALTH_REPO_ROOT,"local_data/local/data/physionet.org/files/mimic-cxr-jpg/2.0.0")
CACHE_DIR = os.path.join(PYHEALTH_REPO_ROOT,"local_data/local/data/wp/pyhealth_cache")

DEV_MODE = True

if __name__ == "__main__":

if TASK == "ClinicalNotesMIMIC4": # A bit janky setup at the moment and open to iteration, but conveys the point for now
dataset = MIMIC4Dataset(
ehr_root=EHR_ROOT,
note_root=NOTE_ROOT,
ehr_tables=["diagnoses_icd", "procedures_icd", "prescriptions", "labevents"],
note_tables=["discharge", "radiology"],
cache_dir=CACHE_DIR,
num_workers=8,
dev=DEV_MODE
)

# Apply multimodal task
task = ClinicalNotesMIMIC4()
samples = dataset.set_task(task)

# Get and print sample
sample = samples[0]
print(sample)

elif TASK == 'ClinicalNotesICDLabsMIMIC4':
dataset = MIMIC4Dataset(
ehr_root=EHR_ROOT,
note_root=NOTE_ROOT,
ehr_tables=["diagnoses_icd", "procedures_icd", "prescriptions", "labevents"],
note_tables=["discharge", "radiology"],
cache_dir=CACHE_DIR,
num_workers=8,
dev=DEV_MODE
)

# Apply multimodal task
task = ClinicalNotesICDLabsMIMIC4()
samples = dataset.set_task(task)

# Get and print sample
sample = samples[0]
print(sample)

elif TASK == 'ClinicalNotesICDLabsCXRMIMIC4':
dataset = MIMIC4Dataset(
ehr_root=EHR_ROOT,
note_root=NOTE_ROOT,
cxr_root=CXR_ROOT,
ehr_tables=["diagnoses_icd", "procedures_icd", "prescriptions", "labevents"],
note_tables=["discharge", "radiology"],
cxr_tables=["metadata", "negbio"],
cache_dir=CACHE_DIR,
num_workers=8,
dev=DEV_MODE
)

# Apply multimodal task
task = ClinicalNotesICDLabsCXRMIMIC4()
samples = dataset.set_task(task)

# Get and print sample
sample = samples[0]
print(sample)
Loading