Skip to main content
Journal of Diabetes Science and Technology logoLink to Journal of Diabetes Science and Technology
. 2022 Aug 4;18(2):351–362. doi: 10.1177/19322968221116393

Detection of Hypoglycemia and Hyperglycemia Using Noninvasive Wearable Sensors: Electrocardiograms and Accelerometry

Darpit Dave 1, Kathan Vyas 2, Kimberly Branan 3, Siripoom McKay 4,5, Daniel J DeSalvo 4,5, Ricardo Gutierrez-Osuna 2, Gerard L Cote 3, Madhav Erraguntla 1,
PMCID: PMC10973850  PMID: 35927975

Abstract

Background:

Monitoring glucose excursions is important in diabetes management. This can be achieved using continuous glucose monitors (CGMs). However, CGMs are expensive and invasive. Thus, alternative low-cost noninvasive wearable sensors capable of predicting glycemic excursions could be a game changer to manage diabetes.

Methods:

In this article, we explore two noninvasive sensor modalities, electrocardiograms (ECGs) and accelerometers, collected on five healthy participants over two weeks, to predict both hypoglycemic and hyperglycemic excursions. We extract 29 features encompassing heart rate variability features from the ECG, and time- and frequency-domain features from the accelerometer. We evaluated two machine learning approaches to predict glycemic excursions: a classification model and a regression model.

Results:

The best model for both hypoglycemia and hyperglycemia detection was the regression model based on ECG and accelerometer data, yielding 76% sensitivity and specificity for hypoglycemia and 79% sensitivity and specificity for hyperglycemia. This had an improvement of 5% in sensitivity and specificity for both hypoglycemia and hyperglycemia when compared with using ECG data alone.

Conclusions:

Electrocardiogram is a promising alternative not only to detect hypoglycemia but also to predict hyperglycemia. Supplementing ECG data with contextual information from accelerometer data can improve glucose prediction.

Keywords: electrocardiogram (ECG), accelerometer data, noninvasive blood glucose monitoring, quantile regression, random forests, hypoglycemia, hyperglycemia

Introduction

Diabetes is a serious health condition that affects nearly 422 million lives across the globe. 1 In a recent report by Centers for Disease Control and Prevention (CDC), one in ten individuals in the United States has diabetes. 2 Managing diabetes involves keeping blood glucose in an ideal range.3,4 Hypoglycemia, defined as having glucose levels below 70 mg/dL, 5 poses an acute danger that, if untreated, can result in loss of consciousness, seizures, and, in extreme cases, death. 6 In contrast, hyperglycemia, defined as glucose levels above 180 mg/dL, 3 can lead to long-term complications such as heart disease, stroke, blindness, amputation, kidney disease, dental disease, and increased susceptibility to infections. 7 Studies have shown correlations of time in range (70-180 mg/dL) with diabetes complications.3,8 In this study, 70 mg/dL was used as threshold for hypoglycemia and 180 mg/dL was used as threshold to define hyperglycemia.

Continuous glucose monitors (CGMs) provide frequent and automated glucose readings, and have improved glycemic control and resulted in effective diabetes management 9 compared with finger-stick glucose measurements. This can largely be attributed to key features of CGM devices—near real-time glucose readings and predictive low-glucose alerts. 10 However, CGMs require the insertion of a sensor subcutaneously. The sensor needs to be replaced every 7 to 14 days and can cause discomfort. 11 Furthermore, individuals with prediabetes and type 2 diabetes typically do not get prescribed CGMs but may still benefit from having access to detailed glycemic patterns. Thus, noninvasive approaches for estimating glycemic excursions can be beneficial for a broad range of patients for whom CGMs are not an option.

A number of studies have analyzed whether glucose levels induce changes in physiological features.11,12 The most common approaches include electrical and optical measurements such as electrocardiogram (ECG), photoplethysmography (PPG), near-infrared (NIR) spectroscopy, electrical bioimpedance, and skin temperature. 12 Among these, ECG is a promising solution for detecting glucose levels.13-16 Previous studies have shown that glucose levels induce changes in the morphology of the QRS complex of the ECG, such as corrected QT intervals, and changes in QT intervals and RT-amplitude ratio,17-21 as well as changes in heart rate and heart rate variability (HRV).22,23

Most of the prior work using noninvasive physiological sensors has focused on detecting hypoglycemia as it has critical acute consequences.13,24,25 As noted earlier, however, the goal of diabetes management is not only to prevent the immediate consequences of hypoglycemia, but also to avoid the long-term complications associated with hyperglycemia. 26 Detecting hyperglycemia is straightforward when using CGMs, but noninvasive alternatives to detect hyperglycemia have not been broadly investigated. In addition, physical activity influences glucose patterns significantly.27-31 For example, exercise can potentially lead to hypoglycemia. Furthermore, incorrect management of either insulin or food intake can lead to possible hyperglycemia. This suggests that analyzing the association between physical activity and glycemic levels might be used to detect hypoglycemic and hyperglycemic events. To our knowledge, no prior work has examined supplementing ECG data with contextual data from accelerometry to detect glucose levels in the hypoglycemic and hyperglycemic ranges.

The contributions of our work are: (1) detection of both hypoglycemia and hyperglycemia using noninvasive physiological sensors (ECG), and (2) using contextual information from accelerometer data to supplement ECG information for improved predictions. The prediction results are validated using CGM data as the ground truth.

Methods

Data Description

The data set used in this article was collected by a team of UK-based researchers. 21 The data included eight healthy participants and were recorded over a period of 14 consecutive days in normal living conditions. However, a portion of the actual data for a subgroup of patients became corrupted at the original data collector site, so our current study is based on data from five participants (IDs: 3, 4, 5, 6, and 7 from the original data set). More details on the data set are provided in the supplementary information (Supplemental Appendix I). The subjects included in the present study were three men and two women, aged 27 to 58 years (mean, 42.6 years). Two participants experienced hypoglycemia and two experienced hyperglycemia incidents during the study (Supplemental Appendix I).

