Abstract
Objective
Women with gestational diabetes mellitus (GDM) undergoing delivery face a significantly higher risk of healthcare-associated infections (HAIs) due to metabolic disorders and impaired immune function compared with healthy pregnant women, making them a key population of concern in HAI prevention and control. However, effective early warning tools specifically tailored to this population are still lacking in clinical practice. Therefore, this study aimed to develop a risk prediction model for HAIs in women with GDM undergoing delivery, with the goal of identifying high-risk individuals and facilitating early intervention.
Methods
Model development and validation were conducted using a sequential approach. In the development phase, a 10‑repeated 5‑fold cross‑validation was performed on the training set (n = 690; January 2022 – December 2024). To address severe class imbalance, the random over‑sampling examples method was applied within each training fold, followed by random forest (RF) modeling. This procedure was repeated 10 times with different random seeds, yielding 50 performance estimates. Candidate variables selected in at least 70% of the 50 folds were retained as stable predictors. Using this selected feature set, both logistic regression (LR) and RF models were developed. Model performance was then evaluated on an independent temporal validation set (n = 294; January – December 2025), which was completely withheld from the model development process.
Results
A 10‑repeated 5‑fold cross‑validation on the training set identified five stable predictors selected in ≥ 70% of the 50 model fits: mode of delivery, Group B Streptococcus colonization, artificial rupture of membranes, misoprostol administration, and balloon catheter for cervical ripening. Using these predictors, both RF and LR models were developed. In the temporal validation set (n = 294; positive rate 5.78%), the RF model achieved a PR‑AUC of 0.407 (95% CI: 0.145–0.632) and an ROC‑AUC of 0.789 (95% CI: 0.646–0.911). The LR model yielded a PR‑AUC of 0.345 (95% CI: 0.124–0.563) and an ROC‑AUC of 0.803 (95% CI: 0.665–0.920). The Brier score was 0.0472 for LR and 0.1134 for RF.
Conclusion
The RF model demonstrated superior performance in identifying positive cases and exhibited greater stability, whereas LR achieved better probability calibration. Given the clinical priority of minimizing false negatives, RF may be preferable when sensitivity is prioritized, while LR may be more suitable when well-calibrated probabilities are required. Both models showed moderate discriminative ability and require further external validation before clinical implementation. Decision curve analyses supported their potential clinical utility.
Clinical trial number
Not applicable.
Keywords: Gestational diabetes mellitus, Healthcare-associated infections, Random forest, Risk prediction model
Introduction
Gestational diabetes mellitus (GDM) has emerged as a prevalent metabolic disorder during pregnancy in the People’s Republic of China [1–5]. Recent studies indicate that the pooled prevalence of GDM is 14.8% and is exhibiting an increasing trend [6, 7]. Due to the fact that persistent hyperglycemia can disrupt microecological balance and impair immune function, women with GDM have a significantly higher risk of healthcare-associated infections (HAIs) during hospitalization for delivery compared to normoglycemic pregnant women. Such infections not only pose a serious threat to the safety of the mother and the infant but also prolong hospital stays, increase the economic burden on the healthcare system, impede the postpartum recovery process, and may even have adverse effects on the long-term health of the mother and the development of the offspring [8].
Extensive literature has documented the adverse effects of GDM on maternal and neonatal health [9–12]. Concurrently, a growing number of risk prediction studies have emerged, employing conventional statistical methods and artificial intelligence techniques [13]. However, the development of prediction models for HAI risk in this specific population—women with GDM—has yet to be systematically reported. Furthermore, clinical attention to HAI in this population remains limited, and there is a lack of predictive tools suitable for individualized risk assessment and early warning. To address this gap, this study constructs a predictive model for HAIs in women with GDM undergoing delivery, aiming to facilitate early identification of high-risk individuals and provide scientific evidence for precise prevention and control strategies.
Objects and methods
Objects
This study enrolled pregnant women diagnosed with GDM who received prenatal care and delivered at the Haidian District Maternal and Child Health Care Hospital in Beijing. A total of 984 women with GDM were included, among whom 59 (6.0%) developed HAIs. Patients admitted from January 2022 to December 2024 constituted a training set (n = 690), while those admitted from January to December 2025 formed an independent temporal validation set (n = 294) that remained completely unseen during model development.
The inclusion criteria were: (1) meeting the diagnostic criteria for GDM [14]; (2) normal blood glucose levels before pregnancy; (3) being a parturient hospitalized for delivery; (4) having complete clinical data. The exclusion criteria were: (1) complicated with dysfunction of vital organs such as the heart, liver, or kidneys; (2) complicated with endocrine disorders such as hypertension or thyroid dysfunction; (3) having a history of diabetes before pregnancy; (4) complicated with other pregnancy complications; (5) parturient who developed infection within 48 h before admission; (6) having incomplete clinical data.
Of note, all women with Group B Streptococcus (GBS) colonization received intrapartum antibiotic prophylaxis. This study was approved by the Ethics Committee of Haidian District Maternal and Child Health Care Hospital in Beijing (Approval No. 2025LW-27).
Methods
Data collection
Data were collected by reviewing the electronic medical record system. The following information was gathered: age, length of stay, pre-pregnancy body mass index (BMI), glycemic control status, hemoglobin level, GBS colonization, mode of delivery, artificial rupture of membranes, balloon catheter for cervical ripening, misoprostol administration, oxytocin induction, and neuraxial analgesia.
Diagnosis and grouping of HAIs
In accordance with the Surveillance Definitions for HAIs (WS/T 857–2025) issued by the National Health Commission of the People’s Republic of China [15] and the Diagnostic Criteria for HAIs (Proposed) (Document No. Wei Yi Fa [2001] No. 2) [16], HAIs were defined as follows: for infections with a known incubation period, onset occurred after the incubation period had elapsed following admission; for infections without a known incubation period, onset occurred > 48 h after admission; the infection was directly related to hospitalization; or a new infection at a different site or caused by a new pathogen developed on the basis of an existing infection. Diagnosis was determined based on clinical manifestations and etiological examination. According to the above criteria, the women with GDM in this study were classified into an infection group and a non-infection group.
To further distinguish true HAIs from intrapartum ascending infections or community‑acquired conditions, the following adjudication algorithm was applied: cases with premature rupture of membranes before admission and signs of infection appearing within 48 h of admission were excluded from the HAI definition as community‑associated ascending infections. All infection cases included in the analysis met the temporal, clinical, and procedural criteria for HAIs as defined in the national standards.
Statistical analysis and model development
Statistical analyses were conducted using R software (version 4.5.0). Continuous variables were reported as mean ± standard deviation and compared using the t‑test, while categorical variables were presented as frequencies with percentages (n [%]) and analyzed using the Chi‑square (χ²) test, with Fisher’s exact test applied when expected cell counts were < 5. A two‑sided P < 0.05 was deemed statistically significant.
The model development and validation followed a sequential pipeline: (1) Initially, a 10‑repeated 5‑fold cross‑validation was performed on the training set (n = 690, January 2022–December 2024). (2) In each iteration, the set was randomly divided into 5 equal folds; for each fold, the model was trained on 4 folds and validated on the remaining 1 fold. (3) To handle severe class imbalance, the Random Over‑Sampling Examples (ROSE) method [17–19] was applied to the training subset. (4) A random forest (RF) model [20, 21] was then built using the balanced training data and evaluated on the held‑out validation fold. (5) This process was repeated 10 times with different random seeds, generating 50 performance estimates. Features that were selected in ≥ 70% of these 50 folds were retained for constructing the final prediction model. (6) Using the selected feature set, both logistic regression (LR) and RF algorithms were employed to develop the prediction models. (7) The performance of the two models was subsequently assessed on an independent temporal validation set (n = 294; January–December 2025), which remained completely unseen throughout the entire development phase. (8) Model performance was comprehensively evaluated using the receiver operating characteristic (ROC) curve, precision‑recall (PR) curve [22, 23], calibration curve, and decision curve analysis (DCA) to assess discriminative ability, calibration, and clinical net benefit, respectively.
Results
Univariate analysis of HAI in women with GDM
A total of 984 women with GDM admitted for delivery were included, with 59 cases (6.0%) of HAIs. The training set (n = 690) comprised patients admitted from January 2022 to December 2024, while an independent temporal validation set (n = 294, admitted January–December 2025) was completely unseen during model development.
Table 1 indicated that, within the training set, there were statistically significant differences between the infection group and non-infection group regarding length of stay, GBS, artificial rupture of membranes, balloon catheter for cervical ripening, oxytocin induction, misoprostol administration, and mode of delivery (P < 0.05). The differences in the remaining baseline characteristics between the two groups were not statistically significant. Comparable results were observed in the temporal validation set.
Table 1.
Univariate analysis of HAI in women with GDM (training and temporal validation sets)
| Characteristic | Training set | P-value | Temporal validation set | P-value | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Total N = 690 |
Non-infection N = 648 |
Infection N = 42 |
|
Total N = 294 |
Non-infection N = 277 |
Infection N = 17 |
|
|||
| Age ≥ 35 (years) | 0.34 | 0.6 | 0.99 | 0.3 | ||||||
| No | 516 (74.8%) | 483 (74.5%) | 33 (78.6%) | 192 (65.3%) | 179 (64.6%) | 13 (76.5%) | ||||
| Yes | 174 (25.2%) | 165 (25.5%) | 9 (21.4%) | 102 (34.7%) | 98 (35.4%) | 4 (23.5%) | ||||
| Length of stay (days) | 5.27 ± 1.64 | 5.10 ± 1.41 | 7.95 ± 2.43 | 7.53 | < 0.001 | 5.28 ± 1.96 | 5.05 ± 1.62 | 8.94 ± 3.13 | 5.08 | < 0.001 |
| BMI (kg/m²) | 28.24 ± 3.84 | 28.23 ± 3.86 | 28.45 ± 3.52 | 0.38 | 0.7 | 28.20 ± 3.75 | 28.14 ± 3.74 | 29.16 ± 4.00 | 1.03 | 0.3 |
| Fasting plasma glucose (mmol/L) | 4.76 ± 0.53 | 4.76 ± 0.53 | 4.70 ± 0.63 | 0.66 | 0.5 | 4.85 ± 0.58 | 4.86 ± 0.59 | 4.75 ± 0.31 | 1.24 | 0.2 |
| Postprandial plasma glucose (mmol/L) | 5.98 ± 1.00 | 6.00 ± 1.00 | 5.73 ± 0.90 | 1.89 | 0.065 | 5.99 ± 0.89 | 6.00 ± 0.89 | 5.82 ± 0.82 | 0.92 | 0.4 |
| GBS | Fisher | < 0.001 | Fisher | 0.009 | ||||||
| Negative | 673 (97.5%) | 638 (98.5%) | 35 (83.3%) | 291 (99.0%) | 276 (99.6%) | 15 (88.2%) | ||||
| Positive | 17 (2.5%) | 10 (1.5%) | 7 (16.7%) | 3 (1.0%) | 1 (0.4%) | 2 (11.8%) | ||||
| Hemoglobin (g/L) | 121.27 ± 8.80 | 121.23 ± 8.70 | 121.90 ± 10.29 | 0.42 | 0.7 | 120.88 ± 8.48 | 120.71 ± 8.43 | 123.71 ± 9.07 | 1.33 | 0.2 |
| Artificial rupture of membranes | 29.24 | < 0.001 | 4.72 | 0.030 | ||||||
| No | 406 (58.8%) | 398 (61.4%) | 8 (19.0%) | 207 (70.4%) | 199 (71.8%) | 8 (47.1%) | ||||
| Yes | 284 (41.2%) | 250 (38.6%) | 34 (81.0%) | 87 (29.6%) | 78 (28.2%) | 9 (52.9%) | ||||
| Balloon catheter for cervical ripening | 30.46 | < 0.001 | Fisher | < 0.001 | ||||||
| No | 512 (74.2%) | 496 (76.5%) | 16 (38.1%) | 253 (86.1%) | 245 (88.4%) | 8 (47.1%) | ||||
| Yes | 178 (25.8%) | 152 (23.5%) | 26 (61.9%) | 41 (13.9%) | 32 (11.6%) | 9 (52.9%) | ||||
| Oxytocin induction | 15.51 | < 0.001 | 10.48 | 0.001 | ||||||
| No | 351 (50.9%) | 342 (52.8%) | 9 (21.4%) | 186 (63.3%) | 169 (61.0%) | 17 (100.0%) | ||||
| Yes | 339 (49.1%) | 306 (47.2%) | 33 (78.6%) | 108 (36.7%) | 108 (39.0%) | 0 (0.0%) | ||||
| Misoprostol administration | Fisher | < 0.001 | Fisher | 0.082 | ||||||
| No | 638 (92.5%) | 608 (93.8%) | 30 (71.4%) | 264 (89.8%) | 251 (90.6%) | 13 (76.5%) | ||||
| Yes | 52 (7.5%) | 40 (6.2%) | 12 (28.6%) | 30 (10.2%) | 26 (9.4%) | 4 (23.5%) | ||||
| Neuraxial analgesia | 3.08 | 0.079 | 4.55 | 0.033 | ||||||
| No | 269 (39.0%) | 258 (39.8%) | 11 (26.2%) | 143 (48.6%) | 139 (50.2%) | 4 (23.5%) | ||||
| Yes | 421 (61.0%) | 390 (60.2%) | 31 (73.8%) | 151 (51.4%) | 138 (49.8%) | 13 (76.5%) | ||||
| Mode of delivery | Fisher | < 0.001 | Fisher | < 0.001 | ||||||
| Spontaneous vaginal delivery | 494 (71.6%) | 482 (74.4%) | 12 (28.6%) | 196 (66.7%) | 190 (68.6%) | 6 (35.3%) | ||||
| Cesarean section (without labor) | 131 (19.0%) | 128 (19.8%) | 3 (7.1%) | 64 (21.8%) | 62 (22.4%) | 2 (11.8%) | ||||
| Cesarean section after failed trial of labor | 65 (9.4%) | 38 (5.9%) | 27 (64.3%) | 34 (11.6%) | 25 (9.0%) | 9 (52.9%) | ||||
Note: In this paper, the mode of delivery is classified into three categories: spontaneous vaginal delivery, referring to natural vaginal birth; cesarean section (without labor), referring to cesarean section performed without a trial of labor; and cesarean section after failed trial of labor, referring to cesarean section performed following an unsuccessful attempt at vaginal delivery. Fisher denotes Fisher’s exact test
In the training set, 42 HAIs were identified, all of which were maternal infections. The most common type was intrauterine infection (n = 31, 73.81%), followed by puerperal infection (n = 8, 19.05%), acute pelvic inflammatory disease (n = 1, 2.38%), and upper respiratory tract infection (n = 2, 4.76%) (Table 2). In the temporal validation set, 17 HAIs were identified. The distribution of infection types was generally consistent with the training set (Table 2), with intrauterine infection remaining the most common type (n = 11, 64.71%). No neonatal HAIs were observed in either set.
Table 2.
Distribution of infection types among HAIs (training and temporal validation sets)
| Infection type | Training set | Temporal validation set | ||
|---|---|---|---|---|
| n | % | n | % | |
| Maternal infections | ||||
| Intrauterine infection | 31 | 73.81 | 11 | 64.71 |
| Puerperal infection | 8 | 19.05 | 5 | 29.41 |
| Acute pelvic inflammatory disease | 1 | 2.38 | 0 | 0.00 |
| Upper respiratory tract infection | 2 | 4.76 | 1 | 5.88 |
| Neonatal infections | ||||
| Neonatal sepsis | 0 | 0.00 | 0 | 0.00 |
| Other neonatal infections | 0 | 0.00 | 0 | 0.00 |
| Total | 42 | 100 | 17 | 100 |
Predictive modeling
Feature selection
A total of 13 candidate variables were included in Table 1. With the exception of length of stay, which was considered an outcome‑related variable, the remaining 12 variables could all be ascertained either during labor or in the immediate postpartum period; they were therefore all incorporated into model development to support the prediction of HAIs during both the intrapartum and postpartum periods.
To identify stable predictors, a 10‑repeated 5‑fold cross‑validation procedure was employed. In each iteration, the training set was randomly partitioned into five equal folds, with four folds used for training and the remaining fold used for validation. To address class imbalance, the ROSE method was applied to the training set, followed by the construction of a RF model, which was then evaluated on the validation fold. This process was repeated 10 times with different random seeds, yielding a total of 50 model fits.
The selection frequency of each candidate variable across the 50 model fits is shown in Fig. 1. Variables with a selection frequency of ≥ 70% were retained for the final prediction model, resulting in five stable predictors: mode of delivery, GBS, artificial rupture of membranes, misoprostol administration, and balloon catheter for cervical ripening. This threshold was chosen over a more stringent cutoff (e.g., ≥ 80%) because the candidate pool was limited; a higher threshold might have removed features with potential predictive utility and degraded model performance. In cross‑validation, the RF model using the selected variables achieved a mean area under the precision‑recall curve (PR‑AUC) of 0.418 (95% CI: 0.142–0.682) and a mean area under the receiver operating characteristic curve (ROC‑AUC) of 0.883 (95% CI: 0.743–0.968) on the validation set.
Fig. 1.

