Skip to content

Commit f045c0a

Browse files
authored
Merge pull request #1084 from MIT-LCP/bq_greatest_null
Fix kdigo_stages.sql in BigQuery for cases where one of the inputs to GREATEST is null. Ref #917
2 parents 0edce4c + 5a6d4ee commit f045c0a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

mimic-iv/concepts/organfailure/kdigo_stages.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ select
7979
, uo.uo_rt_24hr
8080
, uo.aki_stage_uo
8181
-- Classify AKI using both creatinine/urine output criteria
82-
, GREATEST(cr.aki_stage_creat, uo.aki_stage_uo) AS aki_stage
82+
, GREATEST(
83+
COALESCE(cr.aki_stage_creat,0),
84+
COALESCE(uo.aki_stage_uo,0)
85+
) AS aki_stage
8386
FROM `physionet-data.mimic_icu.icustays` ie
8487
-- get all possible charttimes as listed in tm_stg
8588
LEFT JOIN tm_stg tm

0 commit comments

Comments
 (0)