Electrocardiogram signals were recorded using a Medtronic Zephyr BioPatch 32 at 250 Hz frequency. The BioPatch also measured accelerometer data in the vertical, lateral, and sagittal directions at 100 Hz. Continuous glucose monitor readings were recorded with a FreeStyle Libre Flash glucose monitor 33 at 15-minute intervals.

ECG Feature Extraction

Electrocardiogram signals are vulnerable to distortions caused by motion artifacts.16,34,35 As such, they require rigorous processing to filter out noise, especially when data are collected in free-living conditions. 13 To overcome these challenges, we processed the raw ECG signal in three steps to extract HRV features. In the first step, we passed the ECG signal through a high-pass filter above 0.5 Hz to remove baseline wander. In the second step, we applied a continuous wavelet transform with a Ricker wavelet at a center frequency of 0.25 Hz to attenuate auxiliary peaks and make the R peaks more prominent. As shown in Figure 1, these two steps made it easier to detect R peaks in the ECG signal and were consistent with prior literature on handling motion artifacts and noise in ECG data.36,37 In the last step, we detected R peaks using the NeuroKit2 toolbox. 38 Once the R peaks were identified, we extracted nine HRV features (Table 1) based on these peaks. These HRV features were extracted for every one-minute window of ECG data. For each CGM measurement, we used the HRV features in a lookback period of five minutes, that is ECG features for every one-minute window were concantenated for the previous five minutes. Thus, a total of 45 ECG features are used in the analysis.

Figure 1.

Figure 1.

Electrocardiogram signal preprocessing: (left) raw signal, (middle) after high-pass filtering, and (right) after applying the continuous wavelet transform.

Table 1.

Heart Rate Variability Features.

Feature Description
HR Beats per minute/mean heart rate
SDNN Standard deviation of NN intervals
SDSD Standard deviation of successive differences
RMSSD Root mean square of successive differences
PNNI_20 Proportion of successive differences over 20 ms
PNNI_50 Proportion of successive differences over 50 ms
HR MAD Mean absolute deviation of RR intervals
CVNN Coefficient of variation of NN intervals
(SDNN/Mean NN)
CVSD Coefficient of variation of successive differences
(RMSSD/Mean NN)

Accelerometer Feature Extraction

For the accelerometer, we extracted features in the time and frequency domains. In addition, we computed pairwise correlations between the three axes. The accelerometer features are shown in Table 2. Similar to ECG, accelerometer features were extracted for each one-minute time window, but in this case using lookback periods of 5, 10, and 15 minutes. Because the effect of physical activity in blood glucose can take several minutes, 39 we also examined different time lags of 0, 5, 10, and 15 minutes to pair glucose and accelerometer data. The concepts of lag and lookback period/windows are depicted in Figure 2. Overall, this resulted in 12 different combinations of lag and lookback periods. Performance was evaluated for different combinations of lags and lookback periods for the fusion (ECG + Accelerometer) model (Supplemental Appendices II and III).

Table 2.

Accelerometer Features.

Category Features
Time domain Mean, minimum, maximum, standard deviation, number of peaks, skewness, kurtosis, interquartile range, signal magnitude area, mean absolute deviation of signal
Frequency domain Mean, maximum, standard deviation, frequency of the maximum power spectra, number of peaks, power
Others Correlation pairs: (X, Y), (X, Z) and (Y, Z)

Figure 2.

Figure 2.

Lag and lookback periods to extract features from accelerometer data.

Data Cleaning and Handing Missing Values

The original study focused on nocturnal hypoglycemia, whereas we consider both diurnal and nocturnal glycemic excursions. The Zephyr BioPatch records two data quality parameters from the ECG signal: the HR confidence and the ECG noise. These supplementary measures can be used to identify good ECG segments. Following the original work, 21 we selected ECG segments with a 100% confidence and ECG noise <0.001 for analysis. After this step, each data segment comprised a reference CGM time stamp and the ECG features from the previous five minutes. Electrocardiogram features were calculated for every one-minute window, resulting in five-time lagged ECG features corresponding to a CGM value. We discarded segments with more than 50% of missing data for a feature. For the retained segments, we estimated any missing data points by averaging the feature in that segment. For example, if a five-minute window is missing the HR estimate for the third minute, we estimated it by taking the mean of the first-, second-, fourth-, and fifth-minute HR values. Accelerometer data were not filtered, and no additional data cleaning steps were applied.

Exploratory Data Analysis

In the first step, we computed statistical summaries of ECG and accelerometer features across the hypoglycemia, hyperglycemia, and normal glucose ranges. Then, we performed analysis of variance (ANOVA) to determine whether there were statistical differences between ECG and accelerometer features in the three glycemic ranges. Results are summarized in Tables 3 and 4. Most of the P values are less than .05, indicating that there are statistically significant differences between the mean values of the features in the three glycemic ranges. For ECG data, the patterns in the occurrence of R peaks and related HRV measures that capture these patterns are significantly different in the three glucose ranges. In addition, accelerometer data have various measures, especially in the time domain, that show differences among the glycemic ranges. This provides support for the use of ECG and accelerometer data to predict hypoglycemia and hyperglycemia.

Table 3.

Electrocardiogram Features/ Statistics Across Hypoglycemia, Hyperglycemia, and Normal Ranges.

Variable Hypoglycemia Normal Hyperglycemia ANOVA
Mean STD Mean STD Mean STD F statistic P value
Heart rate 56.57 5.4 69.46 15.08 82.45 13.93 455.55 <.001
CVNN 0.07 0.056 0.1 0.09 0.08 0.09 28.01 <.001
PNNI_20 64.06 12.13 51.08 25.02 26.49 25.4 410.64 <.001
PNNI_50 35.35 17.26 26.89 23.03 12.43 19.37 175.08 <.001
HR_MAD 71.65 59.22 95.23 430.11 39.66 45.5 6.72 .001
CVSD 0.06 0.04 0.08 0.11 0.07 0.11 5.36 .004
SDNN 75.85 55.48 111.72 525.74 56.73 60.42 5.011 .006
SDSD 65.66 41.58 99.72 636.42 51.69 74.78 2.712 .06
RMSSD 65.09 41.22 105.81 738.74 51.39 74.34 2.66 .07