Variable selection frequency of the RF model for HAI in women with GDM undergoing delivery
Model training
Based on the feature selection results outlined in section “Feature selection”, five variables were retained for constructing a predictive model for HAIs in women with GDM undergoing delivery. Both RF and multivariable LR approaches were employed for model development, and the findings are detailed below. For the RF model, the algorithm was configured with a maximum of 500 leaf nodes per tree and a random subset of two features considered at each split, while all other hyperparameters were maintained at their default values. To address the significant class imbalance in the dataset, the ROSE method was applied to the training set. Following model training, variable importance was assessed using SHapley Additive exPlanations (SHAP) [24–26] values, with features ranked in descending order of their mean absolute SHAP values. As illustrated in Fig. 2, the top-ranking predictors, in order of importance, were mode of delivery, artificial rupture of membranes, misoprostol administration, balloon catheter for cervical ripening, and GBS.
Fig. 2.

Feature importance ranking of the RF model based on SHAP values
In the multivariable LR analysis, mode of delivery, GBS, artificial rupture of membranes, and misoprostol administration emerged as independent risk factors for HAIs (P < 0.05), whereas balloon catheter for cervical ripening did not reach statistical significance (P > 0.05). The corresponding regression coefficients, odds ratios, and P-values are summarized in Table 3.
Table 3.
Multivariable logistic regression analysis
| Variables | β coefficient | OR (95% CI) | P-value |
|---|---|---|---|
| Mode of delivery | |||
| Spontaneous vaginal delivery | Reference | Reference | |
| Cesarean section (without labor) | 0.78 | 2.18 (0.42–9.07) | 0.307 |
| Cesarean section after failed trial of labor | 3.16 | 23.6 (10.43–57.62) | < 0.001 |
| GBS | |||
| Negative | Reference | Reference | |
| Positive | 3.07 | 21.5 (5.86–77.68) | < 0.001 |
| Artificial rupture of membranes | |||
| No | Reference | Reference | |
| Yes | 1.36 | 3.89 (1.39–11.87) | 0.012 |
| Misoprostol administration | |||
| No | Reference | Reference | |
| Yes | 1.62 | 5.04 (1.87–13.30) | 0.001 |
| Balloon catheter for cervical ripening | |||
| No | Reference | Reference | |
| Yes | 0.62 | 1.86 (0.80–4.46) | 0.154 |
Model performance validation
The positive sample rate was 6.08% in the training set and 5.78% in the temporal validation set. The performance of the RF and LR models is presented in Fig. 3 (PR curves) and Fig. 4 (ROC curves) for both the training and validation sets. In the training set, the RF model achieved a PR‑AUC of 0.470 (95% CI: 0.317–0.625) and an ROC‑AUC of 0.912 (95% CI: 0.857–0.955); in the temporal validation set, the corresponding values were 0.407 (95% CI: 0.145–0.632) and 0.789 (95% CI: 0.646–0.911). For the LR model, the PR-AUC was 0.512 (95% CI: 0.357–0.663) in the training set and 0.345 (95% CI: 0.124–0.563) in the temporal validation set, with ROC-AUC values of 0.918 (95% CI: 0.868–0.959) and 0.803 (95% CI: 0.665–0.920), respectively. A comprehensive comparison of the two models in the validation set is provided in Table 4.
Fig. 3.

