There is some inconsistency in the conversion of some of the output measurements. I copied over code from mimic-code and adapted it the schema:
select meas.visit_detail_id
, meas.person_id
, meas.measurement_datetime
, meas.measurement_concept_id
, mc.concept_name
, meas.value_as_number
, uc.concept_name
, meas.measurement_source_concept_id
, msc.concept_name as source_concept_name
, meas.value_source_value
-- vd.care_site_id
from visit_detail vd
left join measurement meas
on vd.visit_detail_id = meas.visit_detail_id
and meas.measurement_datetime >= vd.visit_start_datetime
and meas.measurement_datetime < (vd.visit_start_datetime + interval '1' day)
left join concept mc on meas.measurement_concept_id = mc.concept_id
left join concept msc on meas.measurement_source_concept_id = msc.concept_id
left join concept uc on meas.unit_concept_id = uc.concept_id
where measurement_source_concept_id in
(
select concept_id
from concept
where concept_code 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 MetaVision
'226559', -- "Foley"
'226560', -- "Void"
'226561', -- "Condom Cath"
'226584', -- "Ileoconduit"
'226563', -- "Suprapubic"
'226564', -- "R Nephrostomy"
'226565', -- "L Nephrostomy"
'226567', -- Straight Cath
'226557', -- R Ureteral Stent
'226558', -- L Ureteral Stent
'227488', -- GU Irrigant Volume In
'227489' -- GU Irrigant/Urine Volume Out
)
)
and meas.person_id = 62101896
order by meas.measurement_datetime
I get the following:
visit_detail_id |
person_id |
measurement_datetime |
measurement_concept_id |
concept_name |
value_as_number |
concept_name |
measurement_source_concept_id |
source_concept_name |
value_source_value |
67094765 |
62101896 |
2174-03-21 20:02:21.000 |
3014315 |
Urine output |
-3000 |
milliliter |
2001028370 |
label:[GU Irrigant Volume In]dbsource:[metavision]linksto:[outputevents]unitname:[mL]param_type:[Numeric] |
(null) |
67094765 |
62101896 |
2174-03-21 20:02:21.000 |
3014315 |
Urine output |
-2650 |
milliliter |
2001028371 |
label:[GU Irrigant/Urine Volume Out]dbsource:[metavision]linksto:[outputevents]unitname:[mL]param_type:[Numeric] |
(null) |
However from the original MIMIC data:
select oe.subject_id, oe.icustay_id, oe.charttime
, oe.itemid
, di.label
, oe.value
, (
-- we consider input of GU irrigant as a negative volume
case when oe.itemid = 227488 then -1*value
else value end
) as value_neg
from outputevents oe
inner join d_items di on oe.itemid = di.itemid
where oe.subject_id = 99031
and oe.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 MetaVision
226559, -- "Foley"
226560, -- "Void"
226561, -- "Condom Cath"
226584, -- "Ileoconduit"
226563, -- "Suprapubic"
226564, -- "R Nephrostomy"
226565, -- "L Nephrostomy"
226567, --Straight Cath
226557, -- R Ureteral Stent
226558, -- L Ureteral Stent
227488, -- GU Irrigant Volume In
227489 -- GU Irrigant/Urine Volume Out
)
order by subject_id, charttime;
subject_id |
icustay_id |
charttime |
itemid |
label |
value |
value_neg |
99031 | 258971 | 2174-03-21 20:02:00 | 227488 | GU Irrigant Volume In | 3000 | -3000
99031 | 258971 | 2174-03-21 20:02:00 | 227489 | GU Irrigant/Urine Volume Out | 2650 | 2650
There are two things here:
(1) I think the ETL process tries to assign GU Irrigant Volume In as negative since this is technically a "negative" UO, but incorrectly makes both negative
(2) I am not sure if we should "fix" data in this way - this is a good example of the risk in this approach as the value is sometimes directly documented as a negative value and so we would incorrectly make those values positive. Perhaps better is a materialized view which has this logic.