Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ventilation times #12

Closed
willemvandenboom opened this issue Aug 17, 2018 · 7 comments
Closed

Ventilation times #12

willemvandenboom opened this issue Aug 17, 2018 · 7 comments
Assignees

Comments

@willemvandenboom
Copy link
Collaborator

Extract start and end times of mechanical ventilation for the eICU data.
https://github.com/MIT-LCP/mimic-code/blob/master/concepts/durations/ventilation-durations.sql does it for the MIMIC data.

@willemvandenboom willemvandenboom self-assigned this Aug 21, 2018
@willemvandenboom
Copy link
Collaborator Author

eicu.respiratoryCare contains ventEndOffset and ventStartOffset which would be very useful for this. However, their values do not make much sense: I'm checking whether that is just the way it is or whether we can get their correct values.

@mchhoy
Copy link
Collaborator

mchhoy commented Aug 22, 2018

The MIMIC feature we were using as a cofounder was:

`tidal_high_count/total_count AS tidal_high_count2

derived from:

sum(tt.tidal_label) AS tidal_high_count

derived from:

CASE WHEN tidal.tidal_volume_per_weight >= 6.5 THEN 1 ELSE 0 END AS tidal_label

Would we compute something similar from ventEndOffset and ventStartOffset?

@willemvandenboom
Copy link
Collaborator Author

ventEndOffset and ventStartOffset are very useful, if their values made sense as currently whenever ventStartOffset > 0, then ventEndOffset < ventStartOffset, which is impossible according to the description in https://eicu-crd.mit.edu/eicutables/respiratorycare/. I've asked Mornin in Slack about his.

If they were to make sense, we could do something like (edited from
http://collabedit.com/hk63e from MIT-LCP/eicu-code#21):

WITH t1 AS
  (SELECT patientunitstayid,
		ventstartoffset,
		ventendoffset,
        CASE
             WHEN airwaytype IN ('Oral ETT', 'Nasal ETT', 'Tracheostomy') THEN 1
             ELSE NULL
        END AS airway -- either invasive airway or NULL
   FROM `oxygenators-209612.eicu.respiratorycare`),
     t2 AS
  (SELECT DISTINCT patientunitstayid,
					respchartoffset,
                   1 AS ventilator
   FROM `oxygenators-209612.eicu.respiratorycharting`
   WHERE UPPER(respchartvalue) LIKE '%ventilator%'
     OR UPPER(respchartvalue) LIKE '%vent%'
     OR UPPER(respchartvalue) LIKE '%bipap%'
     OR UPPER(respchartvalue) LIKE '%840%'
     OR UPPER(respchartvalue) LIKE '%cpap%'
     OR UPPER(respchartvalue) LIKE '%drager%'
     OR UPPER(respchartvalue) LIKE 'mv%'
     OR UPPER(respchartvalue) LIKE '%servo%'
     OR UPPER(respchartvalue) LIKE '%peep%'
   GROUP BY patientunitstayid, respchartoffset),
     t3 AS
  (SELECT DISTINCT patientunitstayid,
					treatmentoffset,
                   max(CASE
                           WHEN treatmentstring IN ('pulmonary|ventilation and oxygenation|mechanical ventilation', 'pulmonary|ventilation and oxygenation|tracheal suctioning', 'pulmonary|ventilation and oxygenation|ventilator weaning', 'pulmonary|ventilation and oxygenation|mechanical ventilation|assist controlled', 'pulmonary|radiologic procedures / bronchoscopy|endotracheal tube', 'pulmonary|ventilation and oxygenation|oxygen therapy (> 60%)', 'pulmonary|ventilation and oxygenation|mechanical ventilation|tidal volume 6-10 ml/kg', 'pulmonary|ventilation and oxygenation|mechanical ventilation|volume controlled', 'surgery|pulmonary therapies|mechanical ventilation', 'pulmonary|surgery / incision and drainage of thorax|tracheostomy', 'pulmonary|ventilation and oxygenation|mechanical ventilation|synchronized intermittent', 'pulmonary|surgery / incision and drainage of thorax|tracheostomy|performed during current admission for ventilatory support', 'pulmonary|ventilation and oxygenation|ventilator weaning|active', 'pulmonary|ventilation and oxygenation|mechanical ventilation|pressure controlled', 'pulmonary|ventilation and oxygenation|mechanical ventilation|pressure support', 'pulmonary|ventilation and oxygenation|ventilator weaning|slow', 'surgery|pulmonary therapies|ventilator weaning', 'surgery|pulmonary therapies|tracheal suctioning', 'pulmonary|radiologic procedures / bronchoscopy|reintubation', 'pulmonary|ventilation and oxygenation|lung recruitment maneuver', 'pulmonary|surgery / incision and drainage of thorax|tracheostomy|planned', 'surgery|pulmonary therapies|ventilator weaning|rapid', 'pulmonary|ventilation and oxygenation|prone position', 'pulmonary|surgery / incision and drainage of thorax|tracheostomy|conventional', 'pulmonary|ventilation and oxygenation|mechanical ventilation|permissive hypercapnea', 'surgery|pulmonary therapies|mechanical ventilation|synchronized intermittent', 'pulmonary|medications|neuromuscular blocking agent', 'surgery|pulmonary therapies|mechanical ventilation|assist controlled', 'pulmonary|ventilation and oxygenation|mechanical ventilation|volume assured', 'surgery|pulmonary therapies|mechanical ventilation|tidal volume 6-10 ml/kg', 'surgery|pulmonary therapies|mechanical ventilation|pressure support', 'pulmonary|ventilation and oxygenation|non-invasive ventilation', 'pulmonary|ventilation and oxygenation|non-invasive ventilation|face mask', 'pulmonary|ventilation and oxygenation|non-invasive ventilation|nasal mask', 'pulmonary|ventilation and oxygenation|mechanical ventilation|non-invasive ventilation', 'pulmonary|ventilation and oxygenation|mechanical ventilation|non-invasive ventilation|face mask', 'surgery|pulmonary therapies|non-invasive ventilation', 'surgery|pulmonary therapies|non-invasive ventilation|face mask', 'pulmonary|ventilation and oxygenation|mechanical ventilation|non-invasive ventilation|nasal mask', 'surgery|pulmonary therapies|non-invasive ventilation|nasal mask', 'surgery|pulmonary therapies|mechanical ventilation|non-invasive ventilation', 'surgery|pulmonary therapies|mechanical ventilation|non-invasive ventilation|face mask') THEN 1
                           ELSE NULL
                       END) AS interface -- either ETT/NiV or NULL
FROM `oxygenators-209612.eicu.treatment`
   GROUP BY patientunitstayid, treatmentoffset),
-- nursecharting also contains info on O2 admin devices
	t4 AS
	( SELECT DISTINCT
		patientunitstayid,
		nursingChartOffset,
		1 AS ventilator
		FROM `oxygenators-209612.eicu.nursecharting`
		WHERE (
			nursingchartcelltypevallabel = 'O2 Admin Device'
        	-- AND in the next line *should* yield the same result, but out of caution we use OR.
    		OR  nursingchartcelltypevalname = 'O2 Admin Device'
		) AND nursingchartvalue IN (
			-- This list is not exhaustive. We should probably check it with KC See
			'ventilator',
			'vent',
			'trach collar',
			'ETT oral'
		)
	)
-- Select those ventilation sessions that were mechanically ventilated
SELECT DISTINCT t1.patientunitstayid AS icustay_id,
	t1.ventstartoffset,
	t1.ventendoffset
FROM t1
LEFT OUTER JOIN t2 ON t2.patientunitstayid=t1.patientunitstayid
LEFT OUTER JOIN t3 ON t3.patientunitstayid=t1.patientunitstayid
LEFT OUTER JOIN t4 ON t4.patientunitstayid=t1.patientunitstayid
WHERE t1.airway IS NOT NULL
  OR (t2.ventilator IS NOT NULL AND t2.respchartoffset BETWEEN t1.ventstartoffset AND t1.ventendoffset)
  OR (t3.interface IS NOT NULL AND t3.treatmentoffset BETWEEN t1.ventstartoffset AND t1.ventendoffset)
	OR (t4.ventilator IS NOT NULL AND t4.nursingChartOffset BETWEEN t1.ventstartoffset AND t1.ventendoffset)```

@willemvandenboom
Copy link
Collaborator Author

Ventilation end times are probably not directly available: MIT-LCP/eicu-code#49

End times can maybe be estimated based on presence of ventilation records: MIT-LCP/eicu-website#36

@willemvandenboom
Copy link
Collaborator Author

#27 adds a MarkDown table that describes in which eICU tables what information can be found.

I've tried to determine ventilation times using oxygen flow (#20 discusses oxygen flow) but that yields only a tenth of the patients as receiving supplementary oxygen for 48 hours. I'll involve more indicators of oxygen therapy in the hope to detect oxygen therapy in a larger subset of the patients.

I've been doing this determining of ventilation times within R.

@willemvandenboom
Copy link
Collaborator Author

Pull request #28 addresses this issue mostly. It uses the tables nursecharting, respiratorycharting, and treatment but not (yet) respiratorycare as both its start and end times are unreliable. I'm watching the respective issue though such that we can use respiratorycare if it gets fixed.

Also, there are still some improvements necessary to the ventilation times. Lists of text values that are interpreted as oxygen therapy are not necessarily complete or validated. Also, we'd ideally split out between categories of oxygen therapy, e.g. nasal cannula versus mechanical ventilation. I'll open an issue for the latter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants