{'fraction_non_alphanumeric': 0.034507175226586105, 'fraction_numerical': 0.020817598187311177, 'mean_word_length': 4.999716794109317, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Novel Method to Improve the Identification of Time of Intubation for Retrospective EHR Data Analysis During a Time of Resource Strain, the COVID-19 Pandemic

Accurate determinations of the time of intubation (TOI) are critical for retrospective electronic health record (EHR) data analyses. In a retrospective study, the authors developed and validated an improved query (Ti) to identify TOI across numerous settings in a large health system, using EHR data, during the COVID-19 pandemic. Further, they evaluated the affect of Ti on peri-intubation patient parameters compared to a previous method—ventilator parameters (Tv). Ti identified an earlier TOI for 84.8% (n = 1666) of cases with a mean (SD) of 3.5 hours (15.5), resulting in alternate values for: partial pressure of arterial oxygen (PaO2) in 18.4% of patients (mean 43.95 mmHg [54.24]); PaO2/fractional inspired oxygen (FiO2) in 17.8% of patients (mean 48.29 [69.81]), and oxygen saturation/FiO2 in 62.7% (mean 16.75 [34.14]), using the absolute difference in mean values within the first 4 hours of intubation. Differences in PaO2/FiO2 using Ti versus Tv resulted in the reclassification of 7.3% of patients into different acute respiratory distress syndrome (ARDS) severity categories.


Introduction
Intubation is both an important outcome measure along the spectrum of all respiratory illnesses and a marker of disease severity. Time of intubation (TOI) is an important point to identify in the electronic health record (EHR) as it allows researchers to study the association of pre-and postintubation variables with mortality and other relevant patient-centered outcomes. This type of knowledge, determined retrospectively, can serve as hypothesis generating to test interventions prospectively. Further, accurately extracting peri-intubation blood gas analyses and postintubation mechanical ventilation parameters from the EHR will allow researchers to understand the state of lung compromise at the TOI, before the impact of human intervention through invasive procedures and mechanical ventilation. 1 Even small discrepancies between derived TOI and actual TOI may alter peri-intubation data, affect outcomes research, and decrease chances that the work could have widespread generalizability and be accurately reproduced.
Previous research has shown that accurate determination of whether a patient was intubated and TOI is difficult. 2,3 Exacerbating this problem, surges of hospitalized patients during the current COVID-19 pandemic have made timely charting in the electronic health record difficult. Surrogates for identifying onset of mechanical ventilation have been employed previously 2,4-7 but have not been evaluated across multiple hospital settings during a time of unprecedented patient volume. The purpose of this study is to develop and validate an improved reference standard for determining TOI across the emergency, internal medicine, and critical care settings of a large health system during a time of resource strain, the COVID-19 pandemic.

Study Population
The authors conducted a retrospective study of all admitted internal medicine patients who tested positive for SARS-CoV-2 by nasopharyngeal PCR, 18 years or older, intubated with acute respiratory distress syndrome (ARDS), within 12 hospitals of the Northwell Health system between March 1, 2020, and April 30, 2020, to determine whether a new search query (Ti) would more accurately identify the correct TOI than a previous query using only ventilator parameters (Tv).
The internal validation cohort included a randomly selected subset of 1979 patients from the Northwell COVID ARDS (NorthCARDS) dataset ( Figure 1). The external validation cohort included 8236 nonsurgical patients, 18 years or older, from the intensive care unit of Beth Israel Deaconess Medical Center, using publicly available MIMIC-III database (Medical Information Mart for Intensive Care III), which is sourced from 2 different clinical information systems, namely CareVue (n = 4657) and MetaVision (n = 3600). 8 CareVue and MetaVision datasets represent 35 632 and 22 046 ICU admissions, respectively. The authors included adult patients (18 y and older) admitted to a nonsurgical service, which leads to 13 157 and 11 640 admissions in CareVue and MetaVision, respectively. After running Ti, 4657 and 3600 were found to have been intubated in CareVue and MetaVision, respectively ( Figure 1).
The Northwell Health Institutional Review Board considered this study as minimal risk and therefore waived the requirement for informed consent.

Data Collection
Data elements used to develop the logic behind Ti include as follows: TOI authored in an endotracheal intubation procedure note (from the emergency department (ED) or as an inpatient); "Start Time" from the mechanical ventilation record; mechanical ventilation parameters-positive end expiratory pressure (PEEP), tidal volume, peak inspiratory pressure, mean airway pressure, plateau pressure, and set/total respiratory rates-extracted from the mechanical ventilation record, excluding average volume-assured pressure support, bilevel positive airway pressure, and continuous positive airway pressure devices; administered medications-etomidate, succinylcholine, cisatracurium, rocuronium, vecuronium, propofol, fentanyl; documentation of "ventilator" in the oxygen delivery method extracted from nursing notes; fractional inspired oxygen (FiO 2 ) extracted from nursing notes and the mechanical ventilation record; oxygen saturation (SpO 2 ) extracted from nursing notes; partial pressure of arterial oxygen (PaO 2 ); arterial pH (pH); partial pressure of arterial CO2 (PaCO 2 ); PaO 2 /FiO 2 (P/F) ratio; SpO 2 /FiO 2 (S/F) ratio. Data elements including mechanical ventilation parameters, medication orders, vital signs and oxygen delivery methods, intubation notes, and lab results were exported from the Sunrise EHR database and Allscripts database to a centralized structured query language (SQL) database for further analysis.

Missing Data
Missing data for FiO 2 was imputed using the previous value documented and was continued until a new value was entered into the EHR. Data for SpO 2 , PaO 2 , pH, and PaCO 2 was considered missing if it was not available within the prespecified time window after TOI, for both Ti and Tv, and, therefore, was left out of calculations of mean and median. These variables were only reported if data were available within 4 hours after TOI using both Ti and Tv. The number of patients that had missing values, and therefore left out of the data reported in

Algorithm Generation/Query Development
Initially, 100 randomly selected charts of 3176 intubated patients were manually reviewed to determine TOI (first intubation) and data points that most accurately identified this time point were recorded. Validation of intubation was done by ensuring that mechanical ventilation parameters (ie, PEEP, tidal volume, peak inspiratory pressure) were entered into the mechanical ventilation record, patients were receiving sedatives indicative of being on invasive mechanical ventilation (ie, propofol or fentanyl), and invasive mechanical ventilation was confirmed in the progress note for that specific day.
The following entries in the EHR were determined to be the most common and accurate data points that validated TOI: TOI authored in an endotracheal intubation procedure note (from the ED or as an inpatient); "Start Time" from the mechanical ventilation record; time of first documentation of mechanical ventilation parameters in the mechanical ventilation record; time of first completed injection of medications used for intubation such as etomidate, succinylcholine, cisatracurium, rocuronium, vecuronium; time of initiation of continuous infusion propofol or fentanyl (minimum duration of 5 min); and finally, documentation in nursing ED or inpatient notes regarding use of "ventilator" in the oxygen delivery method for each patient.
Next, a data processing and analytics pipeline were developed using Python with over 2500 lines of code (Ti). Two versions of the code were developed for MIMIC-III and NorthCARDS based on each database's schema. The code for MIMIC-III is available at https://github.com/amir-gandomi/Time_of_Intubation.
Further refinement of Ti was done after manual review of a total of 50 new charts of randomly selected patients, using Ti to find TOI, found the following issue: patients were included in the data set that were intubated for a surgical procedure. Therefore, Ti was modified to remove all patients intubated for a surgical procedure.
Subsequent validation of Ti was done by manually reviewing a new set of 75 randomly selected patient charts where at least an 8-hour discrepancy between time of first documentation of mechanical ventilation parameters, and any other criteria was found to determine whether TOI was accurate. Of these 75 charts, 63 had the correct TOI. Of the 12 that were incorrect, the following reasons were found: 4 charts had data entry errors; 7 were transfers from another hospital within the health system and were under separate visits-corrected after multiple visits per patient were merged into 1 visit; and 1 was intubated prior to hospital admission.

Data Validation
Internal validation was performed by chart review of a new set of 100 randomly selected intubated patients with COVID-19 ARDS. Three critical care trained physicians and one hospitalist reviewed 25 charts each and determined whether the derived TOI, using Ti, was accurate based on chart review. Ti was found to be accurate in 97% of cases reviewed. Of the 3 cases that did not represent the actual TOI, 2 were data entry errors and one was intubated before hospital arrival. Although Ti identified the earliest time of first documentation of ventilator support for these 3 cases, it did not reflect the actual TOI. There were also 4 other discrepancies found between reviewers and Ti results. Of these disputed cases, the TOI generated by Ti was found to be closer to the actual TOI than the TOI determined by the reviewer, based on an independent review by 2 separate reviewers unfamiliar with the cases.
External validation was performed on intubated adult patients, 18 years or older, admitted to a nonsurgical ICU using CareVue and MetaVision datasets (MIMIC-III) (Figure 1). One author, trained in verifying TOI from the electronic health record, reviewed 50 charts from CareVue and 50 charts from Metavision; Ti was found to be accurate in 94% and 92% of cases, respectively.

Outcome Measures
The main outcome measure is the number of patients with an earlier TOI using Ti. This is reported as the number of patients with a nonzero (hours) time difference between the TOI using Ti and Tv with associated mean (SD) and median (interquartile range [IQR]) time differences. Secondary outcomes evaluated the impact of Ti on the following variables: FiO 2 , SpO 2 , PaO 2 , pH, PaCO 2 , P/F, S/F. The authors used 2 measures for this evaluation, both using a window of 4 hours from the TOI using Ti and Tv: (1) the absolute value of difference between the mean of all recording(s) of the variable after TOI, using Ti, and Tv, denoted by ; ∆X (2) the absolute value of difference between the first recording of the variable after TOI, using Ti, and Tv, denoted by ∆ 1 X . Figure 2 illustrates the calculation of outcome measures for a hypothetical case. Tables 2 and 3 show the number of patients with a nonzero ∆X and ∆ 1 X, respectively, along with their mean (SD) and median (IQR). Other secondary outcomes included the change in ARDS severity classification based on P/F ratios within 12 hours (to decrease missing values) of intubation using Ti and Tv (Table 4). The choice of 12 hours was based on the missingness rate given different window sizes (see Table, Supplemental Digital Content 1, available at http://links.lww.com/AJMQ/A65).

Results
A total of 1979 patients, 4657 patients, and 3600 patients were used for the NorthCARDS, CareVue, and MetaVision datasets, respectively. Using Ti, mechanical ventilation parameters were the determining factor for TOI in 13.6% (n = 300), 86.5% (n = 4250), and 50.2% (n = 2435) for NorthCARDS, CareVue, and Metavision, respectively. In the internal validation cohort, NorthCARDS, Ti resulted in an earlier TOI in 84.8% (n = 1666) of cases with a mean (SD) of 3.5 (15.5) and a median (IQR) of 0.78 hours (0.33-2.08). In the external validation cohort, CareVue, Ti resulted in an earlier TOI in 7.7% (n = 353) of cases, mean 6.4 (34. 8 , in NorthCARDS, when using the absolute value of difference between the mean (SD) and median (IQR) measure within the first 4 hours of intubation using Ti and Tv (Table 2).
Although less patients were included because of an increase in missing data, the absolute value of difference between using Ti and Tv in NorthCARDS, when using the first value within the first 4 hours of intubation with Ti and Tv, resulted in larger differences in PaO 2 12.6% (n = 152), mean 65.31 (68.89), median 41.00 (21.00-88.25); P/F 11.9% (n = 143), mean 73.25 (84.91), median 50.67 (18.33-91.50); and S/F ratios 50.8% (n = 976), mean 38.83 (67.48), median 19.07 (7.37-29.07) ( Table 3).  Data regarding the differences in oxygenation and ventilation parameters using the absolute value of difference between the mean (SD) and median (IQR) measure within the first 4 hours of intubation with Ti and Tv for CareVue and Metavision can be found in Table 2. Data regarding the differences in oxygenation and ventilation parameters using the absolute value of difference using the first value within the first 4 hours of intubation using Ti and Tv for CareVue and Metavision can be found in Table 3.
Differences in P/F ratios using Ti, when calculated over 12 hours (to minimize missingness) from intubation, resulted in the reclassification of 7.3% (n = 128) of patients into new ARDS categories in the NorthCARDS dataset ( Table 4). The largest shift between categories occurred when going from moderate ARDS using Tv to severe ARDS using Ti 1.7% (n = 29).

Discussion
This is the first study, to the authors' knowledge, that uses multiple levels of redundancy to develop a query (Ti) that identifies an earlier TOI for patients across different hospital settings in a large health system during a global pandemic. Previous studies have either used the first set of mechanical ventilation parameters (eg, PEEP), first record of an airway device (eg, endotracheal tube), first record of ventilator use in the oxygen delivery method section of the EHR, first order of rapid sequence intubation medications (eg, etomidate), written orders for intubation or a combination of 2 of the aforementioned criteria to identify TOI. 2,[4][5][6][7] The most common measure employed across most of these studies, however, was time of first mechanical ventilation parameter. 2,4,5,7 Based on the cohort, time of first mechanical ventilation parameter provided the closest TOI in only 15% of patients. While this measure may be sufficient within a hospital or health system under normal operating circumstances, when resources are stretched thin, timely documentation may not be possible and thus a query utilizing multiple surrogates for TOI produces results with greater data integrity. The following surrogates were found to be the most accurate in retrospectively identifying TOI in the EHR and, therefore, were used to construct Ti: TOI authored in an endotracheal intubation procedure note (from the ED or as an inpatient); "Start Time" from the mechanical ventilation record; time of first documentation of mechanical ventilation parameters in the mechanical ventilation record; time of first completed injection of medications used for intubation such as etomidate, succinylcholine, cisatracurium, rocuronium, vecuronium; time of initiation of continuous infusion propofol or fentanyl (minimum duration of 5 min); and documentation in nursing ED and inpatient notes regarding use of "ventilator" in the oxygen delivery method for each patient.
Compared with Tv, Ti not only resulted in an earlier TOI in 85% of patients in NorthCARDS, it also resulted in earlier times of intubation for 8% and 30% of patients in the 2 MIMIC-III datasets, CareVue, and Metavision, respectively. The improvement in TOI for the latter 2 datasets using Ti may have been limited, however, by a few factors. First, the MIMIC-III data only represents patients intubated in the intensive care unit 8 where documentation of ventilation parameters may occur with less delay than patients intubated in other settings such as the medical wards or ED. Second, the cohort represents data from New York City and Long Island hospitals during the peak of the COVID-19 pandemic when New York City was the global epicenter. During this period, resources such as ICU space and hospital staffing had to be adjusted to accommodate the large volume of patients. Therefore, data entry may have been delayed to prioritize patient care.
Despite these dramatic differences in environments between the cohort and the patients in MIMIC-III, the use of Ti resulted in substantial differences of PaO 2 , P/F, and S/F ratios in the sample of patients with differences in TOI between Ti and Tv (Tables 2  and 3). Furthermore, ARDS severity was reclassified between normal, mild, moderate, and severe ARDS ( Table 4) in 7% of cases.
The goal in peri-intubation research is to extract the most accurate data points surrounding the TOI in order to determine associations with outcomes of interest. Specific to the COVID-19 pandemic, in addition to patient factors, lab values, respiratory function, type of ventilator used and treatments, the group is also currently evaluating peri-intubation variables in COVID-19 ARDS and their association with index hospital survival and time to liberation from invasive mechanical ventilation. 9 The most proximal data to intubation allows researchers to determine the state of lung compromise at the TOI, before human intervention with invasive mechanical ventilation sets off yet another cytokine cascade 1 that may cloud the picture of true pathology.
Machine learning models are being developed to predict the need for intensive care unit admission, mechanical ventilation, and mortality in patients with COVID-19. 10 However, data quality from an EHR may become a limiting factor for reproducibility and generalizability. In order for a model to be useful in real time, ideally, it should be developed on data that most closely mimics the real life scenario. 11 Therefore, improved EHR data integrity may help improve machine learning algorithms for predicting patientcentered outcomes, not only in COVID-19, but in other disease states as well.
The limitations are in accordance with retrospective studies. All of the data points used to create Ti were surrogates and could not be compared with TOI in real time. As a result, even the most accurate surrogates may be discordant with the actual TOI. Further, the authors did not evaluate the number of patients that did not meet any of their criteria but may have been intubated-this could occur for patients that died shortly after intubation.
In regards to using the first mechanical ventilation parameter as the reference standard for TOI, it did not allow comparison of this measure to actual intubation times. Delays in documentation of mechanical ventilation parameters in the EHR following intubations on the medical wards are possible because a lack of space during the pandemic may have caused delays in transport from the general medicine wards to the intensive care units. Further, the volume of intubations on a daily basis may have also contributed to delays in documentation of mechanical ventilation parameters as patient care was the primary priority.
The summary of impact of Ti on clinical values during the first 4 hours of intubation, Table 2, is limited by overlap between Ti and Tv. The mean values over a 4-hour period starting at Ti will be affected by values that overlap between Ti and Tv. This has the potential to underestimate the impact in the absolute difference between the mean values within 4 hours of Ti and Tv. The impact of using the first variables within 4 hours after intubation (Table 3) also has limitations as there was a significant amount of missing data using this approach (see Table, Supplemental Digital Content 1, available at http://links.lww.com/ AJMQ/A65).

Conclusions
In addition to identifying a more accurate TOI, the new query allows for more accurate analyses of periintubation changes in patient parameters. Although Ti is designed for the authors' EHR, the logic behind it can serve as a guiding template for other institutions to follow for identifying TOI, using their own unique EHR. Further, this logic works across multiple hospital settings-ED, medical wards, and ICUsduring a time of significant resource strain, the COVID-19 pandemic. This research highlights the need for institutions to reassess their own data integrity during times of resource strain, where not only patient care may be affected, 12,13 but also data that may inform future care.