Database Credentialed Access

MIMIC-IV-Ext-ECG-Glucose: Temporally Aligned 12-Lead ECG and Laboratory Blood Glucose Pairs with Quality and Pharmacological Annotations

Md Basit Azam ,  Sarangthem Singh

Published Oct. 6, 2026 · Version 1.0.0
When using this resource, please cite:

Azam, M. B., & Singh, S. (2026). MIMIC-IV-Ext-ECG-Glucose: Temporally Aligned 12-Lead ECG and Laboratory Blood Glucose Pairs with Quality and Pharmacological Annotations (version 1.0.0). PhysioNet. RRID:SCR_007345. https://doi.org/10.13026/nts2-vj76

Please include the standard citation for PhysioNet:

Pollard, T., Moody, B. E., Lehman, L., Gow, B., Fernandes, C., Xie, C., Johnson, A., Mark, R. G., & Heldt, T. (2026). PhysioNet as a global platform for biomedical research. Nature Health. https://doi.org/10.1038/s44360-026-00096-z. Available from: https://rdcu.be/faatM

Abstract

Dysglycaemia is common in hospitalised and critically ill patients, and non-invasive estimation of blood glucose from the electrocardiogram (ECG) is an active research area. However, large public resources that link ECGs to contemporaneous glucose measurements are lacking. MIMIC-IV-Ext-ECG-Glucose is a derived dataset of 437,671 glucose–ECG pairs from 131,771 patients at Beth Israel Deaconess Medical Center. It was built by linking laboratory blood glucose results from MIMIC-IV (v3.1) with the temporally nearest 12-lead diagnostic ECG from MIMIC-IV-ECG (v1.0) recorded within ±240 minutes. Records come from emergency department, inpatient and intensive care unit (ICU) encounters; 80,598 records (18.4%) were measured during an ICU stay. Each record is annotated along three quality dimensions: (1) exposure to exogenous insulin or intravenous dextrose within fixed pharmacokinetic windows, derived from ICU medication administration records; (2) ECG signal quality, measured with a ten-component Signal Quality Index (SQI) computed from machine measurements; and (3) temporal alignment, grouped into four tiers from TIGHT (≤30 minutes) to EXTENDED (121–240 minutes). A composite usability tier (IDEAL, USABLE, CAUTION, EXCLUDE) combines the three dimensions. The 101 columns cover demographics, admission and ICU context, glucose values and lagged dynamics, ECG interval measurements, four QTc correction formulas and patient-level glycaemic summaries. A deterministic patient-level 80/10/10 train/validation/test split is provided. The BigQuery SQL used to generate the dataset is included.


Background

Dysglycaemia encompassing both hypoglycaemia and hyperglycaemia is independently associated with increased ICU mortality, prolonged mechanical ventilation, and susceptibility to nosocomial infection [1,2]. Current clinical practice relies on intermittent invasive blood sampling for glucose monitoring, a process that is labour-intensive, carries infection risk, and provides temporally sparse measurements that miss clinically significant glycaemic excursions between sampling intervals [3].

Non-invasive glucose estimation from electrophysiological signals has emerged as a promising alternative. The electrocardiogram is a particularly attractive substrate: acute dysglycaemia and diabetic autonomic dysfunction are associated with measurable changes in cardiac electrophysiology, including heart rate, QT interval prolongation and repolarisation morphology [4,5]. However, the development and validation of ECG-based glucose models has been constrained by the absence of large, temporally aligned, clinically annotated datasets that link ECG recordings to contemporaneous laboratory glucose measurements in hospitalised patients.

Existing datasets either provide ECG recordings without paired metabolic context, provide glucose time series without electrophysiological correlates, or are too small to train modern deep learning models. In addition, no publicly available resource accounts for the pharmacological confounding introduced by exogenous insulin and intravenous dextrose, interventions that can decouple the physiological ECG–glucose relationship that prediction models seek to learn.

MIMIC-IV-Ext-ECG-Glucose addresses these gaps by linking blood glucose laboratory measurements from MIMIC-IV [6] with contemporaneous 12-lead diagnostic ECG recordings from MIMIC-IV-ECG [7] across emergency department, inpatient and ICU encounters, including a critically ill subset. The dataset is designed to develop and benchmark non-invasive glucose estimation methods, with quality stratification that allows researchers to select subsets appropriate to their modelling objectives.


Methods

Data Sources

