Definition of ICU visit in STARR OMOP - som-shahlab/femr GitHub Wiki

  1. Select all care sites that are ICUs:
SELECT * FROM `som-rit-phi-starr-prod.starr_omop_cdm5_deid_2023_02_08.care_site` WHERE care_site_name LIKE "%ICU%"
care_site_id care_site_name location_id place_of_service_source_value unit_id load_table_id
7928450 CVICU 220 907326 lpch lpch_clarity_dep
7930385 PICU 320 907326 lpch lpch_clarity_dep
7930600 2 EAST CVICU 907326 lpch lpch_clarity_dep
7928852 PICU 907326 lpch lpch_clarity_dep
7928619 CVICU 320 907326 lpch lpch_clarity_dep
7929727 PICU 420 907326 lpch lpch_clarity_dep
7928675 NICU 260 907326 lpch lpch_clarity_dep
7930225 NICU 270 907326 lpch lpch_clarity_dep
7928759 CVICU 907326 lpch lpch_clarity_dep
7928227 NICU (2W) OUTPATIENT 907326 lpch lpch_clarity_dep
7928810 LP CVICU 320 907327 shc shc_clarity_dep
7929179 LP NICU 260 907327 shc shc_clarity_dep
7928650 LP PICU 907327 shc shc_clarity_dep
7929351 LP PICU 320 907327 shc shc_clarity_dep
7928457 LP NICU 270 907327 shc shc_clarity_dep
7928195 LP CVICU 907327 shc shc_clarity_dep
7930681 LP CVICU 220 907327 shc shc_clarity_dep
7930670 LP PICU 420 907327 shc shc_clarity_dep
7930176 VCP NICU 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7931420 500P ICU PHARMACY 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7929149 VC PEDS/NICU SPECIALTY 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7930857 E2-ICU 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7931186 D2ICU-SURGE 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7930934 E29-ICU 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
7930924 300P ICU PHARMACY 907327 On Campus - Outpatient Hospital shc shc_clarity_dep
  1. Hardcode in this list of ICU events by selecting only events e which have code e.code such that patient_database.get_ontology().get_dictionary()[e.code] is in the list of care_site_id's listed above
icu_care_site_codes = [ 7928450, 7930385, 7930600, 7928852, 7928619, 7929727, 7928675, 7930225, 7928759, 7928227, 7928810, 7929179, 7928650, 7929351, 7928457, 7928195, 7930681, 7930670, 7930176, 7931420, 7929149, 7930857, 7931186, 7930934, 7930924 ]
dictionary = patient_database.get_ontology().get_dictionary()
for patient in patient_database:
  for e in patient.events:
    concept_code = dictionary[e.code]
    if 'CARE_SITE' in concept_code and concept_code.replace('CARE_SITE/', '') in icu_care_site_codes:
      print("Found an ICU event!")