Abbreviations: ANOVA, analysis of variance; CVNN, coefficient of variation of NN intervals; CVSD, coefficient of variation of successive differences; HR MAD, mean absolute deviation of RR intervals; PNNI_20, proportion of successive differences over 20 ms; PNNI_50, proportion of successive differences over 50 ms; RMSSD, root mean square of successive differences; SDNN, standard deviation of NN intervals; SDSD, standard deviation of successive differences; STD, standard deviation. P values < 0.05 are bolded.

Table 4.

Accelerometer Features/ Statistics Across Hypoglycemia, Hyperglycemia, and Normal Ranges.

Category Variable Hypoglycemia Normal Hyperglycemia ANOVA
Mean STD Mean STD Mean STD F statistics P value
Time domain Mean 2051.83 49.2 2038.13 48.83 2049.04 47.06 15.54 <.001
Minimum 2038.35 50.8 2015.87 58.99 2029.16 55.86 28.85 <.001
Maximum 2062.35 51.8 2057.8 49.32 2066.19 49.91 7.62 <.001
STD 2.96 7.17 5.34 7.2 4.49 6.39 17.26 <.001
No. of peaks 1202.51 169.65 1142.96 191.92 1142.02 198.77 13.29 <.001
Kurtosis 13.48 21.46 7.51 16.53 13.14 107.05 12.02 <.001
IQR 3.89 12.72 6.26 11.3 5.44 9.81 9.61 <.001
Signal magnitude area 12.31 0.3 12.22 0.3 12.29 0.28 19.44 <.001
MAD 1.16 1.79 2.57 4.06 2.09 2.75 19.66 <.001
Skewness 0.02 1.29 0.06 1.06 0.11 1.27 0.7 .5
Frequency domain Maximum frequency 1.56 1.23 1.28 1.29 1.04 1.78 13.83 <.001
No. of peaks 33.3 2.6 33.03 2.7 33.34 2.52 3.82 .02
Mean 0.09 0.32 0.49 3.99 0.33 0.89 1.72 .18
Power 4.71 16.35 24.59 201.18 16.68 44.82 1.73 .18
STD 0.41 2.08 2.41 26.77 1.31 3.75 1.14 .32
Maximum 4.06 21.89 23 265.75 11.94 33.98 1.08 .33
Correlation pairs Vert_Lat 0.82 0.07 0.78 0.08 0.78 0.06 15.41 <.001
Vert_Sag 0.79 0.13 0.74 0.12 0.81 0.12 28.31 <.001
Lat_Sag 0.86 0.11 0.82 0.09 0.86 0.06 14.48 <.001

Abbreviations: ANOVA, analysis of variance; IQR, interquartile range; MAD, mean absolute deviation; STD, standard deviation; Vert, vertical; Lat, lateral; Sag, sagittal. P values less than 0.05 are bolded.

Machine Learning Methodologies

In the next step, we developed prediction models by combining data from all patients (population-level model). We explored two approaches to predict hypoglycemia and hyperglycemia: a classification model and a regression model.

The classification approach was based on random forests (RFs), an ensemble classifier that builds a large number of decision trees via bootstrapping. Bootstrapping is repeated sampling of the data with replacement. In the case of RFs, multiple decision trees are built based on subsets of the entire data set through bootstrapping. The final prediction is derived based on a majority voting scheme across individual predictions from all the decision trees. In this majority voting scheme, outputs from all decision trees in the forests are aggregated, and the most common prediction across all the trees is chosen. We selected the RF model owing to its performance in similar applications.6,10 In addition, the RF model provides a mechanism to identify significant features for prediction through the variable importance rankings as presented in the Results section.

The regression approach was based on quantile regression forests (QRFs), which are a generalization of RFs. Unlike RFs, which provide a single point estimate, QRFs provide a vector of estimates, one estimate for each quantile in the conditional distribution of the response variable. To illustrate, Figure 3 shows the spread of predicted values at different quantiles for three examples whose underlying glucose values were in the hypoglycemic, normal, and hyperglycemic ranges. As shown, quantile predictions when the underlying glucose is in the hypoglycemic range are lower than those in the normal range, which in turn are lower than those in the hyperglycemic range. Which of the quantile estimates is used for prediction depends on the application. For instance, if the goal is to minimize false negatives in hypoglycemia, then the prediction from a lower quantile should be selected.

Figure 3.

Figure 3.

Distribution of predictions per quantile for the quantile regression forest model (when trained with electrocardiogram data as input) when the ground-truth glucose level is in the hypoglycemic, normal, and hyperglycemic ranges.

Validation Mechanism

For validation purposes, we partitioned data from each patient into a training and a testing set using a fivefold cross-validation procedure. First, we ordered the data based on time stamps and divided it into five equal partitions for each patient. In each iteration, one partition of every patient was used for testing and four partitions were used for training. The process was repeated five times, with each of the five partitions of each patient serving as test data in each iteration. The predictions across the five iterations were combined to report the model performance results. This validation strategy ensured that the training and test sets were from nonoverlapping time windows to avoid temporal correlations in the data yielding overly optimistic prediction results.10,40

Results

For the classification model with fusion data (ECG + Accelerometer), a lookback period of five minutes with zero lag had the best performance on test data when area under curve (AUC) for hypoglycemia and hyperglycemia was averaged (Supplemental Appendix II). In contrast, for the regression model, a lookback period of ten minutes with zero lag gave the best performance for average AUC for hypoglycemia and hyperglycemia predictions (Supplemental Appendix III). From here on, fusion results reported in the article are based on this lag and lookback periods for fusion data (ECG + Accelerometer).

Performance of the Classifier Model (RF)