The dataset was derived from MIMIC-IV (version 3.1) [6], accessed through Google BigQuery (physionet-data.mimiciv_3_1_hosp and physionet-data.mimiciv_3_1_icu), and from MIMIC-IV-ECG: Diagnostic Electrocardiogram Matched Subset (version 1.0) [7] (physionet-data.mimiciv_ecg), both distributed through PhysioNet [8]. MIMIC-IV contains de-identified records of patients admitted to the emergency department or ICUs of Beth Israel Deaconess Medical Center (BIDMC), Boston, MA. MIMIC-IV-ECG provides approximately 800,000 diagnostic 10-second 12-lead ECGs from nearly 160,000 MIMIC-IV patients, recorded between 2008 and 2019 on ECG carts from several manufacturers, together with machine-generated interval measurements. The complete pipeline is provided as mimiciv_ecg_glucose_pipeline.sql.

Cohort Selection and Glucose Extraction

Glucose results were extracted from hosp.labevents for itemid 50931 (Glucose, Blood, Chemistry; central laboratory serum/plasma assay) and itemid 50809 (Glucose, Blood, Blood Gas; whole-blood blood-gas analyser), restricted to values between 30 and 700 mg/dL with a non-null charttime. The query also lists itemid 52027, which returned no records in MIMIC-IV v3.1. Point-of-care fingerstick glucose is recorded in icu.chartevents and is not included. Each result was joined to patients (sex, anchor age, anchor year group), to admissions through hadm_id when present, and to icu.icustays when the glucose time fell within an ICU stay (during_icu_stay = TRUE). Each value was classified as SEVERE_HYPO (<54), HYPO (54–69), EUGLYCEMIC (70–180), HYPER (181–250) or SEVERE_HYPER (>250 mg/dL).

Temporal ECG-Glucose Alignment

For each glucose result, all ECGs of the same patient within ±240 minutes were identified and the ECG with the smallest absolute offset was kept. An ECG can therefore be linked to more than one glucose result: 376,648 unique ECG studies are used across 437,671 records. The signed offset is glucose_time − ecg_time. Records were labelled ECG_BEFORE_GLUCOSE (n=238,706; 54.5%), ECG_AFTER_GLUCOSE (n=195,184; 44.6%) or SIMULTANEOUS (offset 0 min at 1-minute resolution; n=3,781; 0.9%). Alignment tiers were TIGHT (≤30 min; n=160,939), MODERATE (31–60 min; n=69,055), LOOSE (61–120 min; n=89,617) and EXTENDED (121–240 min; n=118,060). The median absolute offset was 55 minutes (IQR 17–127).

Pharmacological Intervention Flagging

Insulin and intravenous dextrose administrations were extracted from icu.inputevents (statusdescription ≠ 'Rewritten', amount > 0) and matched to glucose results by subject_id. A glucose result was flagged when its timestamp fell within [starttime − W, endtime + W] of an administration, with W = 120 minutes for fast-acting and premixed insulin (itemids 223258, 229299, 228959, 223259), 240 minutes for basal insulin (223260, 223262) and 60 minutes for dextrose (220949, 220950, 228142, 220952, 220955, 220953). intervention_status is EXCLUDE when insulin and dextrose are both active (n=21,290; 4.9%), FLAG_HIGH_RISK when fast-acting insulin is active without dextrose (n=4,725; 1.1%), FLAG_MODERATE_RISK when only basal insulin or only dextrose is active (n=26,112; 6.0%), and CLEAN otherwise (n=385,544; 88.1%). decoupling_risk_score = 2 × fast-acting insulin + 1 × dextrose + 1 × dual intervention (observed values 0, 1, 2 and 4). Because only ICU medication records are used, CLEAN records outside an ICU stay should be treated as unannotated. A small number of non-ICU records (n=1,295) are flagged because they fall within the window of an administration recorded during an adjacent ICU stay. In a sensitivity analysis, changing the fast-acting window to 90 or 150 minutes reclassified 0.77% and 0.79% of records, respectively.

Glucose dynamics

Within each (subject_id, stay_id) partition, glucose results were ordered chronologically, and the previous value, the gap, and the signed change were computed. For ICU records, the partition is the ICU stay. For records with no ICU stay, the patient's full sequence of non-ICU glucose results is used, so the previous value may come from an earlier encounter. The rate of change (mg/dL/hr) is computed only when the gap is between 15 minutes and 6 hours (otherwise NULL, gap_exceeds_threshold = TRUE). Trajectories were defined with thresholds adapted from CGM rate-of-change conventions (0.33 and 1 mg/dL/min): RAPID_FALL (< −60 mg/dL/hr), MODERATE_FALL (−60 to −20), STABLE (±20), MODERATE_RISE (20–60) and RAPID_RISE (> 60). UNKNOWN_FIRST marks records without a previous value, and UNKNOWN_GAP marks records whose gap falls outside the valid range. delta_is_intervention_confounded is TRUE when the previous result was EXCLUDE or FLAG_HIGH_RISK.

