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

Questions regarding the calculation of the Respiration SOFA subscores #1815

Open
1 task done
weilidr opened this issue Oct 14, 2024 · 0 comments
Open
1 task done

Questions regarding the calculation of the Respiration SOFA subscores #1815

weilidr opened this issue Oct 14, 2024 · 0 comments

Comments

@weilidr
Copy link

weilidr commented Oct 14, 2024

Prerequisites

Description

Dear Database Administrator,

  • [1] first_day_sofa.sql is missing the restriction for arterial pO2, specifically
    WHERE specimen = 'ART.'
pafi1 AS (
  /* join blood gas to ventilation durations to determine if patient was vent */
  SELECT
    ie.stay_id,
    bg.charttime,
    bg.pao2fio2ratio,
    CASE WHEN NOT vd.stay_id IS NULL THEN 1 ELSE 0 END AS isvent
  FROM mimiciv_icu.icustays AS ie
  LEFT JOIN mimiciv_derived.bg AS bg
    ON ie.subject_id = bg.subject_id
    AND bg.charttime >= ie.intime - INTERVAL '6 HOUR'
    AND bg.charttime <= ie.intime + INTERVAL '1 DAY'
  LEFT JOIN mimiciv_derived.ventilation AS vd
    ON ie.stay_id = vd.stay_id
    AND bg.charttime >= vd.starttime
    AND bg.charttime <= vd.endtime
    AND vd.ventilation_status = 'InvasiveVent'
)
  • [2] Regarding the restriction of vd.ventilation_status = 'InvasiveVent', I am confused about whether the respiratory support in the SOFA score includes only invasive mechanical ventilation, why not include vd.ventilation_status = 'NonInvasiveVent'?

In MIMIC-III code repository, respiratory support includes Noninvasive mechanical ventilation,the restriction is MechVent = 1 or Extubated = 1

mimiciii--ventilation_classification.sql

, max(
    case
      when itemid is null or value is null then 0 -- can't have null values
      when itemid = 720 and value != 'Other/Remarks' THEN 1  -- VentTypeRecorded
      when itemid = 223848 and value != 'Other' THEN 1
      when itemid = 223849 then 1 -- ventilator mode
      when itemid = 467 and value = 'Ventilator' THEN 1 -- O2 delivery device == ventilator
      when itemid in
        (
        445, 448, 449, 450, 1340, 1486, 1600, 224687 -- minute volume
        , 639, 654, 681, 682, 683, 684,224685,224684,224686 -- tidal volume
        , 218,436,535,444,459,224697,224695,224696,224746,224747 -- High/Low/Peak/Mean/Neg insp force ("RespPressure")
        , 221,1,1211,1655,2000,226873,224738,224419,224750,227187 -- Insp pressure
        , 543 -- PlateauPressure
        , 5865,5866,224707,224709,224705,224706 -- APRV pressure
        , 60,437,505,506,686,220339,224700 -- PEEP
        , 3459 -- high pressure relief
        , 501,502,503,224702 -- PCV
        , 223,667,668,669,670,671,672 -- TCPCV
        , 224701 -- PSVlevel
        )
        THEN 1
      else 0
    end
    ) as MechVent

mimiciii--ventilation_durations.sql

, vd2 as
(
  select vd1.*
  -- create a cumulative sum of the instances of new ventilation
  -- this results in a monotonic integer assigned to each instance of ventilation
  , case when MechVent=1 or Extubated = 1 then
      SUM( newvent )
      OVER ( partition by icustay_id order by charttime )
    else null end
    as ventnum
  --- now we convert CHARTTIME of ventilator settings into durations
  from vd1
)
-- create the durations for each mechanical ventilation instance
select icustay_id
  -- regenerate ventnum so it's sequential
  , ROW_NUMBER() over (partition by icustay_id order by ventnum) as ventnum
  , min(charttime) as starttime
  , max(charttime) as endtime
  , DATETIME_DIFF(max(charttime), min(charttime), 'MINUTE')/60 AS duration_hours
from vd2
group by icustay_id, vd2.ventnum
having min(charttime) != max(charttime)
-- patient had to be mechanically ventilated at least once
-- i.e. max(mechvent) should be 1
-- this excludes a frequent situation of NIV/oxygen before intub
-- in these cases, ventnum=0 and max(mechvent)=0, so they are ignored
and max(mechvent) = 1
order by icustay_id, ventnum

mimiciii--sofa.sql

, pafi1 as
(
  -- join blood gas to ventilation durations to determine if patient was vent
  select bg.icustay_id, bg.charttime
  , pao2fio2
  , case when vd.icustay_id is not null then 1 else 0 end as isvent
  from blood_gas_first_day_arterial bg
  left join ventilation_durations vd
    on bg.icustay_id = vd.icustay_id
    and bg.charttime >= vd.starttime
    and bg.charttime <= vd.endtime
  order by bg.icustay_id, bg.charttime
)

Interestingly, the Berlin definition for ARDS appears to include non-invasive mechanical ventilation as well.

Different pieces of information are conflicting. Which one should I choose?
Which one is more appropriate?
vd.ventilation_status = 'InvasiveVent
v.ventilation_status in ('InvasiveVent', 'NonInvasiveVent')
v.ventilation_status in ('InvasiveVent', 'Tracheostomy', 'NonInvasiveVent')

Thank you for your attention to this matter!

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

1 participant