We built two classifiers, one that discriminated between hypoglycemia (positive class) and all other measurements (negative class), and another classifier that discriminated hyperglycemia (positive) class from all other measurements (negative). When using only ECG features, we obtain an AUC of 0.76 and 0.82 for hypoglycemic and hyperglycemic detection, respectively. Combining features from ECG and accelerometer improves the AUC by 2% for hypoglycemia prediction and by 1% for hyperglycemia. Receiver operation characteristic (ROC) curves for hypoglycemia and hyperglycemia predictions are shown in Figure 4. From these ROC curves, we selected the equal error rate (EER) point to report a single measure of sensitivity and specificity. Table 5 summarizes model performance using RFs. Adding accelerometer features had little effect for hypoglycemia detection but improves the sensitivity and specificity by 3% for hyperglycemia detection.

Figure 4.

Figure 4.

Receiver operation characteristic curves for (left) hypoglycemia and (right) hyperglycemia based on RF model. Abbreviations: AUC, area under curve; ECG, electrocardiogram; RF, random forest.

Table 5.

Classification Performance Using Random Forests.

Data Hypoglycemia Hyperglycemia
AUC Sensitivity Specificity AUC Sensitivity Specificity
ECG 0.76 0.69 0.69 0.82 0.74 0.74
Fusion 0.78 0.68 0.69 0.83 0.77 0.77

Abbreviations: AUC, area under curve; ECG, electrocardiogram.

Performance of the Regression Model (Quantile RF)

As noted earlier, QRFs provide a separate estimate of the glucose value for each quantile. To convert these quantile estimates into a label of hypoglycemia or hyperglycemia, we labeled each estimated glucose value as hypoglycemia if it was lower than 70 mg/dL and as hyperglycemia if it was greater than 180 mg/dL. Next, for each quantile, we computed the true positive rate (TPR) and false positive rate (FPR) on test data. Then, we generated an ROC curve by plotting the TPR against FPR for the different quantiles. Results are shown in Figure 5. As before, we selected the EER to report a unique value for sensitivity and specificity (Table 6). When using ECG data alone, the QRF model achieved 2% higher sensitivity and specificity than the RF classifier for both hypoglycemia and hyperglycemia detection. Furthermore, the QRF model based on fusion data outperformed the RF model based on fusion data by 8% (on sensitivity and specificity) for hypoglycemia and by 2% (on sensitivity and specificity) for hyperglycemia. When accelerometer data were added to the QRF model, we observed a 5% (for hypoglycemia) and 3% (for hyperglycemia) improvement in sensitivity and specificity (Table 6) as compared with using ECG data alone. These improvements can be explained by the fact that accelerometer data can be used to detect physical activity, and hence can be correlated with glucose changes. As an example, an increase in HR without corresponding physical activity can be indicative of a hyperglycemic event, whereas a decrease in HR with normal physical activity can be indicative of a hypoglycemic event. Hence, accelerometer data provide contextual information to help interpret the ECG data. The best model, the QRF model based on fused data, had sensitivity and specificity of 76% for hypoglycemia, and sensitivity and specificity of 79% for hyperglycemia.

Figure 5.

Figure 5.

Receiver operation characteristic curves for (left) hypoglycemia and (right) hyperglycemia based on QRF.

Abbreviations: AUC, area under curve; ECG, electrocardiogram; QRFs, quantile regression forests.

Table 6.

Classification Performance Using Quantile Random Forests.

Data Hypoglycemia Hyperglycemia
AUC Sensitivity Specificity AUC Sensitivity Specificity
ECG 0.79 0.71 0.71 0.82 0.76 0.76
Fusion 0.83 0.76 0.76 0.87 0.79 0.79

Abbreviations: AUC, area under curve; ECG, electrocardiogram.

Feature Importance

We examined the relative importance of the ECG and accelerometer features for predicting hyperglycemia and hypoglycemia. For this purpose, we used the RF model, which reports the importance of each feature based on reduction in model performance when a particular variable is excluded from a tree. In the case of ECG features, there are five-time lagged feature values (one for each minute in the previous five minutes) associated with a CGM value. The feature importance reported below is the average importance across the five-time lagged features. Similarly, for the accelerometer features, the average of importance in the lookback period of five minutes with zero lag is reported. Thus, both accelerometer feature importance and ECG feature importance are reported based on the average of five-time lagged features. For example, the importance score for the variable “Mean HR” is the average of importance scores for variable “Mean HR” that were one, two, three, four, and five minutes preceding the CGM reading.

Results for hypoglycemia are shown in Figure 6. There is clear evidence of accelerometer features such as the pairwise correlation pairs between three axis, kurtosis, and area to be among those highly ranked for hypoglycemia prediction. Results for hyperglycemia are shown in Figure 7. In this case, ECG features appear to be more dominant than accelerometer features.

Figure 6.

Figure 6.

Feature importance for random forests trained to predict hypoglycemia. Abbreviations: CVNN, coefficient of variation of NN intervals; CVSD, coefficient of variation of successive differences; HR, heart rate; HR MAD, mean absolute deviation of RR intervals; IQR, interquartile range; MAD, mean absolute deviation; PNNI 20, proportion of successive differences over 20 ms; PNNI 50, proportion of successive differences over 50 ms; RMSSD, root mean square of successive differences; SDNN, standard deviation of NN intervals; SDSD, standard deviation of successive differences; STD, standard deviation.

Figure 7.

Figure 7.

Feature importance for random forests trained to predict hyperglycemia. Abbreviations: CVNN, coefficient of variation of NN intervals; CVSD, coefficient of variation of successive differences; HR, heart rate; HR MAD, mean absolute deviation of RR intervals; IQR, interquartile range; MAD, mean absolute deviation; PNNI 20, proportion of successive differences over 20 ms; PNNI 50, proportion of successive differences over 50 ms; RMSSD, root mean square of successive differences; SDNN, standard deviation of NN intervals; SDSD, standard deviation of successive differences; STD, standard deviation.

Discussion