ECG Signal Quality

Ten binary checks were computed from machine_measurements: RR 300–2000 ms, QRS 60–200 ms, QT 200–600 ms, PR 120–300 ms, JT 150–400 ms, P onset before QRS onset, T end after QRS end, P axis −90° to +90°, and QRS and T axes −180° to +180° (valid-value checks). report_artifact_flag is set when any machine report field (report_0–report_17) contains artefact, noise, poor quality, lead off, cannot interpret, uninterpretable or baseline wander. SQI = max(0, sum of the ten checks − 3 × artefact flag), which ranges from 0 to 10. Categories are GOOD (≥8; n=372,024; 85.0%), FAIR (5–7; n=64,675; 14.8%) and POOR (≤4; n=972; 0.2%).

QTc Interval Computation

Bazett, Fridericia, Framingham and Hodges QTc were computed from qt_raw_ms (t_end − qrs_onset) and the RR interval. qtc_recommended_ms equals the Fridericia value. qtc_formula_range_ms is the maximum minus the minimum of the four formulas. Prolongation flags use a sex-agnostic threshold of 500 ms. Records with heart rate < 50 bpm and a formula range > 200 ms indicate implausible RR measurements and are assigned EXCLUDE (n=492).

Usability tiers and split

Records are EXCLUDE if intervention_status is EXCLUDE, SQI is POOR, or the bradycardia QTc criterion is met. These criteria overlap. Applied in that order, they account for 21,290 + 870 + 7 = 22,167 records (5.1%). Of the remaining records, those with FLAG_HIGH_RISK, FAIR SQI, a confounded delta or a gap outside 15 minutes to 6 hours are CAUTION (n=295,034; 67.4%). Records that are ECG_BEFORE_GLUCOSE, TIGHT or MODERATE, CLEAN and GOOD, and that have a valid previous value, are IDEAL (n=4,364; 1.0%). All other records are USABLE (n=116,106; 26.5%). The split is MOD(ABS(FARM_FINGERPRINT(subject_id)), 10): 0–7 TRAIN, 8 VALIDATION, 9 TEST. It is assigned to all records: TRAIN 349,976 records / 105,435 patients, VALIDATION 44,718 / 13,217, TEST 42,977 / 13,119. After removing EXCLUDE records, the counts are 332,241 / 105,261, 42,505 / 13,192 and 40,758 / 13,078.


Data Description

File Structure

The accompanying files are as follows:

  • mimiciv_ecg_glucose_aligned.csv: 437,671 rows × 101 columns, RFC 4180, UTF-8.
  • data_dictionary.csv: type, unit, description, source table, notes and missing percentage for every column.
  • mimiciv_ecg_glucose_pipeline.sql: BigQuery SQL that generates the CSV.
  • README.md: overview, conventions, recommended use and limitations.

Summary

Attribute Value
Records 437,671
Patients 131,771
Unique ECG studies 376,648
Hospital admissions / ICU stays represented 99,544 / 30,435
Records during ICU stay 80,598 (18.4%)
Age, record level mean 62.2 (SD 17.4) years
Male, patient level 48.4% (51.9% of records)
Glucose mean 135.4 (SD 65.8), median 116 mg/dL
Glycaemic class EUGLYCEMIC 366,756 (83.8%); HYPER 39,329 (9.0%); SEVERE_HYPER 24,558 (5.6%); HYPO 5,414 (1.2%); SEVERE_HYPO 1,614 (0.4%)

