Introduction

With the continuous rise in global obesity rates, it is projected that by 2025, 18% of men and 21% of women worldwide will be affected by obesity1. Bariatric surgery has been proven to achieve significant, sustained weight loss, improve various obesity-related complications, and significantly reduce mortality while increasing life expectancy2,3. The safety of bariatric surgery has been significantly enhanced due to improvements in surgical protocols and the widespread adoption of laparoscopic techniques. However, despite the significant clinical success of bariatric surgery, readmission within 30 days of surgery remains a critical issue. Previous studies have shown that all-cause readmission rates within 30 days of bariatric surgery range from 3.3% to 9.0%4,5,6,7,8. Patients who are readmitted generally experience longer hospital stays, higher mortality rates, and increased medical costs5,6,9.

With the rapid development of machine learning technologies in the medical field, an increasing number of studies are using these technologies to predict complications after bariatric surgery, such as postoperative gastrointestinal bleeding, leaks, and venous thromboembolism10,11. The occurrence of these complications is closely related to readmission within 30 days post-operation12. Specific laboratory tests have been identified as predictors of early postoperative complications. Preoperative serum albumin levels are associated with severe complications, readmissions, and mortality rates after bariatric surgery13. Elevated postoperative levels of C-reactive protein and procalcitonin are indicators of increased risk for septic complications and postoperative suture leakage14,15,16. Nevertheless, there are currently no studies predicting the 30-day readmission rates post-bariatric surgery based on these indicators. This study aims to develop a machine learning model that utilizes laboratory test markers to precisely predict the risk of 30-day readmission after bariatric surgery. It seeks to facilitate the development of personalized postoperative management strategies and enhance patient outcomes.

Methods

Data source

Patients who underwent initial bariatric surgery at the Department of Pancreatic and Metabolic Surgery of Nanjing Drum Tower Hospital from January 2018 to December 2023 were included in this study. All patients were those undergoing their initial bariatric surgery. Patients who were readmitted after revision surgery were excluded. All patient data were sourced from the Nanjing Drum Tower Hospital Bariatric and Metabolic Database and medical records. All surgeries and post-operative care are carried out by the same experienced team. Standardized post-operative management is used for all patients. In principle, all patients can be discharged after blood tests on the third post-operative day. Baseline demographic characteristics (age, gender, body mass index) were included in the study. Surgery types included laparoscopic sleeve gastrectomy (LSG), Roux-en-Y gastric bypass (RYGB), one-anastomosis gastric bypass (OAGB), one-anastomosis transit bipartition (OATB), single-anastomosis sleeve jejunal bypass (SASJ), laparoscopic sleeve gastrectomy plus jejunojejunal bypass (LSG-JJB), laparoscopic sleeve gastrectomy plus transit bipartition (LSG-TB). The duration of surgery is also included. In addition, the study involved testing several biomarkers at different time points. Glycosylated hemoglobin A1c(HbA1c) and prealbumin (PA) were measured preoperatively. Other biomarkers, including procalcitonin (PCT), white blood cell count (WBC), red blood cell count (RBC), hemoglobin (Hb), C-reactive protein (CRP), albumin (ALB), alanine aminotransferase (ALT), aspartate aminotransferase (AST), uric acid (UA), and interleukin-6 (IL6), were measured both preoperatively and on postoperative days 1 and 3. The endpoint of the study was unplanned readmission for any reason within 30 days after surgery. The study was approved by the Ethics Committee of Nanjing Drum Tower Hospital (Ethics No. 2023-607-01), and informed consent was obtained from all participants. All study methods followed the Declaration of Helsinki and relevant guidelines and regulations.

Data processing

During the data processing and variable selection phase, we first evaluated the dataset for missing data. We excluded any variable that had more than 20% missing data to maintain the quality of our dataset. Subsequently, we randomly divided the data into training and testing sets using a 7:3 ratio. The training set was dedicated to model development, and the testing set was used solely for the final model performance evaluation. To handle missing values in the training set, we employed k-nearest neighbor imputation. This method estimates missing values by leveraging similarities among the nearest neighboring data points, thereby aiming to preserve the natural distribution and inherent characteristics of the data.

Feature selection

To select the most significant variables from a pool of potential predictors, we implemented least absolute shrinkage and selection operator (LASSO) regression. This approach facilitates variable selection by applying a regularization parameter, λ, which shrinks the coefficients of less crucial variables towards zero. This not only simplifies the model but also enhances its interpretability by retaining only the most predictive variables. We determined the optimal value of λ through tenfold cross-validation.

Model development and evaluation

