Skip to content

Commit

Permalink
Update code_status.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
SichengH authored Dec 1, 2023
1 parent af43ddc commit 6051038
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mimic-iv/concepts/treatment/code_status.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ There are five distinct values for the code status order in the ICU data:
SELECT p.subject_id
, p.hadm_id
, ie.stay_id
, p.order_time
, p.ordertime
, CASE
WHEN pd.field_value = 'Resuscitate (Full code)' THEN 1
WHEN pd.field_value = 'Full code (attempt resuscitation)' THEN 1
Expand All @@ -56,10 +56,10 @@ There are five distinct values for the code status order in the ICU data:
FROM `physionet-data.mimiciv_hosp.poe` p
INNER JOIN `physionet-data.mimiciv_hosp.poe_detail` pd
ON p.poe_id = pd.poe_id
LEFT JOIN `physiont-data.mimiciv_icu.icustays` ie
LEFT JOIN `physionet-data.mimiciv_icu.icustays` ie
ON p.hadm_id = ie.hadm_id
AND p.order_time >= ie.intime
AND p.order_time <= ie.outtime
AND p.ordertime >= ie.intime
AND p.ordertime <= ie.outtime
WHERE p.order_type = 'General Care'
AND order_subtype = 'Code status'
)
Expand All @@ -72,7 +72,7 @@ SELECT t1.subject_id, t1.hadm_id, t1.stay_id
FROM t1
UNION ALL
SELECT poe.subject_id, poe.hadm_id, poe.stay_id
, poe.order_time AS charttime
, poe.ordertime AS charttime
, poe.fullcode, 0 AS cmo, poe.dni, poe.dnr
FROM poe
;

0 comments on commit 6051038

Please sign in to comment.