@@ -26,7 +26,7 @@ with cr_stg AS
2626 when cr .creat >= (cr .creat_low_past_48hr + 0 .3 ) then 1
2727 when cr .creat >= (cr .creat_low_past_7day * 1 .5 ) then 1
2828 else 0 end as aki_stage_creat
29- FROM ` physionet-data.mimiciv_derived.kdigo_creatinine` cr
29+ FROM ` physionet-data.mimiciv_derived.kdigo_creatinine`
3030)
3131-- stages for UO / creat
3232, uo_stg as
@@ -50,7 +50,7 @@ with cr_stg AS
5050 WHEN uo .uo_tm_12hr >= 5 AND uo .uo_rt_12hr < 0 .5 THEN 2
5151 WHEN uo .uo_tm_6hr >= 2 AND uo .uo_rt_6hr < 0 .5 THEN 1
5252 ELSE 0 END AS aki_stage_uo
53- from ` physionet-data.mimiciv_derived.kdigo_uo` uo
53+ FROM ` physionet-data.mimiciv_derived.kdigo_uo` uo
5454 INNER JOIN ` physionet-data.mimiciv_icu.icustays` ie
5555 ON uo .stay_id = ie .stay_id
5656)
@@ -64,6 +64,16 @@ with cr_stg AS
6464 SELECT
6565 stay_id, charttime
6666 FROM uo_stg
67+ ),
68+ -- get CRRT data
69+ crrt_stg AS (
70+ SELECT
71+ stay_id,
72+ charttime,
73+ CASE
74+ WHEN charttime IS NOT NULL THEN 3
75+ ELSE NULL END AS aki_stage_crrt
76+ FROM ` physionet-data.mimic_derived.crrt`
6777)
6878select
6979 ie .subject_id
@@ -78,10 +88,12 @@ select
7888 , uo .uo_rt_12hr
7989 , uo .uo_rt_24hr
8090 , uo .aki_stage_uo
91+ , crrt .aki_stage_crrt
8192 -- Classify AKI using both creatinine/urine output criteria
8293 , GREATEST(
8394 COALESCE(cr .aki_stage_creat ,0 ),
84- COALESCE(uo .aki_stage_uo ,0 )
95+ COALESCE(uo .aki_stage_uo ,0 ),
96+ COALESCE(crrt .aki_stage_crrt ,0 )
8597 ) AS aki_stage
8698FROM ` physionet-data.mimiciv_icu.icustays` ie
8799-- get all possible charttimes as listed in tm_stg
@@ -93,4 +105,7 @@ LEFT JOIN cr_stg cr
93105LEFT JOIN uo_stg uo
94106 ON ie .stay_id = uo .stay_id
95107 AND tm .charttime = uo .charttime
108+ LEFT JOIN crrt_stg crrt
109+ ON ie .stay_id = crrt .stay_id
110+ AND tm .charttime = crrt .charttime
96111;
0 commit comments