To construct the prediction models, we selected multiple machine learning techniques including random forest (RF), extreme gradient boosting (XGB), generalized linear models (GLM), support vector machines (SVM), and multi-layer perceptron (MLP). All models were constructed via the R package caret. To address significant category imbalance in our dataset, we utilized the R package ROSE, employing a hybrid sampling technique that oversamples the minority class and undersamples the majority class, thus creating a more balanced dataset. We employ tenfold cross-validation to maximize data utilization and ensure that each sample contributes to both the training and validation processes. In addition, parameter tuning of the model is accomplished through a stochastic hyperparameter search to find the optimal model configuration. Model performance was primarily assessed using the area under the receiver operating characteristic curve (AUROC), which effectively summarizes the model's capability to discriminate between positive and negative cases. The AUROC values ranged from 0.5 (equivalent to random guessing) to 1.0 (indicating perfect classification). Considering the category imbalance, we also used other assessment metrics such as balanced accuracy, F1 score, and Matthews correlation coefficient (MCC) to fully evaluate the model performance. All model development steps, including data normalization, feature selection, and hyperparameter optimization, were performed only on the training set to avoid information leakage from the test set.

Statistical analysis

Data analysis was performed using R software, version 4.3.3. Descriptive statistics for normally distributed continuous variables are presented as means with standard deviations (SD), and for non-normally distributed continuous variables as medians with interquartile ranges (IQR). Categorical variables are described using frequencies and proportions. For inferential statistics, we used the Wilcoxon rank sum test for continuous variables and the chi-squared test or Fisher's exact test for categorical variables. We considered a p-value of less than 0.05 to indicate statistical significance.

Results

Patient characteristics and reasons for readmission

According to our inclusion criteria, 1262 participants were enrolled and randomly assigned to a training group (n = 883) and a test group (n = 379) (Supplementary Table 1). The overall 30-day readmission rate was 7.69% (Table 1). The median age of the patients was 31 years, and the median body mass index was 39 kg/m2, with females comprising 64% of the participants. LSG surgery accounted for 83% of all surgeries, followed by OAGB (5.4%), OATB (3.5%), RYGB (2.9%), SASJ (2.4%), LSG-JJB (1.9%), and LSG-TB (1.0%). The highest readmission rate was observed for LSG-TB (16.7%, 2/12), followed by RYGB (8.3%, 3/36), LSG-JJB (8.3%, 2/24), LSG (8.1%, 85/1048), OATB (6.8%, 3/44), SASJ (3.3%, 1/30) and OAGB (1.5%, 1/68). Nevertheless, the findings of the Fisher's exact test indicated that there was no statistically significant difference in the rates of readmission between the various procedures. Readmitted patients exhibited lower RBC levels preoperatively, as well as on postoperative days 1 and 3, compared to those who were not readmitted. Additionally, their CRP levels were elevated on postoperative days 1 and 3, and UA levels increased on postoperative day 3.

Table 1 The baseline characteristics of the patients.

A total of 97 patients were readmitted within 30 days postoperatively (Table 2). More than one reason for readmission can be registered per patient. The most common reason for readmission was nausea, vomiting, and dehydration, affecting 47 patients (48.5%). This was followed by infections in 20 patients (20.6%), anastomotic leakage in 17 (17.5%), abdominal symptoms in 8 (8.2%), and fever in 7 (7.2%).

Table 2 Reasons for readmission 30 days after surgery.

Characterization variable screening.

Six non-zero characteristic variables were utilized as predictors in LASSO regression through cross-validation (Fig. 1 A, B). The selected variables included preoperative HbA1c, WBC, RBC, CRP levels on postoperative days 1 and 3, and UA levels on postoperative day 3. (Supplementary Table 2).

Figure 1
figure 1

Feature selection using LASSO regression. (A) LASSO coefficient profiles of all the variables, a coefficient profile plot was provided against the log (λ) sequence. (B) Identification of the optimal penalization coefficient λ in the LASSO model.

Model comparison

All five machine learning models demonstrated comparable performance in terms of AUROC (Fig. 2). The SVM model exhibited slightly superior performance with an AUROC of 0.784 (95% CI 0.696–0.872), followed closely by the GLM 0.779 (95% CI 0.693–0.864), MLP 0.778 (95% CI 0.691–0.866), RF 0.751 (95% CI 0.661–0.825), and XGB 0.743 (95% CI 0.641–0.845). Furthermore, when comparing balanced accuracy, F1 score, and MCC, SVM consistently outperformed the other models in distinguishing between patient outcomes (Table 3).

Figure 2
figure 2

ROC curves of the models in the test set. ROC receiver operating characteristic, GLM generalized linear model, MLP multi-layer perceptron, RF random forest, SVM support vector machine, XGB extreme gradient boosting.

