pyhealth.tasks.InHospitalMortalityMIMIC4#

class pyhealth.tasks.in_hospital_mortality_mimic4.InHospitalMortalityMIMIC4(code_mapping=None)[source]#

Bases: BaseTask

Task for predicting in-hospital mortality using MIMIC-IV dataset.

This task leverages lab results to predict the likelihood of in-hospital mortality.

task_name#

The name of the task.

Type:

str

input_schema#

The schema for input data, which includes: - labs: A timeseries of lab results.

Type:

Dict[str, str]

output_schema#

The schema for output data, which includes: - mortality: A binary indicator of mortality.

Type:

Dict[str, str]

Examples

>>> from pyhealth.datasets import MIMIC4EHRDataset
>>> from pyhealth.tasks import InHospitalMortalityMIMIC4
>>> dataset = MIMIC4EHRDataset(
...     root="/path/to/mimic-iv/2.2",
...     tables=["labevents"],
... )
>>> task = InHospitalMortalityMIMIC4()
>>> samples = dataset.set_task(task)
task_name: str = 'InHospitalMortalityMIMIC4'#
input_schema: Dict[str, str] = {'labs': 'timeseries'}#
output_schema: Dict[str, str] = {'mortality': 'binary'}#
LAB_CATEGORIES: ClassVar[Dict[str, Dict[str, List[str]]]] = {'Electrolytes & Metabolic': {'Anion Gap': ['50868', '52500'], 'Bicarbonate': ['50803', '50804'], 'Calcium': ['50808', '51624'], 'Chloride': ['50806', '52434', '50902', '52535'], 'Glucose': ['50809', '52027', '50931', '52569'], 'Magnesium': ['50960'], 'Osmolality': ['52031', '50964', '51701'], 'Phosphate': ['50970'], 'Potassium': ['50822', '52452', '50971', '52610'], 'Sodium': ['50824', '52455', '50983', '52623']}}#
LABITEMS: ClassVar[List[str]] = ['50824', '52455', '50983', '52623', '50822', '52452', '50971', '52610', '50806', '52434', '50902', '52535', '50803', '50804', '50809', '52027', '50931', '52569', '50808', '51624', '50960', '50868', '52500', '52031', '50964', '51701', '50970']#
pre_filter(df)#
Return type:

LazyFrame