PyHealth icon indicating copy to clipboard operation
PyHealth copied to clipboard

IndexError with MIMIC-IV 3.0 Dataset

Open hongnianwang opened this issue 1 year ago • 1 comments

Hi,

I'm using MIMIC-IV 3.0 dataset with PyHealth. When I try to set the mortality prediction task, I get an IndexError: list index out of range.

Here's my code:

from pyhealth.data import MIMIC4Dataset
from pyhealth.tasks import mortality_prediction_mimic4_fn

mimic4_base = MIMIC4Dataset(
    root="/Users/hnwang/research/physionet.org/files/mimiciv/3.0/hosp",
    tables=["diagnoses_icd", "procedures_icd"],
    code_mapping={"ICD10PROC": "CCSPROC"},
)

mimic4_sample = mimic4_base.set_task(mortality_prediction_mimic4_fn)

The error occurs at line 293 in sample_dataset.py:

293 keys = self.samples[0].keys()

IndexError: list index out of range

Can you help me figure out why this happens?

Thanks

hongnianwang avatar Aug 19 '24 04:08 hongnianwang

This is a bug from examples. Try this: https://github.com/sunlabuiuc/PyHealth/pull/301

MotorImagery avatar Aug 20 '24 03:08 MotorImagery

Thank you for reporting this! I have fixed this issue and will release a new version of PyHealth soon (i.e PyHealth 2.0) soon. In the meanwhile, if you have discord, we'd love to get more feedback here: https://discord.gg/mpb835EHaX.

zzachw avatar Apr 09 '25 20:04 zzachw