American Diabetes Association
DC_Supplementary_material_R_clean.docx (1.64 MB)

Predicting the risk of inpatient hypoglycemia with machine learning using electronic health records

Download (1.64 MB)
posted on 2020-04-29, 20:45 authored by Yue Ruan, Alexis Bellot, Zuzana Moysova, Garry D. Tan, Alistair Lumb, Jim Davies, Mihaela Van Der Schaar, Rustam Rea

We analyzed data from inpatients with diabetes admitted to a large university hospital to predict the risk of hypoglycemia through the use of machine learning algorithms.

Research Design and Methods

Four years of data was extracted from a hospital electronic health record system. This included laboratory and point-of-care blood glucose (BG) values to identify biochemical and clinically significant hypoglycaemic episodes (BG < 3.9 and < 2.9mmol/L respectively). We used patient demographics, administered medications, vital signs, laboratory results and procedures performed during the hospital stays to inform the model. Two iterations of the dataset included the doses of insulin administered and the past history of inpatient hypoglycaemia. Eighteen different prediction models were compared using the area under curve of the receiver operating characteristics (AUC_ROC) through a ten-fold cross validation.


We analyzed data obtained from 17,658 inpatients with diabetes who underwent 32,758 admissions between July 2014 and August 2018. The predictive factors from the logistic regression model included people undergoing procedures, weight, type of diabetes, oxygen saturation level, use of medications (insulin, sulfonylurea, metformin) and albumin levels. The machine learning model with the best performance was the XGBoost model (AUC_ROC 0.96. This outperformed the logistic regression model which had an AUC_ROC of 0.75 for the estimation of the risk of clinically significant hypoglycaemia.


Advanced machine learning models are superior to logistic regression models in predicting the risk of hypoglycemia in inpatients with diabetes. Trials of such models should be conducted in real time to evaluate their utility to reduce inpatient hypoglycaemia.


YR salary was funded by Novo Nordisk Postdoctoral Fellowship run in partnership with the University of Oxford. RR, JD, GT, AL are partly funded by the National Institute for Health Research (NIHR) Oxford Biomedical Research Centre (BRC).


Usage metrics

    Diabetes Care


    Ref. manager