PR curves of the prediction model for HAI in women with GDM undergoing delivery (training and temporal validation sets)
Fig. 4.

ROC curves of the prediction model for HAI in women with GDM undergoing delivery (training and temporal validation sets)
Table 4.
Performance comparison of RF and LR models in the temporal validation set
| Characteristic | Random Forest | Logistic Regression |
|---|---|---|
| Sample size, n | 294 | 294 |
| Positive cases, n (%) | 17 (5.8) | 17 (5.8) |
| Discriminative performance | ||
| ROC-AUC (95% CI) | 0.789(0.646–0.911) | 0.803 ( 0.665–0.920) |
| PR-AUC (95% CI) | 0.407( 0.145–0.632) | 0.345( 0.124–0.563) |
| Accuracy, % | 86.4 | 93.5 |
| Sensitivity, % | 64.7 | 11.8 |
| Specificity, % | 87.7 | 98.6 |
| PPV, % | 24.4 | 33.3 |
| NPV, % | 97.6 | 94.8 |
| F1 score | 0.355 | 0.174 |
| Confusion matrix | ||
| True positive (TP) | 11 | 2 |
| False negative (FN) | 6 | 15 |
| False positive (FP) | 34 | 4 |
| True negative (TN) | 243 | 273 |
Given the extreme class imbalance inherent in the present dataset, the PR-AUC was adopted as the primary evaluation metric. The resultant PR-AUC values suggested that both models achieved only moderate discriminative ability under such imbalanced conditions. Nonetheless, both models consistently outperformed the random classifier baseline across the training, and temporal validation sets. The RF model exhibited only minor differences in PR-AUC between the training and temporal validation sets, with largely overlapping confidence intervals, suggesting a low risk of overfitting and acceptable generalizability. In contrast, LR showed a PR-AUC of 0.512 in the training set, which declined to 0.345 in the temporal validation set, representing a decrease of 0.167 and indicating a higher risk of overfitting. RF achieved a higher PR-AUC value than LR in the temporal validation set (0.407 vs. 0.345), suggesting a comparative advantage in identifying positive cases under this highly imbalanced scenario when applied to new data. However, the overall predictive performance of both models remained suboptimal, reflecting the inherent limitations of predicting a rare event (HAIs) using the current feature set. Future studies should incorporate additional important obstetric confounders, such as duration of labor, duration of ruptured membranes, number of vaginal examinations, and duration of balloon catheter placement, to further improve model performance.
The calibration curves for the training set and the temporal validation set are shown in Fig. 5. To quantitatively evaluate model calibration, we calculated the calibration slope, calibration intercept (calibration-in-the-large) [27], and Brier score, as detailed in Table 5. In the training set, the Brier scores for LR and RF were 0.0390 and 0.0899, the calibration slopes were 1.0000 and 0.4357, and the calibration intercepts were 0.0000 and − 2.3814, respectively. In the temporal validation set, the corresponding values were 0.0472 and 0.1134, 0.6602 and 0.3116, and − 0.6089 and − 2.1201, respectively. The RF model exhibited substantial miscalibration in both datasets, with calibration slopes markedly deviating from unity and negative intercepts indicating systematic overestimation of risk. LR achieved perfect calibration in the training set; however, it also demonstrated a certain degree of calibration drift in the validation set (calibration slope: 0.6602; intercept: −0.6089), suggesting a decline in the reliability of its predicted probabilities. Nevertheless, LR demonstrated superior calibration performance compared with RF. The suboptimal calibration, particularly for RF, may be attributable to statistical instability arising from the limited number of positive events (n = 42 in the training set; n = 17 in the temporal validation set). These findings warrant further confirmation in external validation studies with larger sample sizes.
Fig. 5.

