-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheicu_oxygen_therapy_treatment
87 lines (77 loc) · 3.01 KB
/
eicu_oxygen_therapy_treatment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
-- eICU/data-extraction/eicu_oxygen_therapy_treatment.sql
--https://github.com/nus-mornin-lab/oxygenation_kc/pull/34/files
CREATE TABLE eicu_oxygen_therapy_treatment AS(
SELECT patientunitstayid as icustay_id,
treatmentoffset as time,
activeUponDischarge,
max(CASE
WHEN -- Invasive ventilation
LOWER(treatmentstring) LIKE '%tracheal suctioning%'
OR LOWER(treatmentstring) LIKE '%tube%'
OR LOWER(treatmentstring) LIKE '%tracheostomy%'
OR LOWER(treatmentstring) LIKE '%reintubation%'
OR LOWER(treatmentstring) LIKE '%assist controlled%'
OR LOWER(treatmentstring) LIKE '%volume controlled%'
OR LOWER(treatmentstring) LIKE '%pressure controlled%'
OR LOWER(treatmentstring) LIKE '%trach collar%'
THEN 4
WHEN -- Noninvasive ventilation
LOWER(treatmentstring) LIKE '%volume assured%'
OR LOWER(treatmentstring) LIKE '%non-invasive ventilation%'
OR LOWER(treatmentstring) LIKE '%cpap%'
THEN 3
WHEN -- Either invasive or noninvasive ventilation:
LOWER(treatmentstring) LIKE '%mechanical ventil%'
OR LOWER(treatmentstring) LIKE '%pressure support%'
OR LOWER(treatmentstring) LIKE '%peep%'
OR LOWER(treatmentstring) LIKE '%ventilator%'
OR LOWER(treatmentstring) LIKE '%tidal volume%'
THEN 2
WHEN -- Supplemental oxygen:
LOWER(treatmentstring) LIKE '%nasal mask%'
OR LOWER(treatmentstring) LIKE '%nasal cannula%'
OR LOWER(treatmentstring) LIKE '%non-rebreather mask%'
OR LOWER(treatmentstring) LIKE '%face tent%'
THEN 1
WHEN -- Oxygen therapy but unknown what type:
( LOWER(treatmentstring) LIKE '%ventilat%' AND NOT LOWER(treatmentstring) LIKE '%hyperventilat%' )
OR LOWER(treatmentstring) LIKE '%oxygen therapy%'
THEN 0
ELSE NULL
END) AS type
FROM eicu.treatment
WHERE treatmentoffset >= -720 AND
(
-- Invasive ventilation
LOWER(treatmentstring) LIKE '%tracheal suctioning%'
OR LOWER(treatmentstring) LIKE '%tube%'
OR LOWER(treatmentstring) LIKE '%tracheostomy%'
OR LOWER(treatmentstring) LIKE '%reintubation%'
OR LOWER(treatmentstring) LIKE '%assist controlled%'
OR LOWER(treatmentstring) LIKE '%volume controlled%'
OR LOWER(treatmentstring) LIKE '%pressure controlled%'
OR LOWER(treatmentstring) LIKE '%trach collar%'
OR
-- Noninvasive ventilation
LOWER(treatmentstring) LIKE '%volume assured%'
OR LOWER(treatmentstring) LIKE '%non-invasive ventilation%'
OR LOWER(treatmentstring) LIKE '%cpap%'
OR
-- Either invasive or noninvasive ventilation:
LOWER(treatmentstring) LIKE '%mechanical ventil%'
OR LOWER(treatmentstring) LIKE '%pressure support%'
OR LOWER(treatmentstring) LIKE '%peep%'
OR LOWER(treatmentstring) LIKE '%ventilator%'
OR LOWER(treatmentstring) LIKE '%tidal volume%'
OR
-- Supplemental oxygen:
LOWER(treatmentstring) LIKE '%nasal mask%'
OR LOWER(treatmentstring) LIKE '%nasal cannula%'
OR LOWER(treatmentstring) LIKE '%non-rebreather mask%'
OR LOWER(treatmentstring) LIKE '%face tent%'
OR
-- Oxygen therapy but unknown what type:
( LOWER(treatmentstring) LIKE '%ventilat%' AND NOT LOWER(treatmentstring) LIKE '%hyperventilat%' )
OR LOWER(treatmentstring) LIKE '%oxygen therapy%'
)
GROUP BY patientunitstayid, treatmentoffset, activeUponDischarge )