Identifying high-risk patients having ERCP as a day surgery with an online prediction platform: Multicohort validation of a machine learning model

Boru Jin, Yi Wang, Xu Zhang, Jinyu Zhao, Wangping He, Kecheng Jin, Zhen Liu, Ruyang Zhong, Yuhu Ma, Chunlu Dong, Yanyan Lin, Xiaoliang Zhu, Kexiang Zhu, Lei Zhang, Ping Yue, Shuyan Li, Jinqiu Yuan, Xun Li, Wenbo MengEndoscopy 2025 · DOI

Abstract

The results indicate that the proposed LR model, utilizing the top seven risk factors, could serve as an effective tool for predicting occurrence of complications in day surgery.

Introduction

Endoscopic Retrograde Cholangiopancreatography (ERCP) is a standard, minimally invasive procedure for treating common bile duct stones (CBDs). Despite its efficacy, ERCP is technically demanding and associated with potential 24-hour complications, including post-ERCP pancreatitis (PEP), cholangitis, and hemorrhage. As healthcare systems transition toward "day surgery" models—where patients are discharged within 24 hours—the ability to accurately identify patients at high risk for these complications becomes critical for patient safety. This study presents a multicohort-validated prediction platform designed to assist clinicians in triaging ERCP patients for safe discharge or extended observation.

Methods and Study Design

The researchers evaluated several machine learning (ML) architectures, including K-Nearest Neighbors (KNN), Support Vector Machines (SVM), Naïve Bayes (NB), Random Forest (RF), and Extreme Gradient Boosting (XGBoost), alongside traditional Logistic Regression (LR). To address the inherent class imbalance of rare complications, the team employed Adaptive Synthetic Sampling (ADASYN).

Starting with 42 clinical variables, feature selection was performed using five ranking methods (e.g., SHAP values and Boruta) to identify the most significant predictors. The study utilized a large dataset from China, beginning with a primary cohort of 2,167 patients from The First Hospital of Lanzhou University. After applying exclusion criteria, 1,667 patients remained for the training cohort. The model was further validated using two external cohorts: one retrospective set of 1,472 patients and a second set of 199 patients to ensure temporal stability.

Study flow diagram showing patient inclusion, exclusion criteria, and cohort distribution.

Key Results and Insights

While complex models like Random Forest performed well during internal training, the Logistic Regression (LR) model demonstrated superior robustness and generalizability during external validation. This "simplicity advantage" suggests that the LR model is more portable across different clinical environments.

The final model identified seven key risk factors: mechanical lithotripsy, pancreatic duct cannulation, common bile duct dilation, residual stones, white blood cell (WBC) count, alanine aminotransferase (ALT) levels, and pancreatic duct stent placement. Notably, pancreatic duct stenting was identified as a significant protective factor (OR 0.44), reducing the likelihood of complications.

Predictive performance and risk factor analysis, including odds ratios (a), ROC curves (b), and LASSO selection plots (c, d).

In the primary external validation set, the LR model achieved an Area Under the Curve (AUC) of 0.819. The second validation set confirmed this reliability with an AUC of 0.805. Based on these results, patients can be stratified into high-risk (≥35% predicted risk) and low-risk (<35%) groups. To facilitate clinical use, the authors developed a web-based online calculator that provides immediate risk probabilities.

Conclusion and Limitations

This study provides a validated, easy-to-use tool for managing ERCP day surgery patients. However, some limitations remain. The model is currently specific to patients with common bile duct stones and excludes those with malignancies or complex surgical histories. Additionally, as the data is primarily from Chinese cohorts, further validation in diverse global populations is necessary. Future work may focus on developing "pre-procedure only" models to assist in resource allocation even before the surgery begins.

Summary updated

Abstract

The results indicate that the proposed LR model, utilizing the top seven risk factors, could serve as an effective tool for predicting occurrence of complications in day surgery.
BibTeX
@inproceedings{jin2025identifying,
  author = {Boru Jin and Yi Wang and Xu Zhang and Jinyu Zhao and Wangping He and Kecheng Jin and Zhen Liu and Ruyang Zhong and Yuhu Ma and Chunlu Dong and Yanyan Lin and Xiaoliang Zhu and Kexiang Zhu and Lei Zhang and Ping Yue and Shuyan Li and Jinqiu Yuan and Xun Li and Wenbo Meng},
  title = {{Identifying high-risk patients having ERCP as a day surgery with an online prediction platform: Multicohort validation of a machine learning model}},
  booktitle = {Endoscopy},
  year = {2025},
  doi = {10.1055/a-2733-1387},
}
Figure