Column groups (101)

  • Identifiers (5): subject_id, hadm_id, stay_id, labevent_id, ecg_study_id
  • Demographics (5): gender, age, anchor_year_group, race, insurance
  • Admission and ICU context (8): admission_type, first_careunit, last_careunit, icu_los_days, during_icu_stay, hours_since_admission, hours_since_icu_admission, hospital_expire_flag
  • Glucose measurement (8): glucose_time, glucose_mg_dl, glucose_label, glycemic_class, lab_flag, ref_range_lower, ref_range_upper, lab_priority
  • Pharmacological intervention (8): insulin_active, fast_insulin_active, dextrose_active, dual_intervention_active, max_insulin_dose_units, max_dextrose_amount_ml, decoupling_risk_score, intervention_status
  • Glucose dynamics (12): lag_glucose_mg_dl, lag_glucose_time, lag_intervention_status, glucose_seq_in_stay, glucose_delta_mg_dl, inter_measurement_gap_min, inter_measurement_gap_hr, is_first_glucose_in_stay, gap_exceeds_threshold, delta_is_intervention_confounded, glucose_rate_mg_dl_per_hr, glucose_trajectory
  • ECG linkage and alignment (7): ecg_time, ecg_file_name, waveform_path, temporal_relationship, alignment_quality, glucose_ecg_offset_minutes, abs_offset_minutes
  • ECG measurements, QTc and SQI (35): sqi_score, sqi_category, report_artifact_flag, 10 sqi_* checks, heart_rate_bpm, hr_regime, rr_interval, qrs_duration_ms, qt_raw_ms, pr_interval_ms, jt_interval_ms, p_axis, qrs_axis, t_axis, qtc_bazett_ms, qtc_fridericia_ms, qtc_framingham_ms, qtc_hodges_ms, qtc_recommended_ms, qtc_formula_range_ms, and six prolongation flags
  • Patient-level statistics and usability (13): n_glucose_ecg_pairs, patient_mean_glucose, patient_std_glucose, patient_min_glucose, patient_max_glucose, glucose_cv_percent, time_in_range_pct, time_below_range_pct, time_above_range_pct, glucose_z_score, glucose_minmax_norm, record_usability, split

Conventions

Timestamps are MIMIC-IV date-shifted times. Booleans are true/false; during_icu_stay is true or empty (never false). Empty cells are NULL.


Usage Notes

Reuse potential

The dataset is intended for developing and benchmarking methods that estimate blood glucose or glycaemic class from ECG-derived features or, via waveform_path, from raw MIMIC-IV-ECG waveforms. Beyond glucose estimation, it supports: studies of the association between glycaemic state and cardiac repolarisation (QT/QTc, T-wave axis) in hospitalised patients; comparison of QTc correction formulas across heart-rate regimes; study of insulin and intravenous dextrose exposure in relation to ECG measurements in the ICU; evaluation of data-quality-aware training strategies, such as tier-based filtering or weighting; and use as a labelled downstream task for ECG foundation models. The SQL pipeline can be modified to change the alignment window, the pharmacokinetic windows or the quality thresholds, or to add other MIMIC-IV covariates.

Recommended use

Use the provided split column; it is assigned per patient, so no patient appears in more than one partition. Remove EXCLUDE records. A conservative subset for ECG-based glucose modelling is record_usability IN ('IDEAL','USABLE') AND temporal_relationship = 'ECG_BEFORE_GLUCOSE' AND intervention_status = 'CLEAN'. Add during_icu_stay = TRUE when pharmacologically annotated records are required. Treat NULL glucose_rate_mg_dl_per_hr as missing rather than zero.

Columns derived from the target

glycemic_class, lab_flag, glucose_delta_mg_dl, glucose_rate_mg_dl_per_hr, glucose_trajectory, glucose_z_score, glucose_minmax_norm and the patient-level statistics (patient_mean_glucose, patient_std_glucose, patient_min_glucose, patient_max_glucose, glucose_cv_percent, time_in_range_pct, time_below_range_pct, time_above_range_pct) are computed from the predicted glucose value (the target). The patient-level statistics use all of a patient's records, including the current and future ones. These columns must not be used as model inputs for glucose prediction. Use them only for description or stratification, or recompute history features from strictly earlier records.

