Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| -- ------------------------------------------------------------------ | |
| -- Purpose: Create a view of the urine output for each ICUSTAY_ID over the first 24 hours. | |
| -- ------------------------------------------------------------------ | |
| create materialized view uofirstday as | |
| select | |
| -- patient identifiers | |
| ie.subject_id, ie.hadm_id, ie.icustay_id | |
| -- volumes associated with urine output ITEMIDs | |
| , sum(VALUE) as UrineOutput | |
| from icustays ie | |
| -- Join to the outputevents table to get urine output | |
| left join outputevents oe | |
| -- join on all patient identifiers | |
| on ie.subject_id = oe.subject_id and ie.hadm_id = oe.hadm_id and ie.icustay_id = oe.icustay_id | |
| -- and ensure the data occurs during the first day | |
| and oe.charttime between ie.intime and (ie.intime + interval '1' day) -- first ICU day | |
| where itemid in | |
| ( | |
| -- these are the most frequently occurring urine output observations in CareVue | |
| 40055, -- "Urine Out Foley" | |
| 43175, -- "Urine ." | |
| 40069, -- "Urine Out Void" | |
| 40094, -- "Urine Out Condom Cath" | |
| 40715, -- "Urine Out Suprapubic" | |
| 40473, -- "Urine Out IleoConduit" | |
| 40085, -- "Urine Out Incontinent" | |
| 40057, -- "Urine Out Rt Nephrostomy" | |
| 40056, -- "Urine Out Lt Nephrostomy" | |
| 40405, -- "Urine Out Other" | |
| 40428, -- "Urine Out Straight Cath" | |
| 40086,-- Urine Out Incontinent | |
| 40096, -- "Urine Out Ureteral Stent #1" | |
| 40651, -- "Urine Out Ureteral Stent #2" | |
| -- these are the most frequently occurring urine output observations in CareVue | |
| 226559, -- "Foley" | |
| 226560, -- "Void" | |
| 227510, -- "TF Residual" | |
| 226561, -- "Condom Cath" | |
| 226584, -- "Ileoconduit" | |
| 226563, -- "Suprapubic" | |
| 226564, -- "R Nephrostomy" | |
| 226565, -- "L Nephrostomy" | |
| 226567, -- Straight Cath | |
| 226557, -- "R Ureteral Stent" | |
| 226558 -- "L Ureteral Stent" | |
| ) | |
| group by ie.subject_id, ie.hadm_id, ie.icustay_id | |
| order by ie.subject_id, ie.hadm_id, ie.icustay_id; | |
| -- TODO: subtract GU irrigant volume from the below ITEMID | |
| -- 227489, -- "GU Irrigant/Urine Volume Out" |