Insights and Observations

The feature importance plots (Figures 6 and 7) validate the importance of ECG data for detecting hypoglycemia and hyperglycemia, in agreement with the summary statistics and ANOVA tests in Tables 3 and 4. Together, these findings indicate that ECG features can be used to detect glycemic excursions, and that accelerometer data provide additional information41,42 that improves predictions.

Our results show that QRF moderately outperforms RF when predicting both hypoglycemia and hyperglycemia. To illustrate this point, Figure 8 shows the ROC curves for the two types of classifiers (QRF, RF), feature sets (ECG, ECG + accelerometer), and prediction problems (hypoglycemia, hyperglycemia). For hypoglycemia prediction, the ROC curves indicate that the addition of accelerometer data as well as the choice of classifier is the contributing factor to higher performance. In contrast, for hyperglycemia prediction, it appears that the feature set (ECG + accelerometer), rather than the choice of classifier, is needed to improve performance.

Figure 8.

Figure 8.

Receiver operation characteristic curves with ECG and ECG + accelerometer for the RF and QRF models. (Left) Hypoglycemia prediction. (Right) Hyperglycemia prediction.

Abbreviations: AUC, area under curve; ECG, electrocardiogram; QRFs, quantile regression forests; RF, random forest.

The main contributions of our work to address the challenges for noninvasive detection of glucose levels can be summarized as follows:

  1. Detection of glucose levels in hypoglycemic and hyperglycemic ranges.

  2. Use of accelerometer data to supplement ECG data to improve prediction performance.

Comparison With Previous Studies

Finally, we provide a comparison of previous work for noninvasive prediction of glucose levels. For this purpose, we considered studies that reported results for hypoglycemia and hyperglycemia prediction. Results are summarized in Table 7. Electrocardiogram is the most widely used physiological signal. Other approaches include electroencephalogram, PPG, and galvanic skin responses. However, results based on data streams other than ECG have not been promising. 43 Recently, in 2018 and 2020, a data set was made publicly available through the Blood Glucose Level Prediction challenge at Ohio University, 44 which examined a variety of machine learning models to predict future glucose levels by analyzing the recent history of CGM readings. In addition to CGM recordings, the OhioT1DM data set includes physiological data such as heart rate, skin temperature, and activity-related data. However, no improvement in predicting glucose levels, and in some cases degradations in prediction performance, has been reported when combining physiological features and CGM history.45-50 A possible reason for this result is that physiological data in the OhioT1DM data set are aggregated (every one to five minutes) and hence it is not possible to extract the granular features we used in our study.

Table 7.

Comparison of Previous Works on Noninvasive Detection of Blood Glucose Levels.

Article Year Data streams used No. of patients in the study Data collection Validation approach Hypoglycemia Hyperglycemia
Sensitivity Specificity Sensitivity Specificity
Genetic-Algorithm-Based Multiple Regression With Fuzzy Inference System for Detection of Nocturnal Hypoglycemic Episodes 2011 ECG 16 Free-living (only nocturnal hypoglycemia) Patient-based 80 38
Detection of Hypoglycemia-Associated EEG Changes During Sleep in Type 1 Diabetes Mellitus 2012 EEG 8 Controlled setting Random splitting 70 70
Combining Genetic Algorithm and Levenberg-Marquardt Algorithm in Training Neural Network for Hypoglycemia Detection Using EEG Signals 2013 EEG 5 Free-living (only nocturnal hypoglycemia) Patient-based 75 60
Noninvasive Hypoglycemia Monitoring System Using Extreme Learning Machine for Type 1 diabetes 2016 ECG 16 Controlled Setting Patient-based 78 60
Deep Learning Framework for detection of Hypoglycemic Episodes in Children With Type 1 Diabetes 2016 ECG 15 Free-living (only nocturnal hypoglycemia) Patient-based 80 50
Analyzing Breath Samples of Hypoglycemic Events in Type 1 Diabetes Patients: Toward Developing an Alternative to Diabetes Alert Dogs 2017 Breathing components 52 Controlled setting Random splitting 91 84
Occipital EEG Activity for the Detection of Nocturnal Hypoglycemia 2018 EEG 8 Free-living (only nocturnal hypoglycemia) Random splitting 73 60
A Multiparameter Model for NonInvasive Detection of Hypoglycemia 2019 ECG, skin conductance, NIR, bio-impedance 20 Controlled setting Random splitting 95
A Moninvasive Blood Glucose Monitoring System Based on Smartphone PPG Signal Processing and Machine Learning 2020 PPG 80 Controlled setting Patient-based 80 83
Precision medicine 2020 ECG 8 Free-living Random splitting 84 84
Electroencephalogram Spectral Moments for the Detection of Nocturnal Hypoglycemia 2020 EEG 8 Free-living (only nocturnal hypoglycemia) Time-based 85 52
NonInvasive Monitoring of Three Glucose Ranges Based on ECG by Using DBSCAN-CNN 2021 ECG 21 Controlled setting Random splitting 88 86

Abbreviations: ECG, electrocardiogram; EEG, electroencephalogram; NIR, near-infrared; PPG, photoplethysmography.

To the best of our knowledge, a recent study 13 is the only publication that used noninvasive ECG data to detect both hypoglycemia and hyperglycemia. They reported that ECG data are able to classify glucose levels in the hypoglycemia, hyperglycemia, and normal ranges. Comparing predictive performance across different studies in the literature is difficult due to differences in the data collected, prediction focus, metrics used, and validation methods. A critical aspect when developing robust machine learning models is choosing an appropriate validation approach. Some prior studies have shown high levels of accuracy (both sensitivity and specificity) using a cross-validation based on random splitting.51,52 Although this is a standard approach in machine learning, such a validation scheme may not be appropriate for this application because of temporal correlations in the data. We believe that the time-based validations we used in our study provide more realistic estimates of performance when the approach is deployed in the field.10,40

Limitations

