pyhealth.tasks.MIMIC3ICD9Coding#
- class pyhealth.tasks.medical_coding.MIMIC3ICD9Coding(code_mapping=None)[source]#
Bases:
BaseTaskMedical coding task for MIMIC-III using ICD-9 codes.
This task uses clinical notes to predict ICD-9 codes for a patient.
- Parameters:
task_name – Name of the task
input_schema – Definition of the input data schema
output_schema – Definition of the output data schema
Examples
>>> from pyhealth.datasets import MIMIC3Dataset >>> from pyhealth.tasks import MIMIC3ICD9Coding >>> dataset = MIMIC3Dataset( ... root="/path/to/mimic-iii/1.4", ... tables=["diagnoses_icd", "procedures_icd", "noteevents"], ... ) >>> task = MIMIC3ICD9Coding() >>> samples = dataset.set_task(task)
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.
- input_schema: Dict[str, Union[str, Type]] = {'text': <class 'pyhealth.processors.text_processor.TextProcessor'>}#
- output_schema: Dict[str, Union[str, Type]] = {'icd_codes': <class 'pyhealth.processors.label_processor.MultiLabelProcessor'>}#
- __init__(code_mapping=None)#
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.