Calibration curves of the prediction model for HAI in women with GDM undergoing delivery (training and temporal validation sets)
Table 5.
Summary of calibration performance across training and temporal validation sets
| Metric | Training set | Temporal validation set | ||
|---|---|---|---|---|
| LR | RF | LR | RF | |
| Sample size (N) | 690 | 690 | 294 | 294 |
| Event rate, n (%) | 42 (6.09) | 42 (6.09) | 17 (5.78) | 17 (5.78) |
| Brier Score | 0.0390 | 0.0899 | 0.0472 | 0.1134 |
| Calibration slope | 1.0000 | 0.4357 | 0.6602 | 0.3116 |
| Calibration intercept | 0.0000 | −2.3814 | −0.6089 | −2.1201 |
DCA (Fig. 6) revealed that, within a threshold probability range of 0.1 to 0.4, the model provided a modest clinical net benefit in both the training and temporal validation sets, with the curve trends being essentially similar across the two datasets.
Fig. 6.

Decision curves of the prediction model for HAI in women with GDM undergoing delivery (training and validation sets)
In summary, the temporal validation set results demonstrated that LR achieved superior probability calibration (Brier score: 0.0472 vs. 0.1134), whereas RF exhibited better performance in identifying minority positive samples (PR-AUC: 0.407 vs. 0.345). Moreover, RF showed smaller performance fluctuations between the training set and the temporal validation set, indicating stronger generalizability and stability. Within the clinically relevant risk threshold range of 0.1–0.4, no significant difference in clinical net benefit was observed between the two models. Given that this study prioritized early screening and minimizing false negatives, RF may be more suitable than LR in screening contexts, whereas LR may be preferred when well-calibrated probability estimates are needed. However, RF’s positive predictive value was low (24.4%), which is largely attributable to the low event prevalence and the limited positive cases. This renders the estimate inherently unstable. For the same reason, calibration assessments for both models should also be interpreted with caution. Future research should incorporate additional obstetrical covariates and expand positive case samples through multicenter collaborations to enhance predictive performance. Both models require further validation in larger cohorts before any clinical application.
Discussions
Incidence and risk of HAI in women with GDM
Studies have shown that the risk of HAI is significantly higher in women with GDM compared to normoglycemic pregnant women, and it has become one of the major complications during the perinatal period and postpartum [28–30]. This study included 984 women with GDM to investigate the occurrence of HAIs, and the results demonstrated an infection rate of 6.0%, with intrauterine infection being the most common type. To further identify high-risk individuals, we evaluated factors associated with HAIs in women with GDM and constructed a risk prediction model based on RF. It should be noted that, as this model relies on intrapartum variables (e.g., mode of delivery) that are only available during active labor or immediately postpartum, its applicability is limited to HAI risk assessment within this time window and is not applicable to prenatal or admission screening. Its potential clinical utility could be considered once these indicators are obtained, typically during active labor or shortly after delivery.
The DCA further demonstrated that the model provided net clinical benefit across a range of threshold probabilities, suggesting its potential utility in clinical decision-making. However, it should be noted that the DCA in this study was primarily used to demonstrate the potential net benefit of the model, rather than to define a specific clinical intervention threshold at this stage. The translation of this model into clinical practice requires further prospective implementation studies to specify which interventions (e.g., enhanced surveillance, early antibiotic initiation, reduced vaginal examinations, modified induction strategies, or infection‑control measures) should be triggered by a high‑risk prediction.
Key predictors of HAI in women with GDM
This study identified five key predictors for HAI in women with GDM undergoing delivery: mode of delivery, artificial rupture of membranes, misoprostol administration, balloon catheter for cervical ripening, and GBS. It should be noted that these variables serve as predictive markers in our model, and do not represent causal factors for infection. The clinical rationale for their predictive utility is analyzed as follows:
Mode of delivery: Cesarean section following failed trial of labor was the strongest predictor in our model. From a predictive perspective, cesarean delivery serves as a composite marker that integrates multiple risk-related conditions, including abnormal labor progression, premature rupture of membranes, repeated vaginal examinations, and prolonged labor duration [31–34]. The tissue trauma inherent to the surgical procedure, along with the potential risk of bacterial exposure, collectively increases the probability of HAIs.
Artificial rupture of membranes and misoprostol administration: These two interventions are commonly employed for labor induction when cervical conditions are suboptimal in women with GDM [35–38]. As predictive variables, these interventions may signal a clinical scenario characterized by compromised cervical mucus plug integrity, diminished local immune barrier function, and increased opportunity for ascending bacterial colonization—conditions that predispose to intrauterine infection .
Balloon catheter for cervical ripening: As a mechanical dilation method, the use of a balloon catheter may reflect underlying cervical status and the conditions for labor initiation [39, 40]. From a predictive standpoint, this variable may capture the cumulative effect of unfavorable cervical conditions, which often necessitate repeated or prolonged catheter placement—a scenario that can induce local tissue inflammation and potentially facilitate bacterial translocation, thereby increasing the probability of ascending infection.
GBS: It was identified as a predictor of HAI, consistent with its role as a major perinatal pathogen [41–43]. Biologically, GBS can adhere to and penetrate the chorionic membrane, activating a local inflammatory response and releasing proteases that compromise the structural integrity of the fetal membranes, thereby inducing premature rupture of membranes. The disruption of this barrier creates a pathway for pathogenic bacteria to ascend into the uterine cavity, consequently increasing the risk of intrauterine infection.
Study limitations
This study has several limitations.
It employed a single-center retrospective design, with all case data derived from a single medical institution, which may introduce selection bias. Moreover, the model has not been validated using an independent external dataset. Consequently, the predictive performance of the current model may decline when generalized to other regions or populations of different ethnicities. Future studies should adopt multicenter prospective cohort designs to further validate the robustness and generalizability of the model across diverse populations.
The number of HAI events in this study was limited. The small number of positive cases may compromise model robustness and elevate the risk of overfitting. To address class imbalance, we incorporated the ROSE algorithm during model development. However, it should be noted that oversampling techniques cannot generate genuinely new clinical information, and their inherent limitation in covering the full feature space may further exacerbate the propensity for overfitting. Furthermore, only 17 positive events were available in the temporal validation set for calibration curve construction. This extremely small sample size substantially undermined the stability of the calibration curve estimate, making it difficult to accurately reflect the true calibration performance of the model. Therefore, the current calibration assessment results should be interpreted with caution. Future efforts should focus on continuously expanding the positive event sample through multicenter collaborations, so as to mitigate the risk of overfitting and enable more reliable evaluations of the model’s calibration capability.
Due to the retrospective study design and the inherent limitations of medical record completeness, this study faced key data deficiencies in two major aspects. First, we were unable to incorporate several important obstetric confounding variables, including duration of labor, duration of ruptured membranes, number of vaginal examinations, duration of balloon catheter placement, intrapartum fever, prophylactic antibiotic use, intrapartum antibiotic prophylaxis for GBS, instrument‑assisted delivery, and indications for emergency cesarean section. Some GDM severity‑related markers (HbA1c, insulin use, classification of diet‑controlled versus medication‑treated GDM, and glucose control during labor) were not systematically documented in the retrospective dataset and could not be reliably retrieved. These missing variables resulted in limited informational dimensions available for analysis, making it difficult to comprehensively capture potential risk signals for low‑incidence HAIs and thereby constraining the model’s ability to identify such infections to some extent. Future studies with prospective designs should systematically collect the above obstetric and GDM‑related variables to further enhance predictive performance.
Conclusion
This study developed and temporally validated a prediction model for HAIs in women with GDM undergoing delivery, using both RF and LR approaches. Mode of delivery, GBS, artificial rupture of membranes, misoprostol administration, and balloon catheter for cervical ripening were identified via 10‑repeated 5‑fold cross‑validation. In the temporal validation set, the RF model demonstrated superior discriminative ability for identifying positive cases (PR‑AUC: 0.407, 95% CI: 0.145–0.632) and greater stability across datasets, whereas LR achieved better probability calibration (Brier score: 0.0472 vs. 0.1134). Given the clinical priority of early screening and minimizing false negatives, RF may be preferred when sensitivity is the primary concern; however, LR may be more suitable when well‑calibrated probability estimates are required. Both approaches require further external validation.
However, this study has several limitations that should be acknowledged. The single‑center retrospective design may introduce selection bias, and the lack of external validation limits the generalizability of our findings. The limited number of HAI events constrained model stability and calibration assessment, and the absence of key obstetric confounders and GDM-related severity markers in the current variable set may have restricted the model’s predictive capacity. Therefore, the present findings should be interpreted as preliminary exploratory results. Future multicenter prospective studies with larger sample sizes and more comprehensive predictor sets are warranted to further validate the model’s robustness and generalizability before it can be translated into routine clinical screening practice.
Abbreviations
- GDM
Gestational diabetes mellitus
- HAIs
Healthcare-associated infections
- RF
Random forest
- LR
Logistic regression
- BMI
Body mass index
- GBS
Group B streptococcus
- ROSE
Random over-sampling examples
- PR
Precision-recall
- ROC
Receiver operating characteristic
- SHAP
SHapley Additive exPlanations
Author contributions
Concept and design: Xu Xiao-Ya, Zhang Liang-Fen; Collection of data: Xu Xiao-Ya, Ma Li-Li, Wei Wei, and Li Meng-Meng; Analysis and interpretation of data: Xu Xiao-Ya, Zhang Liang-Fen; All authors read and approved the final manuscript.
Funding
There are no sources of funds for this study.
Data availability
The datasets used and/or analyzed during the present study are available from the corresponding author on reasonable request.
Declarations
Ethics approval and consent to participate
This study was approved by the Ethics Committee of Haidian District Maternal and Child Health Care Hospital (No. 2025LW-27, approval date, December 8, 2025). The studies were conducted in accordance with the Declaration of Helsinki, the local legislation and institutional requirements. The requirement for written informed consent was waived by the Ethics Committee of Haidian District Maternal and Child Health Care Hospital in accordance with the principles of the Declaration of Helsinki due to the retrospective nature of the analysis.
Human ethics and consent to participate
This study was approved by the Ethics Committee of Haidian District Maternal and Child Health Care Hospital (No. 2025LW-27, approval date, December 8, 2025). Due to the retrospective nature of the study and the use of anonymized clinical data, the requirement for informed consent was waived by the ethics committee.
Consent for publication
Not applicable.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Yang ZF, Shi XY, Wang SP, Du LJ, Zhang XY, Zhang K, Zhang YQ, Ma JL, Zheng R. An early prediction model for gestational diabetes mellitus created using machine learning algorithms. Int J Gynaecol Obstet. 2025;170(2):665–74. [DOI] [PubMed] [Google Scholar]
- 2.Li WG, Peng Y, Peng K. Diabetes prediction model based on GA-XGBoost and stacking ensemble algorithm. PLoS ONE 2024, 19(9). [DOI] [PMC free article] [PubMed]
- 3.Lin Q, Fang ZJ. Establishment and evaluation of a risk prediction model for gestational diabetes mellitus. World J Diabetes. 2023;14(10):1541–50. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Hu XQ, Hu XL, Hu Y, Yu J, Wang X. Prediction model for gestational diabetes mellitus using the XGBoost machine learning algorithm. Front Endocrinol. 2023;14. [DOI] [PMC free article] [PubMed]
- 5.Li YX, Liu YC, Wang M, Huang YL. Prediction of gestational diabetes mellitus at the first trimester: machine-learning algorithms. Arch Gynecol Obstet. 2024;309(6):2557–66. [DOI] [PubMed] [Google Scholar]
- 6.Zhu H, Zhao Z, Xu J, Chen Y, Zhu Q, Zhou L, Cai J, Ji L. The prevalence of gestational diabetes mellitus before and after the implementation of the universal two-child policy in China. Front Endocrinol. 2022;13. [DOI] [PMC free article] [PubMed]
- 7.Jiani Z, Jiyuan L, Chihui M, Haiyan Y, Xiaodong W. Current status and advances in the diagnosis and management of gestational diabetes mellitus: an analysis of relevant contents in the American Diabetes Association Standards of Care in Diabetes—2025. J Sichuan Univ Med Sci Ed. 2025;56(3):627–32. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Kaya Y, Bütün Z, Çelik Ö, Salik EA, Tahta T, Yavuz AA. The early prediction of gestational diabetes mellitus by machine learning models. BMC Pregnancy Childbirth. 2024;24(1). [DOI] [PMC free article] [PubMed]
- 9.Najafi L, Abedini A, Kadivar M, Khajavi A, Bordbar A, Noohi AH, Mashak B, Hashemnejad M, Khamseh ME, Malek M. Gestational diabetes mellitus: the correlation between umbilical coiling index, and intrapartum as well as neonatal outcomes. J Diabetes Metab Disord. 2019;18(1):51–7. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Naeh A, Maor-Sagie E, Hallak M, Toledano Y, Gabbay-Benziv R. Greater risk of type 2 diabetes progression in multifetal gestations with gestational diabetes: the impact of obesity. Am J Obstet Gynecol. 2024;231(2):e251–9. [DOI] [PubMed] [Google Scholar]
- 11.Kadivar M, Khamseh ME, Malek M, Khajavi A, Noohi AH, Najafi L. Histomorphological changes of the placenta and umbilical cord in pregnancies complicated by gestational diabetes mellitus. Placenta. 2020;97:71–8. [DOI] [PubMed] [Google Scholar]
- 12.Rottenstreich M, Rotem R, Reichman O, Farkash R, Rottenstreich A, Samueloff A, Sela HY. Previous non-diabetic pregnancy with a macrosomic infant: is it a risk factor for subsequent gestational diabetes mellitus? Diabetes Res Clin Pract. 2020;168. [DOI] [PubMed]
- 13.Kang M, Zhu CG, Lai MY, Weng JR, Zhuang Y, He HC, Qiu Y, Wu YX, Qi ZX, Zhang WX, et al. Machine learning-based prediction of large-for-gestational-age infants in mothers with gestational diabetes mellitus. J Clin Endocrinol Metab. 2025;110(5):e1631–9. [DOI] [PubMed] [Google Scholar]
- 14.Qian Z, Jie Y, Xinhua X. Guidelines for the co-management of gestational diabetes mellitus in mothers and their offspring(2024 edition). Chin Res Hosp. 2024;11(06):11–31. [Google Scholar]
- 15.Chunhui L, Xiaojun M, Xun H, Baiyi C, Min D, Lihong W, Lijuan X, Pengcheng Z, Jingbo W, Anhua W. Interpretation of Standard for identifying cases of health care-associated infections:general principles(WS/T 857–2025). Chin J Nosocomiology. 2026;36(02):169–71. [Google Scholar]
- 16.China MOH. Diagnostic criteria for nosocomial infections(proposed). Natl Med J China. 2001;81(5):314–20. [Google Scholar]
- 17.Lu Y, Ren CX, Wu CL. In-hospital mortality prediction model for critically ill older adult patients transferred from the emergency department to the intensive care unit. Risk Manage Healthc policy. 2023;16:2555–63. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Cotia A, Scorsato AP, Victor ED, Prado M, Gagliardi G, de Barros J, Generoso JJ, de Menezes FG, Hsieh MK, Lopes G, et al. Integration of an electronic hand hygiene auditing system with electronic health records using machine learning to predict hospital-acquired infection in a health care setting. Am J Infect Control. 2025;53(1):58–64. [DOI] [PubMed] [Google Scholar]
- 19.Ahiduzzaman M, Hasan MN. Interpretable machine learning for cardiovascular risk prediction: Insights from NHANES dietary and health data. PLoS ONE 2025, 20(11). [DOI] [PMC free article] [PubMed]
- 20.Peerbasha S, Raja AS, Praveen KP, Iqbal YM, Surputheen M. Diabetes prediction using decision tree, random forest, support vector machine, k- nearest neighbors, logistic regression classifiers. J Adv Appl Sci Res. 2023;5(4):42–54. [Google Scholar]
- 21.Subbaiah S, Kavitha M. Random forest algorithm for predicting chronic diabetes disease. Int J life Sci pharma Res 2020:4–8.
- 22.Saito T, Rehmsmeier M. The precision-recall plot is more informative than the roc plot when evaluating binary classifiers on imbalanced datasets. PLoS ONE 2015, 10(3). [DOI] [PMC free article] [PubMed]
- 23.Fu GH, Yi LZ, Pan JX. Tuning model parameters in class-imbalanced learning with precision-recall curve. BIOMETRICAL J. 2019;61(3):652–64. [DOI] [PubMed] [Google Scholar]
- 24.Li J, Liu X, He S, Ren Y. Interpretable machine learning for predicting adverse pregnancy outcomes in gestational diabetes: retrospective cohort study. JMIR Med Inf. 2025;13:e71539. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.Chanumolu KK, MH MNG. G: Hybrid deep learning framework for continuous blood glucose monitoring and gestational diabetes risk prediction. Curr Diabetes Rev 2026. [DOI] [PubMed]
- 26.Idris NA, Yusof NA, Ismail M, Juhari SN, Hassan NM, Daud N, Yunus NI, Pauzi MF. Predicting postpartum glucose intolerance in women with gestational diabetes mellitus in primary care: a machine learning approach using XGBoost and SHAP values. Diabetes Res Clin Pract. 2026;232:113098. [DOI] [PubMed] [Google Scholar]
- 27.Tuti T, Collins G, English M, Mbevi G, Wainaina J, Mumelo L, Gicheha E, Muinga N, Ogola M, Oyiengo L, et al. External validation of inpatient neonatal mortality prediction models in high-mortality settings. BMC Med. 2022;20(1):236. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Mercado-Evans V, Mejia ME, Zulk JJ, Ottinger S, Hameed ZA, Serchejian C, Marunde MG, Robertson CM, Ballard MB, Ruano SH, et al. Gestational diabetes augments group B Streptococcus infection by disrupting maternal immunity and the vaginal microbiota. Nat Commun. 2024;15(1). [DOI] [PMC free article] [PubMed]
- 29.Liang CX, Lu YP, Luo XJ, Weng FC. Microbial etiology, antimicrobial resistance, and risk factors of surgical site infections in gestational diabetes. Infect Drug Resist. 2024;17:3507–17. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Chunhui G, Liyan Z. Characteristics and predisposing factors of nosocomial infections among peripartum women. Chin J Nosocomiology. 2012;22(19):4262–4. [Google Scholar]
- 31.Shacho E, Yilma D, Goshu AT, Ambelu A. Incidence and risk factors of surgical site infection following cesarean section: a prospective cohort study at Jimma University Medical Center. BMC Infect Dis. 2025;25(1). [DOI] [PMC free article] [PubMed]
- 32.Gong SP, Guo HX, Zhou HZ, Chen L, Yu YH. Morbidity and risk factors for surgical site infection following cesarean section in Guangdong Province, China. J Obstet Gynaecol Res. 2012;38(3):509–15. [DOI] [PubMed] [Google Scholar]
- 33.Li LJ, Cui HY. The risk factors and care measures of surgical site infection after cesarean section in China: a retrospective analysis. BMC Surg. 2021;21(1). [DOI] [PMC free article] [PubMed]
- 34.Ramirez-Montesinos L, Downe S, Ramsden A. Systematic review on the management of term prelabour rupture of membranes. BMC Pregnancy Childbirth. 2023;23(1). [DOI] [PMC free article] [PubMed]
- 35.Schoen CN, Baker E, Thind R, Shah ST, Jan SA, Knee AB. Infectious morbidity associated with early amniotomy during labor induction. Eur J Obstet Gynecol Reprod Biol. 2026;317. [DOI] [PubMed]
- 36.Berry M, Lamiman K, Slan MN, Zhang X, Goncharov D, Hwang YP, Rogers JA, Pacheco LD, Saade GR, Saad AF. Early vs delayed amniotomy following transcervical Foley balloon in the induction of labor: a randomized clinical trial. Am J Obstet Gynecol. 2024;230(5). [DOI] [PubMed]
- 37.Güler G, Karaaslan O. Comparison of the effects of intrauterine and rectal misoprostol combined with oxytocin versus oxytocin alone on postpartum hemorrhage: A randomized controlled trial. Medicine 2026, 105(1). [DOI] [PMC free article] [PubMed]
- 38.Yang YK, Yu ZH, Shi HF, Wang Y, Zhao YY. Low-dose oral misoprostol vs. oxytocin in premature rupture of membranes at ≥36 weeks: a comparison of labor induction outcomes and postpartum hemorrhage risk. BMC Pregnancy Childbirth. 2025;25(1). [DOI] [PMC free article] [PubMed]
- 39.Yogamoorthy U, Saaid R, Gan FR, Hong J, Hamdan M, Tan PC. Induction of labor via Foley balloon catheter placement for 6 vs 12 hours in women with 1 previous cesarean delivery and unfavorable cervices: a randomized controlled trial. Am J Obstet Gynecol MFM 2023, 5(11). [DOI] [PubMed]
- 40.Appadurai U, Gan F, Hong J, Hamdan M, Tan PC. Six compared with 12 hours of Foley balloon placement for labor induction in nulliparous women with unripe cervices: a randomized controlled trial. Am J Obstet Gynecol MFM 2023, 5(11). [DOI] [PubMed]
- 41.Liu Y, Ai H. Current research update on group B streptococcal infection related to obstetrics and gynecology. Front Pharmacol. 2024;15. [DOI] [PMC free article] [PubMed]
- 42.Manuel G, Twentyman J, Noble K, Eastman AJ, Aronoff DM, Seepersaud R, Rajagopal L, Waldorf K. Group B streptococcal infections in pregnancy and early life. Clin Microbiol Rev. 2025;38(1). [DOI] [PMC free article] [PubMed]
- 43.Delara M, Vadlamudi NK, Sadarangani M. Strategies to prevent early and late-onset Group B Streptococcal infection via interventions in pregnancy. Pathogens. 2023;12(2). [DOI] [PMC free article] [PubMed]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The datasets used and/or analyzed during the present study are available from the corresponding author on reasonable request.


