You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question about the number of patients in the oxygen_delivery table #1570
We have observed that certain patients exhibit results in the chartevents table with itemid = 226732, but these results are absent in the oxygen_delivery table. One example is stay_id = 30813912.
Upon analyzing line 86 of the oxygen_delivery table, we discovered that placing the condition "where ce.rn = 1" here only includes patients present in the ce_stg2 table. Consequently, data for patients existing in the o2 table but not in the ce_stg2 table is missing.
Our solution is to remove this line of code and create a new table, ce_stg3. Do you have any suggestions for a better solution?
Thank you!
Daonan Chen & Zhou Zhou
, ce_stg2 AS ( select ce.subject_id , ce.stay_id , ce.charttime , itemid , value , valuenum , valueuom -- retain only 1 row per charttime -- prioritizing the last documented value -- primarily used to subselect o2 flows , ROW_NUMBER() OVER (PARTITION BY subject_id, charttime, itemid ORDER BY storetime DESC) as rn FROM ce_stg1 ce ) , ce_stg3 AS ( SELECT * FROM ce_stg2 WHERE rn = 1 )
It was intentional to exclude device only rows - e.g. the device only row in the given example is Endotracheal Tube - this table was mostly meant to capture oxygen delivery with other devices. It is a bit misleading that o2 device isn't present in this table but if we merge this change as is, we get an overwhelming number of rows with empty o2 flow and an o2 device of ETT. I think a better fix is a separate table with oxygen_device
So, will think about a solution that keeps meaningful o2 devices, but does not include the ventilator devices present in the column. My immediate thought is that's easiest with a new table, but maybe that's wasteful
Activity
alistairewj commentedon Aug 25, 2026
Thank you for raising the issue!
See some discussion in #2071
So, will think about a solution that keeps meaningful o2 devices, but does not include the ventilator devices present in the column. My immediate thought is that's easiest with a new table, but maybe that's wasteful