One limitation of our work is the limited data sample size. Our data set consisted of recordings for five participants over a period of 14 days, and the records only included 14 hypoglycemic episodes and 25 hyperglycemic episodes. To address this limitation, we carefully designed the training/test set splitting criteria to avoid obtaining overly optimistic results. Namely, instead of splitting measurements randomly, which can lead to inflated results due to short-term temporal correlations in the data, we adopted a time-based splitting criterion where data in the training and test sets were from entirely different time periods. This ensured that the results are an accurate characterization of the performance that could be expected when the model is evaluated on new time periods for the existing subjects. To address the data availability issue, we are currently conducting a study to collect CGM and physiological data for 50 participants with type 1 diabetes. This new data set will provide measures from noninvasive wearable devices and include data streams, namely, ECG, respiration, PPG, electrodermal activity, accelerometer, skin temperature, and heart rate. This will allow us to examine whether other physiological modalities beyond ECG and accelerometer data, such as skin temperature and electrodermal activity, can further improve predictions. In this larger data set, it is possible to use more restrictive splitting criteria, such as a leave-one-subject-out procedure. Also, the current study is based on data collected from healthy participants and it is assumed that the results are transferable to population with diabetes.

Conclusion

In this article, we proposed a noninvasive approach to detect glycemic excursions (hypoglycemia and hyperglycemia) from ECG and accelerometer data. We evaluated an RF classifier and a QRF regression model. For both approaches, models with fusion data (ECG and accelerometer) outperform models based on ECG data alone. The QRF model based on fusion data had a sensitivity and specificity of 76% for detecting hypoglycemia. This outperformed the RF model on fusion data by 8%. For hyperglycemic prediction, QRF with fusion data had a sensitivity and specificity of 79%, which outperformed the RF model by 2%. These results indicate that not only hypoglycemia but also hyperglycemia can be effectively detected from noninvasive physiological signals. This finding has important clinical implications for diabetes monitoring and management without the need for CGM devices. The results also show that contextual information from the accelerometer provides additional information for predicting glucose excursions.

Supplemental Material

sj-docx-1-dst-10.1177_19322968221116393 – Supplemental material for Detection of Hypoglycemia and Hyperglycemia Using Noninvasive Wearable Sensors: Electrocardiograms and Accelerometry

Supplemental material, sj-docx-1-dst-10.1177_19322968221116393 for Detection of Hypoglycemia and Hyperglycemia Using Noninvasive Wearable Sensors: Electrocardiograms and Accelerometry by Darpit Dave, Kathan Vyas, Kimberly Branan, Siripoom McKay, Daniel J. DeSalvo, Ricardo Gutierrez-Osuna, Gerard L. Cote and Madhav Erraguntla in Journal of Diabetes Science and Technology

Acknowledgments

This study involves the use of secondary analysis of de-identified data that were not collected specifically for this project and is not human subject research. The views expressed here are those of the authors. This study would not have been possible without the kind assistance from Professors Leandro Pecchia and Salman Haleem from The University of Warwick (UK), who granted us access to the CGM and physiological data set from the original study.

Footnotes

Abbreviations: ANOVA, analysis of variance; AUC, area under curve; CGM, continuous glucose monitoring; CWT, continuous wavelet transform; ECG, electrocardiogram; EER, equal error rate; FPR, false positive rate; GSR, galvanic skin response; HR, heart rate; HRV, heart rate variability; NIR, near-infrared; PPG, photoplethysmography; QRFs, quantile regression forests; RFs, random forests; ROC, receiver operation characteristic; TPR, true positive rate; VIP, variable importance plot.

The author(s) declared the following potential conflicts of interest with respect to the research, authorship, and/or publication of this article: D.J.D. serves as an independent consultant for Dexcom separate from the present work. The remaining authors have no potential conflict of interests relevant to this article.

Funding: The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by NSF award 2037383 (SenSE: Multimodal noninvasive wearable sensors and machine learning for predicting critical glycemic events).

Supplemental Material: Supplemental material for this article is available online.

