Skip to content

Commit 0f982bf

Browse files
authored
Merge pull request #1676 from MIT-LCP/fixed_bug_for_code_status
Update code_status.sql
2 parents 99407a5 + 6051038 commit 0f982bf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mimic-iv/concepts/treatment/code_status.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ There are five distinct values for the code status order in the ICU data:
2929
, CASE
3030
WHEN value IN ('DNR (do not resuscitate)', 'DNR / DNI') THEN 1
3131
ELSE 0 END AS dnr
32-
FROM `physionet-data.mimic_icu.chartevents`
32+
FROM `physionet-data.mimiciv_icu.chartevents`
3333
WHERE itemid IN (223758)
3434
)
3535

@@ -39,7 +39,7 @@ There are five distinct values for the code status order in the ICU data:
3939
SELECT p.subject_id
4040
, p.hadm_id
4141
, ie.stay_id
42-
, p.order_time
42+
, p.ordertime
4343
, CASE
4444
WHEN pd.field_value = 'Resuscitate (Full code)' THEN 1
4545
WHEN pd.field_value = 'Full code (attempt resuscitation)' THEN 1
@@ -56,10 +56,10 @@ There are five distinct values for the code status order in the ICU data:
5656
FROM `physionet-data.mimiciv_hosp.poe` p
5757
INNER JOIN `physionet-data.mimiciv_hosp.poe_detail` pd
5858
ON p.poe_id = pd.poe_id
59-
LEFT JOIN `physiont-data.mimiciv_icu.icustays` ie
59+
LEFT JOIN `physionet-data.mimiciv_icu.icustays` ie
6060
ON p.hadm_id = ie.hadm_id
61-
AND p.order_time >= ie.intime
62-
AND p.order_time <= ie.outtime
61+
AND p.ordertime >= ie.intime
62+
AND p.ordertime <= ie.outtime
6363
WHERE p.order_type = 'General Care'
6464
AND order_subtype = 'Code status'
6565
)
@@ -72,7 +72,7 @@ SELECT t1.subject_id, t1.hadm_id, t1.stay_id
7272
FROM t1
7373
UNION ALL
7474
SELECT poe.subject_id, poe.hadm_id, poe.stay_id
75-
, poe.order_time AS charttime
75+
, poe.ordertime AS charttime
7676
, poe.fullcode, 0 AS cmo, poe.dni, poe.dnr
7777
FROM poe
7878
;

0 commit comments

Comments
 (0)