Known limitations

  • Pharmacological annotation scope. Insulin and dextrose exposure comes only from the ICU inputevents. For the 81.6% of records not associated with an ICU stay, CLEAN means "not annotated". Subcutaneous insulin given on the ward, oral agents and enteral or parenteral nutrition are not captured. 4,012 of the 4,364 IDEAL records are outside an ICU stay.
  • Fixed pharmacokinetic windows. Windows are population-level estimates applied symmetrically around each administration and ignore dose, route, and individual pharmacokinetics. The basal insulin window does not fully capture the action profile of glargine or NPH.
  • Temporal sparsity. Glucose values are intermittent laboratory results, not continuous monitoring. The median gap between consecutive glucose results is 57.3 hours overall (2.6 hours in the ICU), and the rate of change is available for only 14.7% of records.
  • Lag definition outside the ICU. For records with no ICU stay, the previous glucose may come from a different encounter, sometimes years earlier. lag_glucose_mg_dl and glucose_delta_mg_dl remain populated even when the gap exceeds 6 hours.
  • Alignment. The ±240-minute window admits pairs up to 4 hours apart, and 44.6% of records have the ECG after the glucose draw. A single ECG may be paired with up to 12 glucose results (22.0% of records share their ECG). 1,023 records share the same patient and glucose timestamp with another record, typically the same draw measured by both the chemistry and blood-gas assays.
  • Glucose assay type. Glucose comes from two laboratory assays (chemistry itemid 50931 and blood-gas itemid 50809), both labelled "Glucose". The file has no itemid column, so users who need the assay type must retrieve it from MIMIC-IV labevents using labevent_id. Point-of-care fingerstick values are not included.
  • Placeholder codes in ECG fields. Some machine-measurement fields contain MIMIC-IV-ECG "not measured" codes (29999, 32767, 65535) instead of blanks, and intervals derived from them are also invalid (e.g. pr_interval_ms = -29799). 70,272 records have at least one such value, mostly in p_axis and pr_interval_ms. Most of these records are CAUTION or EXCLUDE, but 1,524 are IDEAL or USABLE. Treat |value| >= 10000 as missing. The 67 records with RR = 0 have NULL heart rate and QTc, but are labelled hr_regime = TACHYCARDIA.
  • ECG features. All ECG features are machine-derived measurements from carts manufactured by several manufacturers. No waveform-level quality assessment was performed. The SQI thresholds are heuristic and have not been validated against expert annotation. The QRS and T-axis checks only verify that a value is valid.
  • Missing admission data. race, insurance, admission_type and hospital_expire_flag are missing for the 53.5% of records not linked to a hospital admission (e.g., emergency department visits or outpatient laboratory draws).
  • Generalisability. Single centre, adults only, 2008–2019. Glycaemic management practice changed over this period. age is anchor age, and ages above 89 are shown as 91.
  • Class imbalance. Hypoglycaemia (<70 mg/dL) represents 1.6% of records.

Release Notes

Version 1.0.0:

Initial release


Ethics

This dataset was derived exclusively from de-identified data in MIMIC-IV (v3.1) and MIMIC-IV-ECG (v1.0). No new data were collected, no patient contact occurred, and no attempt was made to re-identify individuals. This secondary analysis does not constitute human subjects research requiring independent ethical review. The derived dataset is released under the same credentialed access terms as MIMIC-IV.


Acknowledgements

We thank the MIMIC team at the MIT Laboratory for Computational Physiology for curating the MIMIC-IV and MIMIC-IV-ECG databases and making them available to researchers through PhysioNet. This material is based upon work supported by the Google Cloud Research Credits program under award No. GCP19980904.


Conflicts of Interest

The author(s) have no conflicts of interest to declare.


References

  1. The NICE-SUGAR Study Investigators. Intensive versus Conventional Glucose Control in Critically Ill Patients. New England Journal of Medicine. 2009 Mar 26;360(13):1283–97. doi:10.1056/NEJMoa0810625
  2. Berghe GV den, Wouters P, Weekers F, Verwaest C, Bruyninckx F, Schetz M, et al. Intensive Insulin Therapy in Critically Ill Patients. New England Journal of Medicine. 2001 Nov 8;345(19):1359–67. doi:10.1056/NEJMoa011300
  3. Klonoff DC. Continuous Glucose Monitoring: Roadmap for 21st century diabetes therapy. Diabetes Care. 2005 May 1;28(5):1231–9. doi:10.2337/diacare.28.5.1231
  4. Heller SR. Abnormalities of the electrocardiogram during hypoglycaemia: the cause of the dead in bed syndrome? Int J Clin Pract Suppl. 2002 Jul;(129):27–32. PubMed PMID: 12166602.
  5. Chiu IM, Cheng CY, Chang PK, Li CJ, Cheng FJ, Lin CHR. Utilization of Personalized Machine-Learning to Screen for Dysglycemia from Ambulatory ECG, toward Noninvasive Blood Glucose Monitoring. Biosensors. 2023 Jan;13(1):23. doi:10.3390/bios13010023
  6. Johnson A, Bulgarelli L, Pollard T, Gow B, Moody B, Horng S, et al. MIMIC-IV [Internet]. PhysioNet; 2024 Oct [cited 2026 Sep 27]. Available from: https://physionet.org/content/mimiciv/3.1/ doi:10.13026/kpb9-mt58
  7. Gow B, Pollard T, Nathanson LA, Johnson A, Moody B, Fernandes C, et al. MIMIC-IV-ECG: Diagnostic Electrocardiogram Matched Subset [Internet]. PhysioNet; 2023 Sep [cited 2026 Sep 27]. Available from: https://physionet.org/content/mimic-iv-ecg/1.0/ doi:10.13026/4nqg-sb35
  8. Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, et al. PhysioBank, PhysioToolkit, and PhysioNet. Circulation. 2000 Jun 13;101(23):e215–20. doi:10.1161/01.CIR.101.23.e215

Files