Skip to content

Commit

Permalink
Merge pull request #50 from mmcdermott/33_track_code_descriptions
Browse files Browse the repository at this point in the history
Very preliminary code to fix #33
  • Loading branch information
mmcdermott authored Jul 23, 2024
2 parents a7cdaaf + 1aaf037 commit 3285875
Show file tree
Hide file tree
Showing 10 changed files with 1,387 additions and 57 deletions.
113 changes: 113 additions & 0 deletions MIMIC-IV_Example/configs/event_configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ hosp/diagnoses_icd:
hadm_id: hadm_id
timestamp: col(hadm_discharge_time)
timestamp_format: "%Y-%m-%d %H:%M:%S"
_metadata:
d_icd_diagnoses:
description: "long_title"
parent_code: "ICD{icd_version}CM/{icd_code}" # Single strings are templates of columns.

hosp/drgcodes:
drg:
Expand Down Expand Up @@ -79,6 +83,11 @@ hosp/hcpcsevents:
hadm_id: hadm_id
timestamp: col(chartdate)
timestamp_format: "%Y-%m-%d"
_metadata:
# These are not all CPT codes, unfortunately
d_hcpcs:
description: "long_description"
possibly_cpt_code: "code"

hosp/labevents:
lab:
Expand All @@ -92,6 +101,11 @@ hosp/labevents:
numerical_value: valuenum
text_value: value
priority: priority
_metadata:
d_labitems_to_loinc:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"

hosp/omr:
omr:
Expand Down Expand Up @@ -152,6 +166,12 @@ hosp/procedures_icd:
hadm_id: hadm_id
timestamp: col(chartdate)
timestamp_format: "%Y-%m-%d"
_metadata:
d_icd_procedures:
description: "long_title"
parent_code: # List of objects are string labels mapping to filters to be evaluated.
- "ICD{icd_version}Proc/{icd_code}": { icd_version: 9 }
- "ICD{icd_version}PCS/{icd_code}": { icd_version: 10 }

hosp/transfers:
transfer:
Expand Down Expand Up @@ -193,6 +213,16 @@ icu/chartevents:
text_value: value
hadm_id: hadm_id
icustay_id: stay_id
_metadata:
meas_chartevents_main:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
# TODO: I don't know if this is necessary...
d_labitems_to_loinc:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"

icu/procedureevents:
start:
Expand All @@ -204,6 +234,15 @@ icu/procedureevents:
timestamp_format: "%Y-%m-%d %H:%M:%S"
hadm_id: hadm_id
icustay_id: stay_id
_metadata:
proc_datetimeevents:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
proc_itemid:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
end:
code:
- PROCEDURE
Expand All @@ -213,3 +252,77 @@ icu/procedureevents:
timestamp_format: "%Y-%m-%d %H:%M:%S"
hadm_id: hadm_id
icustay_id: stay_id
_metadata:
proc_datetimeevents:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
proc_itemid:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"

icu/inputevents:
input_start:
code:
- INFUSION_START
- col(ordercategorydescription)
- col(itemid)
- col(rateuom)
timestamp: col(starttime)
timestamp_format: "%Y-%m-%d %H:%M:%S"
hadm_id: hadm_id
icustay_id: stay_id
order_id: orderid
link_order_id: linkorderid
numerical_value: rate
_metadata:
inputevents_to_rxnorm:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
rateuom: null # A null column means this column is needed in pulling from the metadata.
input_end:
code:
- INFUSION_END
- col(ordercategorydescription)
- col(itemid)
- col(amountuom)
- col(statusdescription)
timestamp: col(endtime)
timestamp_format: "%Y-%m-%d %H:%M:%S"
hadm_id: hadm_id
icustay_id: stay_id
order_id: orderid
link_order_id: linkorderid
numerical_value: amount
_metadata:
inputevents_to_rxnorm:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
patient_weight:
code:
- PATIENT_WEIGHT_AT_INFUSION
- KG
timestamp: col(starttime)
timestamp_format: "%Y-%m-%d %H:%M:%S"
numerical_value: patientweight

icu/outputevents:
output:
code:
- PATIENT_FLUID_OUTPUT
- col(itemid)
- col(valueuom)
timestamp: col(charttime)
timestamp_format: "%Y-%m-%d %H:%M:%S"
hadm_id: hadm_id
icustay_id: stay_id
numerical_value: value
_metadata:
outputevents_to_rxnorm:
description: ["omop_concept_name", "label"] # List of strings are columns to be collated
itemid: "itemid (omop_source_code)"
parent_code: "{omop_vocabulary_id}/{omop_concept_code}"
valueuom: unitname
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ MEDS_extract-shard_events = "MEDS_polars_functions.extract.shard_events:main"
MEDS_extract-convert_to_sharded_events = "MEDS_polars_functions.extract.convert_to_sharded_events:main"
MEDS_extract-merge_to_MEDS_cohort = "MEDS_polars_functions.extract.merge_to_MEDS_cohort:main"
MEDS_transform-aggregate_code_metadata = "MEDS_polars_functions.aggregate_code_metadata:main"
MEDS_extract-extract_code_metadata = "MEDS_polars_functions.extract.extract_code_metadata:main"

[project.urls]
Homepage = "https://github.com/mmcdermott/MEDS_polars_functions"
Expand Down
1 change: 1 addition & 0 deletions src/MEDS_polars_functions/configs/extract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ stages:
- convert_to_sharded_events
- merge_to_MEDS_cohort
- aggregate_code_metadata
- extract_code_metadata

stage_configs:
aggregate_code_metadata:
Expand Down
Loading

0 comments on commit 3285875

Please sign in to comment.