Endoscopic retrograde cholangiopancreatography (ERCP) is the main therapeutic procedure for managing pancreaticobiliary disorders. However, post-ERCP pancreatitis (PEP) is the most common and serious complication of this procedure, occurring in 3.5–9.7% of patients. Early identification of patients at high risk for PEP allows the implementation of preventive strategies. Recognizing low-risk individuals also helps avoid unnecessary interventions, imaging, and hospitalizations. This leads to a more efficient use of healthcare resources.
We developed and externally validated a predictive model for PEP using advanced machine learning algorithms. In this multicenter study, data from 1,026 patients undergoing ERCP at three tertiary centers in Gorgan between July 2017 and May 2024 were analyzed. A comprehensive set of predictors, grouped into five domains including patient characteristics, laboratory factors, comorbidities, ERCP indications, and procedural factors was collected. The major papilla morphology was determined by the endoscopist prior to cannulation, using a standardized classification system, and was included as a key anatomical predictor in the model. A series of machine learning algorithms were developed and evaluated on an independent external test set.
The extreme gradient boosting model achieved strong generalizability with an accuracy of 0.91, specificity of 0.93, and AUC of 0.91. Difficult cannulation, inadvertent pancreatic duct cannulation, precut sphincterotomy, younger age, female sex, and papillary morphology were identified as the key predictors. Papilla morphology types II (small or flat, diameter <3 mm), IIIb (multiple hanging hooding folds), and IV (folded/protruded) were highly associated with an increased risk of PEP, whereas type D (associated with periampullary diverticulum) appeared to be a protective factor.
The machine learning-based PEP risk prediction model demonstrated robust generalizability using routinely available pre- and intra-procedural variables. It may serve as a decision-support tool for risk stratification and prevention of PEP, highlighting the need to bridge clinical and artificial intelligence research.