References

  • 1. Ahuja R, Dixit P, Banga A, Sharma SC. Classification algorithms for predicting diabetes mellitus: a comparative analysis. In: Husain MS, Adnan MHBM, Khan MZ, Shukla S, Khan FU, eds. Pervasive Healthcare: A Compendium of Critical Factors for Success. Cham: Springer International Publishing; 2022:233-253. [Google Scholar]
  • 2. Centers for Disease Control and Prevention. Type 2 Diabetes. 2021. https://www.cdc.gov/diabetes/basics/type2.html. Accessed January 24, 2022.
  • 3. Battelino T, Danne T, Bergenstal RM, et al. Clinical targets for continuous glucose monitoring data interpretation: recommendations from the international consensus on time in range. Diabetes Care. 2019;42(8):1593-1603. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4. Mariani HS, Layden BT, Aleppo G. Continuous glucose monitoring: a perspective on its past, present, and future applications for diabetes management. Clin Diabetes. 2017;35(1):60-65. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5. American Diabetes Association. Hypoglycemia (Low Blood Glucose). diabetes.org. American Diabetes Association; 2022. https://www.diabetes.org/healthy-living/medication-treatments/blood-glucose-testing-and-control/hypoglycemia. Accessed June 25, 2022. [Google Scholar]
  • 6. Dave D, DeSalvo DJ, Haridas B, et al. Feature-based machine learning model for real-time hypoglycemia prediction. J Diabetes Sci Technol. 2021;15(4):842-855. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7. Qaraqe M, Erraguntla M, Dave D. AI and machine learning in diabetes management: opportunity, status, and challenges. In: Househ M, Borycki E, Kushniruk A, eds. Multiple Perspectives on Artificial Intelligence in Healthcare: Opportunities and Challenges. Cham: Springer International Publishing; 2021:129-141. [Google Scholar]
  • 8. Beck RW, Bergenstal RM, Riddlesworth TD, et al. Validation of time in range as an outcome measure for diabetes clinical trials. Diabetes Care. 2019;42(3):400-405. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9. Rodbard D. Continuous glucose monitoring: a review of recent studies demonstrating improved glycemic outcomes. Diabetes Technol Ther. 2017;19(S3):S25-S37. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10. Dave D, Erraguntla M, Lawley M, et al. Improved low-glucose predictive alerts based on sustained hypoglycemia: model development and validation study. JMIR Diabetes. 2021;6(2):e26909. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11. Villena Gonzales W, Mobashsher AT, Abbosh A. The progress of glucose monitoring—a review of invasive to minimally and non-invasive techniques, devices and sensors. Sensors. 2019;19(4):800. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12. Jain P, Joshi AM, Mohanty S. Everything you wanted to know about noninvasive glucose measurement and control. arXiv. 2021: arXiv:2101.08996. doi: 10.48550/arXiv.2101.08996. [DOI] [Google Scholar]
  • 13. Li J, Tobore I, Liu Y, Kandwal A, Wang L, Nie Z. Non-invasive monitoring of three glucose ranges based on ECG by using DBSCAN-CNN. IEEE J Biomed Health Inform. 2021;25(9):3340-3350. [DOI] [PubMed] [Google Scholar]
  • 14. Schroeder EB, Chambless LE, Liao D, et al. Diabetes, glucose, insulin, and heart rate variability: the Atherosclerosis Risk in Communities (ARIC) study. Diabetes Care. 2005;28(3):668-674. [DOI] [PubMed] [Google Scholar]
  • 15. Singh JP, Larson MG, O’Donnell CJ, et al. Association of hyperglycemia with reduced heart rate variability (The Framingham Heart Study). Am J Cardiol. 2000;86(3):309-312. [DOI] [PubMed] [Google Scholar]
  • 16. Valensi P, Extramiana F, Lange C, et al. Influence of blood glucose on heart rate and cardiac autonomic function. Diabet Med. 2011;28(4):440-449. [DOI] [PubMed] [Google Scholar]
  • 17. Ling SH, San PP, Lam HK, Nguyen HT. Hypoglycemia detection: multiple regression-based combinational neural logic approach. Soft Comput. 2017;21(2):543-553. [Google Scholar]
  • 18. Ling SH, San PP, Nguyen HT. Non-invasive hypoglycemia monitoring system using extreme learning machine for type 1 diabetes. ISA Trans. 2016;64:440-446. [DOI] [PubMed] [Google Scholar]
  • 19. Ling SS, Nguyen HT. Genetic-algorithm-based multiple regression with fuzzy inference system for detection of nocturnal hypoglycemic episodes. IEEE Trans Inf Technol Biomed. 2011;15(2):308-315. [DOI] [PubMed] [Google Scholar]
  • 20. Lipponen JA, Kemppainen J, Karjalainen PA, et al. Hypoglycemia detection based on cardiac repolarization features. In: 2011 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Boston, MA, USA. IEEE; 2011. [DOI] [PubMed] [Google Scholar]
  • 21. Porumb M, Stranges S, Pescapè A, Pecchia L. Precision medicine and artificial intelligence: a pilot study on deep learning for hypoglycemic events detection based on ECG. Sci Rep. 2020;10(1):1-16. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22. Cichosz SL, Frystyk J, Hejlesen OK, Tarnow L, Fleischer J. A novel algorithm for prediction and detection of hypoglycemia based on continuous glucose monitoring and heart rate variability in patients with type 1 diabetes. J Diabetes Sci Technol. 2014;8(4):731-737. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23. Gonzalez K, Sasangohar F, Mehta RK, Lawley M, Erraguntla M. Measuring fatigue through heart rate variability and activity recognition: a scoping literature review of machine learning techniques. In: Proceedings of the Human Factors and Ergonomics Society Annual Meeting. Los Angeles, CA: SAGE Publications; 2017. [Google Scholar]
  • 24. Gabbay MAL, Rodacki M, Calliari LE, et al. Time in range: a new parameter to evaluate blood glucose control in patients with diabetes. Diabetol Metab Syndr. 2020;12:22-28. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25. Yang M, Dave D, Erraguntla M, Cote GL, Gutierrez-Osuna R. Joint hypoglycemia prediction and glucose forecasting via deep multi-task learning. In: ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Singapore. IEEE; 2022. [Google Scholar]
  • 26. Abbas HT, Alic L, Erraguntla M, et al. Predicting long-term type 2 diabetes with support vector machine using oral glucose tolerance test. PLoS One. 2019;14(12):e0219636. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27. Moser O, Riddell MC, Eckstein ML, et al. Glucose management for exercise using continuous glucose monitoring (CGM) and intermittently scanned CGM (isCGM) systems in type 1 diabetes: position statement of the European Association for the Study of Diabetes (EASD) and of the International Society for Pediatric and Adolescent Diabetes (ISPAD) endorsed by JDRF and supported by the American Diabetes Association (ADA). Diabetologia. 2020;63(12):2501-2520. [DOI] [PubMed] [Google Scholar]
  • 28. Hosseinian SM, Zhu Y, Mehta RK, Erraguntla M, Lawley MA. Static and dynamic work activity classification from a single accelerometer: implications for ergonomic assessment of manual handling tasks. IISE Trans Occup Ergon Hum Factors. 2019;7(1):59-68. [Google Scholar]
  • 29. Zhu Y, Mehta RK, Erraguntla M, Sasangohar F, Qaraqe K. Quantifying accelerometer-based tremor features of neuromuscular fatigue in healthy and diabetic adults. IEEE Sens J. 2020;20(19):11183-11190. [Google Scholar]
  • 30. Aljihmani L, Kerdjidj O, Petrovski G, et al. Hand tremor-based hypoglycemia detection and prediction in adolescents with type 1 diabetes. Biomed Signal Process Control. 2022;78:103869. [Google Scholar]
  • 31. Aljihmani L, Kerdjidj O, Zhu Y, et al. Classification of fatigue phases in healthy and diabetic adults using wearable sensor. Sensors. 2020;20(23):6897. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32. Technology ZPSPM. ZephyrTM Performance Systems, Performance Monitoring Technology. Secondary ZephyrTM Performance Systems, Performance Monitoring Technology 2022. https://www.zephyranywhere.com/. Accessed July 19, 2022.
  • 33. Blum A. FreeStyle Libre Glucose Monitoring System. Clin Diabetes. 2018;36(2):203-204. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34. Ding H, Sarela A, Helmer R, Mestrovic M, Karunanithi M. Evaluation of ambulatory ECG sensors for a clinical trial on outpatient cardiac rehabilitation. In: IEEE/ICME International Conference on Complex Medical Engineering, Gold Coast, Australia. IEEE; 2010. [Google Scholar]
  • 35. Kim J-H, Roberge R, Powell J, Shafer A, Williams WJ. Measurement accuracy of heart rate and respiratory rate during graded exercise and sustained exercise in the heat using the Zephyr BioHarnessTM. Int J Sports Med. 2013;34(06):497-501. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36. Nathan V, Akkaya I, Jafari R. A particle filter framework for the estimation of heart rate from ECG signals corrupted by motion artifacts. In: 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Milan, Italy. IEEE; 2015. [DOI] [PubMed] [Google Scholar]
  • 37. Nathan V, Jafari R. Particle filtering and sensor fusion for robust heart rate monitoring using wearable sensors. IEEE J Biomed Health Inform. 2017;22(6):1834-1846. [DOI] [PubMed] [Google Scholar]
  • 38. Makowski D, Pham T, Lau ZJ, et al. NeuroKit2: a Python toolbox for neurophysiological signal processing. Behav Res Methods. 2021;53(4):1689-1696. [DOI] [PubMed] [Google Scholar]
  • 39. Zaharieva DP, Turksoy K, McGaugh SM, et al. Lag time remains with newer real-time continuous glucose monitoring technology during aerobic exercise in adults living with type 1 diabetes. Diabetes Technol Ther. 2019;21(6):313-321. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40. Roberts DR, Bahn V, Ciuti S, et al. Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography. 2017;40(8):913-929. [Google Scholar]
  • 41. Aminian K, Robert P, Buchser EE, Rutschmann B, Hayoz D, Depairon M. Physical activity monitoring based on accelerometry: validation and comparison with video observation. Med Biol Eng Comput. 1999;37(3):304-308. [DOI] [PubMed] [Google Scholar]
  • 42. Long X, Yin B, Aarts RM. Single-accelerometer-based daily physical activity classification. In: 2009 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Minneapolis, MN, USA. IEEE; 2009. [DOI] [PubMed] [Google Scholar]
  • 43. Diouri O, Cigler M, Vettoretti M, et al. Hypoglycaemia detection and prediction techniques: a systematic review on the latest developments. Diabetes Metab Res Rev. 2021;37(7):e3449. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 44. Marling C, Bunescu R. The OhioT1DM dataset for blood glucose level prediction: Update 2020. In CEUR workshop proceedings (Vol. 2675, p. 71). NIH Public Access; 2020. [PMC free article] [PubMed] [Google Scholar]
  • 45. Gadaleta M, Facchinetti A, Grisan E, Rossi M. Prediction of adverse glycemic events from continuous glucose monitoring signal. IEEE J Biomed Health Inform. 2018;23(2):650-659. [DOI] [PubMed] [Google Scholar]
  • 46. Mirshekarian S, Shen H, Bunescu R, Marling C. LSTMs and neural attention models for blood glucose prediction: comparative experiments on real and synthetic data. In: 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Berlin, Germany. IEEE; 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 47. Oviedo S, Vehí J, Calm R, Armengol J. A review of personalized blood glucose prediction strategies for T1DM patients. Int J Numer Method Biomed Eng. 2017;33(6):e2833. [DOI] [PubMed] [Google Scholar]
  • 48. Xie J, Wang Q. Benchmarking machine learning algorithms on blood glucose prediction for type I diabetes in comparison with classical time-series models. IEEE Trans Biomed Eng. 2020;67(11):3101-3124. [DOI] [PubMed] [Google Scholar]
  • 49. Yang J, Li L, Shi Y, Xie X. An ARIMA model with adaptive orders for predicting blood glucose concentrations and hypoglycemia. IEEE J Biomed Health Inform. 2018;23(3):1251-1260. [DOI] [PubMed] [Google Scholar]
  • 50. Zecchin C, Facchinetti A, Sparacino G, Cobelli C. How much is short-term glucose prediction in type 1 diabetes improved by adding insulin delivery and meal content information to CGM data? A proof-of-concept study. J Diabetes Sci Technol. 2016;10(5):1149-1160. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 51. Cichosz SL, Kronborg T, Jensen MH, Hejlesen O. Penalty weighted glucose prediction models could lead to better clinically usage. Comput Biol Med. 2021;138:104865. [DOI] [PubMed] [Google Scholar]
  • 52. Rashtian H, Torbaghan SS, Rahili S, Snyder M, Aghaeepour N. Heart rate and CGM feature representation diabetes detection from heart rate: learning joint features of heart rate and continuous glucose monitors yields better representations. In: IEEE Access. IEEE; 2021. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

sj-docx-1-dst-10.1177_19322968221116393 – Supplemental material for Detection of Hypoglycemia and Hyperglycemia Using Noninvasive Wearable Sensors: Electrocardiograms and Accelerometry

Supplemental material, sj-docx-1-dst-10.1177_19322968221116393 for Detection of Hypoglycemia and Hyperglycemia Using Noninvasive Wearable Sensors: Electrocardiograms and Accelerometry by Darpit Dave, Kathan Vyas, Kimberly Branan, Siripoom McKay, Daniel J. DeSalvo, Ricardo Gutierrez-Osuna, Gerard L. Cote and Madhav Erraguntla in Journal of Diabetes Science and Technology


Articles from Journal of Diabetes Science and Technology are provided here courtesy of Diabetes Technology Society

RESOURCES