Development of an interpretable machine learning model and web application for peri-colonoscopy hypoglycemia risk in hospitalized patients undergoing colonoscopy.

To develop and externally validate a liquid neural network (LNN)-based model for predicting peri-procedural hypoglycemia in hospitalized patients undergoing colonoscopy, and to develop a cross-platform web application integrating real-time SHAP-based interpretability analysis.

A total of 719 hospitalized patients undergoing colonoscopy were retrospectively enrolled from Changshu No.1 People's Hospital and Changshu Traditional Chinese Medicine Hospital between January and December 2025, with peri-procedural hypoglycemia as the outcome and 28 candidate variables. Internal validation was performed using stratified five-fold cross-validation combined with out-of-fold (OOF) prediction, and LASSO feature selection and SMOTE class balancing were carried out within the training folds. Logistic regression (LR), decision tree (DCT), random forest (RF), extreme gradient boosting (XGBoost), and LNN models were constructed, and model performance was evaluated in terms of discrimination, calibration, and clinical utility; SHAP was used for global and individualized interpretation, and a web application was developed using Python-Streamlit.

The incidence of peri-procedural hypoglycemia was 15.2%. LASSO selected seven features: bowel preparation solution volume, sex, fasting duration, nutritional risk, insulin use, history of diabetes mellitus, and albumin. After SMOTE, the internal-validation AUCs in descending order were LNN 0.851 (95% CI: 0.804-0.893), RF 0.831, XGBoost 0.829, LR 0.765, and DCT 0.750; LNN simultaneously showed the best sensitivity-specificity balance (76.83%/85.50%) and the lowest Brier score (0.116), and decision curve analysis showed the highest net benefit across the 0.05-0.55 threshold range. The LNN-based web application achieved an AUC of 0.848 (95% CI: 0.758-0.921) in the external validation set of 168 patients, with a sensitivity of 74.07%, a specificity of 86.52%, and a negative predictive value of 94.57%; SHAP analysis identified nutritional risk (mean |SHAP| = 0.689), albumin (0.480), and sex (0.431) as the principal predictors.

The LNN-based model can effectively assess the risk of peri-procedural hypoglycemia in hospitalized patients undergoing colonoscopy and maintained good predictive performance in external validation; the web application integrating real-time SHAP interpretation provides convenient, interpretable, individualized risk assessment, offering support for early screening and intervention decision-making. A publicly accessible demonstration of the web application is available at https://ml-model-for-hypoglycemia.streamlit.app/.
Diabetes
Access
Care/Management
Advocacy

Authors

Xu Xu, Zhao Zhao, Wang Wang, Xia Xia, Ding Ding, Chen Chen
View on Pubmed
Share
Facebook
X (Twitter)
Bluesky
Linkedin
Copy to clipboard