Skip to content

Commit

Permalink
Update colloid_bolus.sql
Browse files Browse the repository at this point in the history
1) Edit datatable names so they are compatible with BigQuery; 2) also change from UNION to "UNION ALL"
  • Loading branch information
kellyspeth authored and alistairewj committed May 21, 2021
1 parent 61ae77e commit 3275690
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mimic-iii/concepts/fluid_balance/colloid_bolus.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with t1 as
when mv.amountuom = 'ml'
then mv.amount
else null end) as amount
from inputevents_mv mv
from `physionet-data.mimiciii_clinical.inputevents_mv` mv
where mv.itemid in
(
220864, -- Albumin 5% 7466 132 7466
Expand Down Expand Up @@ -44,7 +44,7 @@ with t1 as
, cv.charttime
-- carevue always has units in millilitres (or null)
, round(cv.amount) as amount
from inputevents_cv cv
from `physionet-data.mimiciii_clinical.inputevents_cv` cv
where cv.itemid in
(
30008 -- Albumin 5%
Expand Down Expand Up @@ -82,7 +82,7 @@ with t1 as
, ce.charttime
-- carevue always has units in millilitres (or null)
, round(ce.valuenum) as amount
from chartevents ce
from `physionet-data.mimiciii_clinical.chartevents` ce
where ce.itemid in
(
2510 -- DEXTRAN LML 10%
Expand All @@ -103,18 +103,19 @@ from t1
-- just because the rate was high enough, does *not* mean the final amount was
where amount > 100
group by t1.icustay_id, t1.charttime
UNION
UNION ALL
select
icustay_id
, charttime
, sum(amount) as colloid_bolus
from t2
group by t2.icustay_id, t2.charttime
UNION
UNION ALL
select
icustay_id
, charttime
, sum(amount) as colloid_bolus
from t3
group by t3.icustay_id, t3.charttime
order by icustay_id, charttime;

0 comments on commit 3275690

Please sign in to comment.