Table 3 Results of the evaluated machine learning models.

Discussion

In this study, we included 1262 patients who underwent bariatric surgery. The 30-day postoperative readmission rate was 7.69%, with nausea, vomiting, and dehydration cited as the most common reasons for readmission, aligning with findings from previous studies4,18. However, there was no significant difference in readmission rates for the various procedures in our cohort. This may be attributed to the relatively low number of surgical cases other than sleeve gastrectomy in our cohort. Nevertheless, a recent randomised clinical trial on the safety of SG versus RYGB demonstrated that there was no significant difference in 30-day readmission rates after bariatric surgery17. Further research is needed on this issue to include more cases. Our study found a significantly higher proportion of patients (48.5%) readmitted for these symptoms. This discrepancy may relate to the fact that 83% of our patients underwent sleeve gastrectomy, a group more susceptible to these complications19. Furthermore, our study uniquely categorized nausea, vomiting, and dehydration as a single readmission reason, unlike other studies that separate these conditions. This classification approach likely contributed to the observed higher incidence of these symptoms.

LASSO regression identified six critical predictive variables: preoperative HbA1c, WBC, RBC, CRP on postoperative days 1 and 3, and UA on postoperative day 3. Previous studies have shown indicated that although HbA1c levels were not significantly linked to postoperative complications, they correlated with the risk of readmission20,21. Obesity-related chronic inflammation typically resulted in elevated preoperative WBC levels22. Patients with higher preoperative WBC levels were more likely to develop high WBC counts postoperatively, which is associated with an increased risk of postoperative complications23. An increase in CRP levels on postoperative day 1 was associated with the incidence of perioperative complications within 30 days postoperatively24,25,26. While CRP levels on postoperative day 1 alone were insufficient for definitive diagnosis of postoperative complications, they served effectively as exclusionary diagnostic indicators27,28. Additionally, elevated CRP levels on postoperative day 3 were instrumental in the early diagnosis of infectious complications29. Although weight loss following bariatric surgery typically leads to decreased UA levels and reduced gout attack incidence long-term, UA levels may fluctuate within the first postoperative month, often experiencing temporary increases and associated gout attacks30,31,32. Our study found that readmitted patients exhibited higher levels of CRP on postoperative days 1 and 3, and higher UA levels on postoperative day 3, compared to those not readmitted. Additionally, readmitted patients exhibited lower RBC levels both preoperatively and on postoperative days 1 and 3. Currently, there is insufficient research exploring the relationship between preoperative RBC levels and the risk of complications or readmission following bariatric surgery, necessitating further investigation.

In recent years, some studies have focused on predicting the 30-day readmission rates following bariatric surgery. One study employed the Metabolic and Bariatric Surgery Accreditation and Quality Improvement Program (MBSAQIP) data from 2016 to establish a logistic regression model, achieving an AUROC of 0.6133. In addition to traditional regression models, some studies have used machine learning models for prediction, which outperform logistic regression. A study utilizing MBSAQIP data from 2015 to 2018 developed a model using the 'Super Learner' algorithm, which achieved an AUROC of 0.674, surpassing the logistic regression model’s AUROC of 0.65034. Among these predictive models, the XGB model constructed in the study by Logan R Butler et al, performed the best with an AUROC of 0.785, while the logistic regression model had an AUROC of only 0.6235. Furthermore, the study highlighted that including preoperative, intraoperative, and postoperative variables significantly enhances model effectiveness over those models limited to preoperative and intraoperative variables35. However, as their model encompasses all variables in the MBSAQIP prior to patient discharge, it may face challenges in external validation and clinical application. In contrast, in our study, the optimal model for predicting readmission was the SVM model, with an AUROC of 0.784. Although slightly lower than Butler's XGB model, its feasibility in clinical application is higher due to it only including six laboratory test indicators.

There are some potential limitations in this study. First, as the data originated solely from a single-center medical institution, they may lack broader representativeness. Second, the inability to assess the impact of certain factors on model performance, due to missing data and the exclusion of relevant outcome variables like surgical procedure and BMI during screening, led to a model reliant solely on laboratory test results. More predictor variables could be included in the future to improve the performance of the predictive model. Additionally, despite dataset segmentation and cross-validation, the model still risks potential overfitting. Therefore, testing the model on an external independent dataset is essential to further evaluate its performance. Finally, the novel coronavirus pandemic during the data collection period may have influenced patient readmission behavior.

Conclusion

In summary, this study introduces the first machine learning model that utilizes laboratory examination data to predict readmissions following bariatric surgery. The model provides clinicians with a novel tool for identifying patients at high risk of readmission 30 days after bariatric surgery.