Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code_status.sql #1676

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mimic-iv/concepts/treatment/code_status.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There are five distinct values for the code status order in the ICU data:
, CASE
WHEN value IN ('DNR (do not resuscitate)', 'DNR / DNI') THEN 1
ELSE 0 END AS dnr
FROM `physionet-data.mimic_icu.chartevents`
FROM `physionet-data.mimiciv_icu.chartevents`
WHERE itemid IN (223758)
)

Expand All @@ -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
;
Loading