A causal forest model integrating quantitative CT scores to predict benefit from flexible bronchoscopy in pediatric Mycoplasma pneumoniae pneumonia: a two-center retrospective study Authors: Zhoumeng Ying, Jing Li, Zheming Li, Ge Hu, Fei Yang, Zhu Zhu, Wei Han, Zhenchen Zhu, Baofeng Zhang, Zhen Zhou, Mengyu Duan, Weixiong Tan, Xinxin Li, Zhengyu Jin, Lan Song, Gang Yu Published: 2025 ABSTRACT AbstractBackgroundFlexible bronchoscopy (FB) is recommended for pediatric Mycoplasma pneumoniae pneumonia (MPP) with persistent consolidation or atelectasis, though substantial heterogeneity in treatment effects exists. This study aimed to develop a causal forest-based predictive model to identify pediatric MPP patients most likely to benefit from FB.MethodsThis retrospective two-center study enrolled pediatric MPP patients in derivation (n = 753) and validation (n = 139) cohorts. Clinical, laboratory, and AI-quantified computed tomography (CT) data were analyzed. Individual treatment effects (ITEs) were estimated using causal forest algorithms. FB-beneficial subgroups were defined using receiver operating characteristic (ROC) analysis of ITEs, with the varying treatment effect across the subgroups validated via multivariable linear regression. Subgroup characteristics, feature importance, and heatmap-based feature interactions were also analyzed.ResultsFB treatment significantly reduced total fever duration in identified FB-beneficial subgroups in both derivation (β = − 1.16, p < 0.001) and validation (β = − 0.68, p = 0.04) cohorts. These beneficial subgroups exhibited significantly higher consolidation/atelectasis volume (CAV), pneumonia attenuation (PA), and consolidation-to-pneumonia ratio (CAR) compared to non-beneficial groups (all p < 0.001). Heatmap analyses confirmed that increased CAV combined with elevated PA or lymphocyte counts could improve FB efficacy.ConclusionsThis study developed and validated an individualized prediction model to identify pediatric MPP patients most likely to benefit from FB treatment. Our model may serve as a tool to support clinicians in optimizing FB utilization, potentially reducing unnecessary interventions and associated risks. An accessible online tool of this model facilitates practical clinical implementation.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12931-025-03447-8.Keywords: Pneumonia, Mycoplasma pneumoniae, Bronchoscopy, Pediatrics, Treatment effect heterogeneity, Supervised machine learning Background Community-acquired pneumonia (CAP) remains a leading cause of hospitalization and mortality among children worldwide. And Mycoplasma pneumoniae (MP) accounted for 20%-40% of pediatric CAP cases [1–3]. Although MP pneumonia (MPP) is usually self-limiting, 6.83%-40.84% of patients may develop severe pulmonary or extrapulmonary complications [4–8]. Persistent atelectasis and consolidation on imaging are strongly associated with these adverse outcomes, serving as critical indicators for clinical intervention [9]. Flexible bronchoscopy (FB) is widely recommended for MPP patients with persistent or recurrent consolidation or atelectasis, as it enables mechanical clearance of airway mucus plugs and accelerates lesion resolution [10–13]. Nevertheless, emerging evidence reveals substantial heterogeneity of treatment effects (HTE) of FB among MPP patients. This heterogeneity means that the individual treatment effect (ITE), defined as the difference between a patient’s potential outcome with FB versus without it, varies significantly across the population. A study demonstrated that nearly one-third of MPP patients with radiographic atelectasis derived no clinical benefit from FB, suggesting current indications were excessively broad [14]. Moreover, FB is associated with anesthesia-related complications, bleeding, and increased healthcare costs. However, existing pediatric guidelines lack contraindications for FB, potentially increasing overtreatment risks [15–18]. These challenges highlight an urgent need for precision tools to estimating the patient’s specific ITE before the intervention. Such tools are essential for optimizing therapeutic decision-making and healthcare resource allocation. To address this need, causal inference frameworks such as causal forests provide a principled approach [19]. Unlike conventional machine-learning models that focus on outcome prediction, causal forests are designed to estimate causal effects by contrasting outcomes among patients with comparable baseline characteristics [20, 21]. This approach allows clinicians to identify those most likely to benefit from the intervention, rather than simply predicting who is at higher risk for poor outcomes, thereby supporting more personalized and evidence-based treatment decisions. Moreover, current decisions to perform FB in pediatric MPP patients with persistent or recurrent consolidation/atelectasis rely heavily on subjective clinical judgment. This approach introduces substantial variability and limited reproducibility across institutions. To address this challenge, objective and individualized prediction requires quantification of imaging scores. Artificial intelligence (AI)-based quantitative computed tomography (CT) tools offer a transformative solution by providing standardized, reproducible measurements of pulmonary lesions [22]. Although AI-derived quantitative CT scores have demonstrated utility in predicting refractory MPP [23], their value in evaluating the therapeutic effects of FB remains unexplored. Accordingly, this study aims to apply the causal forest model to a two-center retrospective cohort integrating quantitative CT scores with clinical data. Our objectives are to construct a predictive model identifying patients most likely to benefit from FB and to characterize their radiological and clinical profiles. This approach, combining causal inference with AI-based quantitative CT analysis, has the potential to bridge a critical gap in pediatric MPP management and support personalized, evidence-based treatment. Methods This study was approved by the ethics committees of both participating centers, with waived individual informed consent due to the retrospective study design. Study design and cohort selection This two-center retrospective study included consecutive pediatric MPP patients from the inpatient units of a tertiary pediatric hospital (derivation cohort, August 2019-December 2023) and a tertiary general hospital (validation cohort, October 2023 to April 2024) (Fig. 1 and S1). Study Enrollment Flowchart. The data collection process for the derivation cohort. Abbreviations: CT, Computed Tomography; FB, Flexible Bronchoscopy The inclusion criteria were as follows: (1) age between 28 days and 18 years at admission; (2) confirmed diagnosis of MPP; (3) at least one chest computed tomography (CT) scan during hospitalization; and (4) documented outpatient follow-up confirming symptom resolution and radiological improvement. Detailed diagnostic criteria for MPP are provided in Supplementary Material 1.1. The exclusion criteria included: (1) absence of thin-slice chest CT scans (slice thickness ≤ 1 mm); (2) baseline CT images with insufficient quality for quantitative lesion analysis; (3) chest CT not performed within 24 h after admission; (4) absence of complete blood count and inflammatory biomarker assessments; (5) history of immunodeficiency or prior immunosuppressive therapy; and (6) requirement for mechanical ventilation. Covariates, exposure, and outcome definition As for covariates, retrospective collection of clinical, etiological, and laboratory information was conducted using the hospital information system. Clinical features included demographic characteristics, preexisting comorbidities, pre-admission symptom duration/treatments, initial vital signs on admission, oxygen support needs upon admission, and etiological information were extracted from the hospital information system. The classification of disease severity was based on the 2023 Chinese pediatric MPP guidelines (Supplementary Material 1.2) [24]. Pathogen testing is further explained in Supplementary Material 1.3. Laboratory features including complete blood count, liver function tests, and inflammatory markers were collected on admission. Features with more than 40% missing data in either derivation or validation cohorts were excluded [25, 26]. The proportion of missing values for all candidate covariates in both cohorts is summarized in Table S1. The final set of covariates used for model construction, including their classification and definitions of abnormality, was presented in Table S2. The exposure was defined as whether patients underwent FB treatment. And patients were categorized into FB and non-FB groups accordingly. Comprehensive procedural descriptions and indications for FB are detailed in Supplementary Material 1.4. In this study, clinical benefit was defined as a reduction in total fever duration during hospitalization, which served as the primary outcome. Fever duration was calculated from the onset of increased body temperature to sustained normalization for at least 24 h. This endpoint was selected as an objective and clinically relevant indicator of acute treatment response and was reliably recorded across both retrospective cohorts. Additional features regarding treatments during hospitalization were also collected from electronic medical records. Chest CT acquisition and pneumonia quantification analysis Non-contrast thin-slice chest CT images (slice thickness ≤ 1 mm) and their corresponding radiological reports were acquired from the hospitals’ Radiology Information System/Picture Archiving and Communication System. For each patient, the initial chest CT scan performed after hospital admission was selected for analysis. The presence of atelectasis or pleural effusion was determined based on these reports. The indication of chest CT for MPP was detailed in Supplementary Material 1.5. Quantitative analysis of pneumonia lesions was conducted using an automated artificial intelligence platform (Fig. 2), which segmented lesions into two primary components: high-density lesions, quantified as the volume of consolidation/atelectasis (CAV, ml), and low-density ground-glass opacities (GGOs), quantified as the volume of GGOs (GV, ml) [27]. The total volume of pneumonia (PV, ml) was defined as the sum of these two components (PV = CAV + GV). This segmentation model demonstrated supported performance, achieving an overall Dice coefficient of 0.82, lesion detection sensitivities of 90.1% for consolidation/atelectasis and 90.3% for GGOs, and a low false positive rate of 1.4 to 1.8 per scan. Detailed radiological definitions for these categories and segmentation methodology are provided in Supplementary Material 1.6. Additional quantitative radiological scores included the mean attenuation of pneumonia lesions (PA, HU), mean attenuation of GGOs (GA, HU), and mean attenuation of consolidation/atelectasis (CAA, HU) within both lungs. The consolidation/atelectasis ratio within lesions (CAR, %) was calculated as: CAV/PV*100%. Additionally, total lung volume (TLV, ml) was estimated. Representative Images of Quantitative Pneumonia Lesion Analysis. A Baseline chest CT image of a 7-year-old patient with severe Mycoplasma pneumoniae pneumonia. B Segmentation of the pneumonia lesions from image (A), ground-glass opacities (GGOs) are color-coded yellow, and consolidation/atelectasis is coded green Construction and validation of the FB-benefit prediction model An overview of the analytical framework is presented in Fig. 3. Overview of Model Construction and Analysis Workflow. A Retrospective Data Collection: Demographic, clinical, laboratory, and baseline CT biomarks were retrospectively collected for both derivation and validation cohorts. B Modeling Pipeline: (1) Data Preprocessing: Variables with more than 40% missing data were excluded; missing laboratory data were imputed, categorical variables were dummy-coded, and AI-based quantitative pneumonia scores were derived from baseline chest CT. (2) Model Construction and Selection: A causal forest model was initially trained using all variables, followed by feature importance ranking. A refined causal forest model (2000 trees) was then optimized via tenfold cross-validation. Calibration tests identified the best-performing model, evaluating linear predictors of conditional average treatment effects and out-of-bag predictions. Individual treatment effects (ITEs) were calculated from this final model. (3) FB-beneficial Subgroup Identification: Optimal ITE cutoffs was determined by receiver operating characteristic curves and Youden's J Index categorized patients into FB-beneficial and non-beneficial subgroups. (C) Model Evaluation and Interpretation: (1) Benefit Confirmation and Validation: Multivariable generalized linear models evaluated FB effects within subgroups. (2) Comparative Analyses: Comparative analyses across the subgroups were conducted. (3) Feature Impact Analysis: Variable importance was calculated based on split frequencies in the causal forest model, with heatmaps illustrating feature interactions. Abbreviations: MPP, Mycoplasma Pneumonia Pneumonia; CT, Computed Tomography; FB, Flexible Bronchoscopy; ITEs, Individual Treatment Effects; MLR, Multivariable Linear Regression Data preprocessing Missing values were imputed using multiple imputations based on classification and regression trees. Categorical features were converted to dummy variables. Model construction and selection The analysis was conducted under the standard causal inference assumptions of unconfoundedness and overlap. We aimed to address unconfoundedness through detailed adjustment for clinical, laboratory, and imaging covariates, while the causal forest algorithm inherently accommodates the overlap principle by concentrating estimation on comparable patient subgroups. To this end, a causal forest with 2000 trees was trained using honest estimation with tenfold cross-fitting. Hyperparameters were optimized via tenfold cross-validation [20, 28]. An initial pilot causal forest model, which included all covariates, was fitted to estimate feature importance, guiding the feature selection process. Feature selection for the final model was guided by calibration tests, which employed out-of-bag-derived best linear predictors of conditional average treatment effects. Adequate calibration was defined by coefficients near one for both the mean conditional average treatment effects and the predicted values [20, 21, 29]. The best-calibrated model was designated as the final model. FB-beneficial subgroup identification As the primary outcome of this study was total fever duration, clinical benefit was defined as a reduction in this duration. Accordingly, a lower ITE indicates a greater expected reduction in fever duration, reflecting higher clinical benefit. ITEs were estimated using the final causal forest model [28]. Receiver operating characteristic (ROC) curves based on actual FB use and estimated ITEs were used to determine the optimal ITE cutoff via Youden’s J Index. Based on this cutoff value, patients were grouped into FB-beneficial (lower ITEs, shorter fever duration) and FB-non-beneficial subgroups (higher ITEs, longer fever duration). And the final FB-beneficial subgroup identification model was available online (https://htefb.shinyapps.io/shiny_ite_app/). Benefit confirmation and validation The clinical impact of FB use was assessed within each subgroup using multivariable linear regression (MLR) models adjusted for relevant confounding variables. In the derivation cohort, the optimal MLR model was selected via Akaike Information Criterion [30]. In the validation cohort, patients were stratified into FB-beneficial and FB-non-beneficial subgroups using the final causal forest model and cutoff value from Sect. 2.4.3. MLR analyses were then performed within each subgroup to assess the treatment effect of FB. Given the small sample size of the validation cohort, covariates for MLR analysis were first selected using the least absolute shrinkage and selection operator, followed by Akaike Information Criterion-based model optimization. Subgroup characterization and feature impact analysis Inter-subgroup comparisons were conducted in both cohorts to assess the differences in clinical and radiological characteristics between the FB-beneficial and FB-non-beneficial subgroups. Feature importance was weighted by splitting frequencies across all tree depths in the causal forest model [29]. Heatmaps were constructed to visualize interactions between critical features and treatment effects, conditioning on these features while other covariates were fixed at median values. Statistical analysis Categorical variables were compared using chi-squared test, while continuous variables were compared using t-test for normally distributed data and Wilcoxon rank-sum test for non-normal distributions. To control for multiple testing, p-values were adjusted using the Benjamini–Hochberg procedure to control the false discovery rate. All statistical analyses were performed using R software (version 4.3.1). The ‘mice’ package was applied for imputation, and the causal forest model was executed using the ‘grf’ package [28, 31]. Calibration tests were performed to evaluate the performance of the causal forest model [20, 21, 29]. To assess the robustness of imputations, a sensitivity analysis was performed by applying the final model to complete cases only, and subgroup patterns were compared with those from the imputed dataset. A two-sided p < 0.05 was considered statistically significant throughout the study. Results Baseline characteristics of the derivation and validation cohorts In the derivation cohort, a total of 753 patients were included (Table S3). Among these, 378 did not receive FB treatment (median age, 6.33 years; 47.09% female; 75.13% severe/critical pneumonia), while 375 received FB treatment (median age, 6.50 years; 55.20% female; 89.07% severe/critical pneumonia). The median interval between CT examination and symptom onset was 7.0 days (Interquartile range [IQR] [6, 10]). Among patients who underwent FB, the median interval between CT and FB was 2.0 days (IQR [1, 3]). The validation cohort comprised 139 eligible patients, of whom 36 received FB (median age, 7.00 years; 38.89% female; 63.89% severe/critical pneumonia) and 103 did not (median age, 7.00 years; 53.40% female; 72.82% severe/critical pneumonia) (Table S4). The median interval between CT examination and symptom onset was 10.0 days (IQR [8, 12]). For patients who underwent FB, the median interval between CT and FB was 3.0 days (IQR [1, 4]). Model construction, validation, and MLR validation of subgroups In the derivation cohort, the final model predicting conditional treatment effects demonstrated good calibration, with a mean causal forest prediction coefficient of 1.00 (p < 0.001). Furthermore, the coefficient of the out-of-bag predictions was 1.05 (p = 0.04), suggesting that the forest effectively captured HTE. Based on the optimal ITE cutoff value of 0.74, the derivation cohort was stratified into an FB-beneficial subgroup (n = 280) and an FB-non-beneficial subgroup (n = 473). As shown in Table 1; Fig. 4A, MLR analysis demonstrated a significant negative association between FB use and total fever duration within the FB-beneficial subgroup (β = − 1.16, p < 0.001). Conversely, a significant positive association was observed in the FB-non-beneficial subgroup (β = 2.17, p < 0.001). Table 1Multivariable linear regression of flexible bronchoscopy effects on fever duration: overall and stratification analysis in the derivation cohortFB-beneficial Subgroup (n = 280)FB-non-beneficial Subgroup (n = 473)CohortAdjusted β95% CIAdjusted pAdjusted β95% CIAdjusted pWhole Derivation Cohort (n = 753)-1.16[-1.68, -0.65]< 0.001*2.17[1.73, 2.60]< 0.001*Patients with Atelectasis (n = 228)-2.45[-3.55, -1.35]< 0.001*2.27[1.41, 3.13]< 0.001*Fever Duration before Admission ≤ 5 days (n = 291)-1.74[-2.50, -0.98]< 0.0012.66[1.95, 3.37]< 0.001*Fever Duration before Admission > 5 days (n = 462)-1.26[-1.90, -0.61]< 0.001*2.04[1.54, 2.55]< 0.001*Age ≤ 6 years (n = 326)-1.44[-2.12, -0.76]< 0.001*2.31[1.72, 2.90]< 0.001*Age > 6 years (n = 427)-1.47[-2.17, -0.77]< 0.001*2.21[1.61, 2.82]< 0.001*β coefficients and p-values reflect adjusted associations between flexible bronchoscopy use andtotal fever duration across subgroups, derived from multivariable linear regression models withcovariates selected through Akaike Information Criterion-based optimizationCI Confidence Interval*indicates p < 0.05 Multivariable linear regression of flexible bronchoscopy effects on fever duration: overall and stratification analysis in the derivation cohort β coefficients and p-values reflect adjusted associations between flexible bronchoscopy use andtotal fever duration across subgroups, derived from multivariable linear regression models withcovariates selected through Akaike Information Criterion-based optimization CI Confidence Interval *indicates p < 0.05 Characteristics of FB-beneficial Subgroup in Derivation Cohort. A Comparison of total fever duration between flexible bronchoscopy (FB) users and non-users within identified subgroups. The upper panel shows Wilcox-test results for the total fever duration between FB users and non-users, while the lower panel presents adjusted β coefficients and p-values for FB use from multivariable linear regression models for each subgroup, including sample sizes for users and non-users. B Chord diagram illustrating the proportion of feature abnormalities within each category across the subgroups. The bar chart on the right shows the median proportions of consolidation/atelectasis and ground-glass opacities volumes for each subgroup. C Characteristic histograms of two subgroups ordered according to the most significant clinical variables from positive to negative. Bars are colored based on the variable categories. The x-axis indicates the mean values of continuous variables, standardized using z-scores derived from the whole cohort. Abbreviations: FB, Flexible Bronchoscopy; GGOs, Ground-glass Opacities; SpO2, Peripheral Capillary Oxygen Saturation; CRP, C-reactive Protein; PCT, Procalcitonin; WBC, White Blood Cell Count; RBC, Red Blood Cell Count; HCT, Hematocrit; HGB, Hemoglobin; PLT, Platelet Count; ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; GGT, Gamma-glutamyl Transferase; ALP, Alkaline Phosphatase; CK, Creatine Kinase; CK-MB, Creatine Kinase-MB; TLV, Total Lung Volume; PV, Volume of Pneumonia; CAV, Volume of Consolidation and Atelectasis; GV, Volume of Ground-glass Opacities; PA, Mean Attenuation of Pneumonia Lesions; CAA, Mean Attenuation of Consolidation and Atelectasis; GA, the Mean Attenuation of Ground-glass Opacities. *** indicates p < 0.001. * indicates p < 0.05 Application of the model to patients with atelectasis also revealed significant HTE. Specifically, in the identified FB-beneficial subgroup, FB treatment was associated with reduced total fever duration (β = − 2.45, p < 0.001), whereas it was associated with increased duration in the FB-non-beneficial subgroup (β = 2.27, p < 0.001). Stratified analyses by pre-admission fever duration and age further confirmed the model’s ability to consistently identify FB-beneficial subgroups across different patient populations (Figures S2-3, Table 1). The FB-beneficial subgroup model was also made publicly available online (https://htefb.shinyapps.io/shiny_ite_app/) and further validated in the validation cohort. MLR analysis confirmed that the model identified an FB-beneficial subgroup within the validation cohort where FB treatment was associated with reduced total fever duration (β = −0.68, p = 0.04; Figure S4A). Consistent with the main analysis, the complete-case analysis (Table S5) also identified subgroups with distinct treatment responses in both cohorts. Characteristic analysis of the FB-beneficial subgroup in the derivation cohort In the derivation cohort, detailed subgroup comparisons are presented in Tables 2 and 3, Table S6-7, and Fig. 4B-D. Clinically, the FB-beneficial subgroup had lower pre-admission glucocorticoid use (18.21% vs. 26.43%, p = 0.01). No significant differences existed in other clinical factors or pathogen profiles between subgroups (Table 2 and Table S6). For continuous variables, Fig. 4B demonstrates that only the radiological category exhibited a significantly higher proportion of variables with abnormal values in the FB-beneficial subgroup compared to the FB-non-beneficial subgroup (97.50% vs. 79.49%, p < 0.001). Specifically, PV, CAV, PA, CAA, and GA were significantly elevated in the FB-beneficial subgroup (all p < 0.001; Table 3; Fig. 4C). Additionally, CAR was higher in the FB-beneficial subgroup (median [IQR]: 27.93% [20.21, 40.44] vs. 19.62% [13.70, 32.04], p < 0.001; Fig. 4B). The complete-case analysis (Table S8) confirmed these findings, as the FB-beneficial subgroup exhibited similar radiological trends. Table 2Subgroup analysis of clinical characteristics in the derivation cohortOverallFB-beneficial SubgroupFB-non-beneficial Subgroup p Number of Cases753280473FB Use (%)375 (49.80)143 (51.07)232 (49.05)0.64Sex (%)0.21 Male368 (48.87)128 (45.71)240 (50.74) Female385 (51.13)152 (54.29)233 (49.26)Age (years, median [IQR])6.42 [4.50, 8.00]6.50 [4.50, 8.60]6.42 [4.50, 7.67]0.07Comorbidity (%)85 (11.29)28 (10.00)57 (12.05)0.46Co-infection (%)87 (11.55)36 (12.86)51 (10.78)0.46Fever Duration before Admission (days, median [IQR])6.00 [5.00, 8.00]6.00 [5.00, 7.00]6.00 [5.00, 8.00]0.88Cough Duration before Admission (days, median [IQR])6.00 [4.00, 7.00]6.00 [4.00, 7.00]6.00 [4.00, 8.00]0.21Severe/Critical Pneumonia (%)618 (82.07)238 (85.00)380 (80.34)0.13The Duration of Azithromycin Therapy before Admission (days, median [IQR])3.00 [2.00, 5.00]3.00 [2.00, 5.00]3.00 [2.00, 5.00]0.36Pre-admission Use of Glucocorticoid Therapy (%)176 (23.37)51 (18.21)125 (26.43)0.01*Requirement for Oxygen Support (%)96 (12.75)29 (10.36)67 (14.16)0.16Temperature (℃, median [IQR])37.40 [36.80, 38.20]37.40 [36.80, 38.20]37.40 [36.80, 38.20]0.65Pulse Rate (beats/min, mean (SD))122.00 [112.00, 132.00]122.00 [111.00, 133.00]122.00 [112.00, 132.00]0.84Respiratory Rate (breaths/min, median [IQR])30.00 [26.00, 32.00]30.00 [26.00, 32.00]30.00 [26.00, 32.00]0.66SpO2 (%, median [IQR])97.00 [96.00, 98.00]97.00 [96.00, 98.00]97.00 [96.00, 98.00]0.90Unless otherwise specified, values are presented as patient counts with correspondingpercentages in parenthesesFB Flexible Bronchoscopy, IQR Interquartile Range, SpO2 null Peripheral Capillary Oxygen Saturation *indicates p < 0.05 Subgroup analysis of clinical characteristics in the derivation cohort Unless otherwise specified, values are presented as patient counts with correspondingpercentages in parentheses FB Flexible Bronchoscopy, IQR Interquartile Range, SpO2 null Peripheral Capillary Oxygen Saturation *indicates p < 0.05 Table 3Subgroup analysis of radiological characteristics in the derivation cohortOverallFB-beneficial SubgroupFB-non-beneficial Subgroup p Number of Cases753280473Atelectasis (%)228 (30.28)77 (27.50)151 (31.92)0.23Pleural effusion (%)198 (26.29)69 (24.64)129 (27.27)0.48TLV (ml, median [IQR])1033.35 [772.40, 1392.83]1090.00 [794.38, 1492.21]1001.35 [762.03, 1362.49]0.06PV (ml, median [IQR])75.07 [41.39, 120.60]87.54 [50.19, 138.58]69.93 [37.80, 114.38]< 0.001*CAV (ml, median [IQR])17.58 [10.95, 25.91]23.48 [17.54, 32.17]13.65 [8.98, 21.14]< 0.001*GV (ml, median [IQR])56.25 [26.55, 96.44]61.73 [29.61, 104.30]53.37 [23.64, 91.67]0.06PA (HU, median [IQR])-458.57 [-495.79, -386.18]-430.08 [-468.26, -364.84]-476.37 [-511.57, -406.92]< 0.001*CAA (HU, median [IQR])-139.77 [-159.05, -108.73]-130.53 [-155.27, -103.71]-143.07 [-160.66, -112.17]< 0.001*GA (HU, median [IQR])-551.19 [-564.97, -538.88]-544.37 [-551.70, -535.54]-558.81 [-572.29, -544.55]< 0.001*Unless otherwise specified, values are presented as patient counts with correspondingpercentages in parenthesesIQR Interquartile Range, PV Volume of Pneumonia, CAV Volume of Consolidation and Atelectasis GV Volume of Ground-glass Opacities, PA Mean Attenuation ofPneumonia Lesions, CAA Mean Attenuation of Consolidation and Atelectasis, GA MeanAttenuation of Ground-glass Opacities, TLV Total Lung Volume*indicates p < 0.05 Subgroup analysis of radiological characteristics in the derivation cohort Unless otherwise specified, values are presented as patient counts with correspondingpercentages in parentheses IQR Interquartile Range, PV Volume of Pneumonia, CAV Volume of Consolidation and Atelectasis GV Volume of Ground-glass Opacities, PA Mean Attenuation ofPneumonia Lesions, CAA Mean Attenuation of Consolidation and Atelectasis, GA MeanAttenuation of Ground-glass Opacities, TLV Total Lung Volume *indicates p < 0.05 Characteristic analysis of the FB-beneficial subgroup in the validation cohort In the validation cohort (Table S9), the FB-beneficial subgroup was older than the FB-non-beneficial subgroup (median [IQR]: 9.00 [6.00, 11.00] vs. 7.00 [5.00, 8.00] years, p < 0.001). Other clinical features and pathogen distributions showed no significant differences. Consistent with the derivation cohort, Figure S4B reveals that only the radiological category had a higher proportion of abnormal values in the FB-beneficial subgroup than in the FB-non-beneficial subgroup (100.00% vs. 83.70%, p = 0.04). Specifically, CAV, PA, CAA, and GA were significantly elevated in the FB-beneficial subgroup (all p < 0.001; Table S9, Figure S4C). Furthermore, CAR was higher in the FB-beneficial subgroup (median [IQR]: 27.50% [20.72, 41.10] vs. 12.24% [8.58, 18.43], p < 0.001; Figure S4D). Supporting the main findings, the complete-case analysis (Table S8) also identified similar radiological trends within the validation cohort. Feature importance and interaction analysis As shown in Fig. 5A, the key features influencing FB efficacy on total fever duration included CAV, lymphocyte count, GA, PA, neutrophil count, monocyte count, CK, serum prealbumin, HCT, and ALT in the derivation cohort. Feature Importance and Heatmap Analysis. A Bar plot displaying feature importance for predicting total fever duration in the derivation cohort, ranked by variable splitting frequency in the causal forest model. B-D Heatmaps illustrating estimated individual treatment effects (ITEs) for flexible bronchoscopy (FB) use, conditional on consolidation/atelectasis volume (CAV) with varying levels of lymphocyte counts, mean attenuation of ground-glass opacity (GA), or mean attenuation of pneumonia lesions (PA), while other covariates are fixed at their median values. Abbreviations: CAV, Volume of Consolidation and Atelectasis; GA, Mean Attenuation of Ground-glass Opacities; PA, Mean Attenuation of Pneumonia Lesions; CK, Creatine Kinase; HCT, Hematocrit; ALT, Alanine Aminotransferase; ITE: Individual Treatment Effect Furthermore, heatmap analyses of the top four features in the derivation cohort demonstrated that increased CAV combined with higher lymphocyte count, GA, or PA, was consistently associated with smaller ITEs, indicating enhanced FB treatment effects (Fig. 5B-D). Discussion This study is the first to apply causal forest machine learning integrated with AI-quantified CT scores to predict individualized FB efficacy in pediatric MPP. Utilizing retrospective data from two independent medical centers, we developed and validated a causal forest-based model that identified FB-beneficial subgroups across both the derivation cohorts and key clinical subpopulations, including patients with atelectasis, varying age groups, and different pre-admission fever duration subsets. External validation further confirmed the model’s utility, demonstrating that FB significantly reduced total fever duration among predicted responders. Crucially, FB-beneficial subgroups exhibited a distinct radiological profile in both derivation and validation cohorts, with significantly elevated CAV, PA, CAA, and CAR (all p < 0.001). Heatmap analysis further revealed joint feature interactions, where higher CAV in combined with increased lymphocyte counts, GA, or PA correlated with improved FB efficacy. These findings address critical limitations in current guidelines for FB indications in pediatric pneumonia, which broadly recommend FB for recurrent or persistent consolidation, atelectasis, recurrent pneumonia, suspected airway obstruction/mucus plug formation, or plastic bronchitis [10, 11, 24, 32, 33]. However, it is important to note that these criteria lack standardized operational definitions, and their interpretation often varies across institutions and clinicians. Also, such recommendations do not account for the HTEs of FB among patients. In line with this concern, our findings demonstrated that not all MPP patients with consolidation or atelectasis benefited from FB treatment, consistent with Long et al.’s report that nearly one-third of atelectasis patients showed no benefit [14]. These results suggest that current indications for FB may lack precision and that decision-making strategies based primarily on qualitative imaging features are insufficient. In contrast, our model offers a more objective tool for stratifying patients and guiding FB therapy decisions. Although the overall reduction in fever duration was modest in both the derivation and validation cohorts (− 1.16 and − 0.68 days, respectively), the model’s primary value lies in identifying patients unlikely to benefit or potentially at risk, thereby supporting more personalized and appropriate use of FB. Previous studies have explored the characteristics of pediatric MPP patients who benefit from FB. Some research indicates that early FB intervention may reduce ICU length of stay and total hospitalization in severe MPP [34, 35], and FB treatment can accelerate clinical symptom recovery and radiological resolution in refractory MPP [36–38]. Another study using stratified analysis indicated that FB promoted radiological resolution only in patients with multi-lobar consolidation [39]. Nevertheless, these studies often suffered from methodological limitations. For instance, they primarily focused on average treatment effects rather than individual treatment effects. Additionally, their analyses centered on single-feature analyses, failed to comprehensively assess patient characteristics. Moreover, imaging assessments of these studies are often subjective, which limits their clinical applicability. Our study addresses these limitations by applying a causal forest framework that constructs an ensemble of decision trees incorporating “honest estimation” and cross‑fitting procedures [20, 21]. This enables accurate estimation of ITEs through the joint evaluation of multiple covariates, thereby yielding more detailed insights. To support routine clinical use, we have also developed an online tool that allows clinicians to obtain real-time, patient-specific predictions using our trained model. AI-driven quantitative lesion analysis were also used in this study to enable rapid, reproducible CT segmentation, generating objective scores within seconds [40]. Our results indicate that patients with a larger CAV and/or CAR are more likely to benefit from FB treatment. However, clinical and laboratory variables demonstrated consistently smaller differences between FB-beneficial and non-beneficial subgroups across both cohorts. The observed differences between CT-based scores and other variables can be explained by both pathophysiological and treatment mechanisms. High-attenuation consolidation or an increased CAR generally indicates mucus accumulation, protein-rich plugs, or lung collapse, serving as indirect indicators of airway pathology [9, 41]. In contrast, clinical variables such as duration of fever and laboratory variables like C-reactive protein primarily reflect overall disease severity, rather than specific airway involvement [24]. Considering FB primarily works by clearing airway obstructions and improving ventilation [42], its effectiveness is more closely related to airway lesion severity rather than to overall illness severity. Thus, quantitative CT scores that reflect airway obstruction, such as CAV and CAR, are more directly associated with the benefits of FB. Additionally, for patients with less consolidation or atelectasis, classified as the non-beneficial subgroup in this study, FB offers limited therapeutic gain and could even prolong fever due to procedure-related stress or transient airway inflammation [39, 43]. Despite these advances, our study has several limitations. Firstly, unmeasured confounders may persist despite an extensive set of laboratory and clinical variables inclusion and causal forest adjustment. Secondly, the model’s reliance on quantitative CT scores makes it unsuitable for early-stage screening or application in low-resource environments. Thirdly, this study defined clinical benefit narrowly as the acute-phase reduction in total fever duration. Owing to the retrospective design and data availability constraints, we were unable to assess other key components of a comprehensive benefit-risk assessment, including long-term outcomes such as pulmonary function, procedure-related complications, and healthcare costs. As a result, the clinical interpretability of predicted ITEs could not be fully assessed due to the lack of adverse event and cost data, highlighting the need for future prospective studies to evaluate the broader clinical and economic impact of FB. Additionally, while the validation results supported the generalizability of the model, its modest sample size and the observed attenuation of the effect size warrant cautious interpretation and external verification in larger, prospective cohorts. Finally, the binary FB exposure classification cannot assess optimal intervention timing. Future prospective studies are required to validate this model in multicenter settings, and incorporate longitudinal outcomes. Conclusion In summary, this study establishes the first causal forest-based framework integrating quantitative CT scores to personalize FB therapy for pediatric patients with MPP. Our results not only confirm significant heterogeneity in FB treatment effects in MPP but also identify high-volume, high-attenuation, and high-ratio consolidation and atelectasis as pivotal predictors of therapeutic efficacy. This validated model and online tool (https://htefb.shinyapps.io/shiny_ite_app/), are intended to support more individualized and precise decision-making regarding FB treatment for pediatric MPP. They may offer a convenient pathway to optimize therapeutic strategies, reduce unnecessary interventions, healthcare costs, and associated risks/complications, while improving resource allocation. Supplementary Information Supplementary Material 1. Acknowledgements None. Abbreviations Computed Tomography Mycoplasma pneumoniae Pneumonia Flexible Bronchoscopy Heterogeneous Treatment Effect Individual Treatment Effects Multivariable Linear Regression Receiver Operating Characteristic Volume of Pneumonia Volume of Consolidation/atelectasis Volume of Ground-glass Opacities Mean Attenuation of Pneumonia Lesions Mean Attenuation of Consolidation/atelectasis Mean Attenuation of Ground-glass Opacities Consolidation/atelectasis Ratio within Lesions Authors’ contributions ZY contributed to conceptualization, data curation, formal analysis, methodology, visualization, writing of the original draft, and review and editing. JL was involved in conceptualization, investigation, methodology, writing of the original draft, and review and editing. ZL, FY, and Zhuz contributed to methodology, data curation, and review and editing. GH, WH, and ZhenchenZ was responsible for formal analysis, methodology, and review and editing. BZ, MD, and XL contributed to methodology, and review and editing. ZZhou and WT contributed to methodology, visualization, and review and editing. ZJ contributed to funding acquisition, resources, and review and editing. LS and GY contributed to conceptualization, funding acquisition, project administration, resources, supervision, and review and editing. All authors read and approved the final version of the manuscript and accept responsibility for the decision to submit it for publication. Funding This work was supported by the National Natural Science Foundation of China (NSFC No. 82171934), the Medical Health Science and Technology Project of Zhejiang Provincial Health Commission (2023KY832) and Peking Union Medical College Hospital Talent Cultivation Program Category C (UBJ10148). Data availability Data will be available upon reasonable request to the corresponding author (via email) after institutional approval and with a signed data access agreement or with the permission of our hospital. Declarations Ethics approval and consent to participate The study was conducted in accordance with the Declaration of Helsinki. This study and all its protocols were approved by the Institutional ethic committee of Children’s Hospital, Zhejiang University School of Medicine and Rizhao Hospital of Traditional Chinese Medicine with approval numbers (2024-IRB-0189-P-01 and 2024-IRB-039), and individual consent for this retrospective analysis was waived. Consent for publication Not applicable. Competing interests ZZhou and WT were employed by Beijing Deepwise and League of PhD Technology Co. Ltd. Other authors declare that they have no competing interests. Footnotes Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Zhoumeng Ying and Jing Li contributed equally to this work. Contributor Information Lan Song, Email: songl@pumch.cn. Gang Yu, Email: yugbme@zju.edu.cn. References Associated Data Supplementary Materials Supplementary Material 1. Data Availability Statement Data will be available upon reasonable request to the corresponding author (via email) after institutional approval and with a signed data access agreement or with the permission of our hospital.