This repo is based on this code, which should have been accompanying this journal article.
The original code and realization are awful, incomplete, and nonworkable ( 1, 2, 3 ).
Code from this repo actually runs without crashes, even on a 16GB RAM laptop.
But all mappings are from the original repo, and I am perfectly sure, that they have errors:
- authors used some keys that are absent in MIMIC-III tables in
transform_inputevents_mv()
(002-kba-... notebook) - some resources absent in FHIR documentation
- CareVue and Metavision data should be kept in a single resource
- In the
transform_procedures_icd()
(004-kba-... notebook) authors messed up with the "followUp" feature - etc
I've fixed some, but I did not check every mapping due to lack of time.
- Download MIMIC-III dataset ad put it into the data folder
- Run jupyter notebooks in ascending order
- collect CSV files from
data/out/
folder
- add dtypes for all
pd.read_csv()
to avoid dtype guessing - make it run on the laptop with 16GB RAM
-
makescrew it and use jupyter notebooks insteadmimic_fhir_transformation.py
runnable and actually working code or - check mappings
- convert TRANSFERS table (should be part of encounter)?
- JSON output?
- refactoring and documentation
More details in the mappings
folder
MIMIC-III tables | FHIR resource |
---|---|
patients + admissions | patient |
admissions + diagnoses_icd | encounter |
icustays | encounter_icustays |
cptevents + cptevents | claim |
noteevents | diagnosticReport |
inputevents_cv + d_items | medicationDispense |
inputevents_mv + d_items | medicationDispense_mv |
prescriptions | medicationRequest |
chartevents + d_items | observation_ce |
datetimeevents + d_items | observation_dte |
labevents + d_labitems | observation_le |
caregivers | practitioner |
procedures_icd | procedure_icd9 |
procedureevents_mv + d_items | procedure_mv |
outputevents + d_items | specimen_oe |
microbiologyevents + d_items | specimen_mbe |
services | services |
Following tables were not transformed or even mentioned in the code:
- CALLOUT looks like something unimportant
- DRGCODES feels like it is not part of FHIR (the full registry of code systems defined as part of FHIR)
- TRANSFERS should be in encounters? but it's values are not in FHIR value set
- D_CPT not normative yet
- D_ICD_DIAGNOSES just ICD9 codes reference table
- D_ICD_PROCEDURES just ICD9 codes reference table