Machine learning-enhanced prediction model for atrial fibrillation development in patients with concurrent type 2 diabetes and obstructive sleep apnea syndrome: a comorbidity perspective Authors: Yanan Xu, Shoupeng Duan, Wenyuan Yin, Yi Yang, Xianlin Zhang, Jun Wang Published: 2025 ABSTRACT AbstractIntroductionAtrial fibrillation (AF) presents a considerable challenge in patients with Type 2 diabetes and obstructive sleep apnea syndrome (OSAS), as metabolic disturbance plays a role in the pathophysiological mechanisms that underlie arrhythmias.ObjectiveThis study aimed to resolve this issue by developing a predictive nomogram using a machine learning algorithm, integrating a comprehensive range of clinical variables, including demographic data, laboratory findings, and sleep monitoring information.MethodsThis multicenter cohort study included patients with Type 2 diabetes who were scheduled for sleep monitoring for OSAS between January 2018 and December 2020. A predictive nomogram was developed using random forests and Cox regression analysis.ResultsWe utilized data from multiple hospitals to construct a development cohort comprising 417 participants and an independent validation cohort consisting of 245 participants. The nomogram was developed using four clinical variables: age, apnea-hypopnea index, triglyceride-glucose (TyG) index, and TyG-body mass index (BMI). The areas under the curve values, derived from 500 bootstrap samples, were 0.862 (95% confidence interval [CI]: 0.813–0.910) for predicting AF in the development group and 0.843 (95% CI: 0.753–0.918) in the independent validation group. The nomogram exhibited excellent calibration, as indicated by the strong concordance between predicted and observed AF incidences at 2-, 3-, and 4-year follow-ups, validated through 500 bootstrap samples. Decision curve analysis further substantiated the clinical utility of the prediction nomogram at these intervals. Furthermore, a user-friendly interface has been developed to enhance usability for clinicians.ConclusionsThis predictive model highlights the critical role of insulin resistance, as evidenced by TyG and TyG-BMI surrogate markers, in the prognostic assessment and early risk stratification of patients with AF over 2-, 3-, and 4-year periods among patients with Type 2 diabetes and OSAS.Trial registrationThe trial was registered in the Chinese Clinical Trial Registry (ChiCTR2300075727).Graphical abstract Supplementary InformationThe online version contains supplementary material available at 10.1186/s12986-025-01046-4.Keywords: Multivariable data, Atrial fibrillation, Insulin resistance, Apnea-hypopnea index, Prediction nomogram Introduction Diabetocardiology is increasingly recognized as a major complication of diabetes mellitus, leading to asymptomatic and symptomatic adverse cardiovascular events [1, 2]. The increasing prevalence of metabolic disorders, including diabetes mellitus, has coincided with an increase in the prevalence of adult obstructive sleep apnea syndrome (OSAS) [3]. The development and progression of OSAS is closely associated with insulin resistance, lipid metabolism disorders, and diabetes mellitus, essential components of metabolic syndrome [3, 4]. Furthermore, diabetes mellitus and OSAS exhibit intersecting pathophysiological mechanisms that facilitate atherosclerosis progression [3, 4]. The coexistence of diabetes mellitus and OSAS constitutes an independent and synergistic risk factor for adverse cardiovascular events, surpassing the risk associated with each condition individually. Therefore, clinicians and healthcare professionals must identify and screen for OSAS in patients with diabetes mellitus. Atrial fibrillation (AF) constitutes an increasingly substantial healthcare challenge and frequently coexists with metabolic disorders, including diabetes mellitus and OSAS [5–9]. OSAS is a common condition characterized by recurrent episodes of partial or complete upper airway obstruction during sleep, resulting in intermittent hypoxia and disrupted sleep patterns. OSAS has been identified as a substantial risk factor for AF [6, 7]. The pathophysiological mechanisms that associate OSAS with AF include intermittent hypoxia, oxidative stress, metabolic disturbances, and inflammation, all of which facilitate atrial remodeling and arrhythmogenesis [6, 7]. Previous literature has demonstrated that patients with OSAS frequently develop AF, and the severity of OSAS, assessed by the apnea-hypopnea index (AHI), is associated with an increased risk of AF [8]. Accumulating evidence indicates that diabetes mellitus, characterized by metabolic disorders, is a critical comorbidity that significantly affects AF incidence and management [9, 10]. The underlying mechanisms that predispose individuals to AF are etiology-dependent, highlighting the need for prediction model tools that address specific metabolic biomarker to enable early and timely intervention. Recently, machine learning (ML) techniques have garnered considerable attention because of their versatile modeling capabilities and proficiency in revealing complex patterns between input variables and outcomes, thus enhancing personalized therapeutic strategies [11–15]. These algorithms have been applied across numerous medical fields, demonstrating their increasing clinical significance and applicability [11–15]. Previous studies have demonstrated that ML models can effectively identify individuals at high risk for cardiovascular disease, even among those conventionally deemed low-risk, through the analysis of clinical risk factors [11–15]. However, ML methodologies have not been employed to predict the co-occurrence of Type 2 diabetes and OSAS. Thus, we employed ML techniques to create a model that detects AF risk subtypes in patients with Type 2 diabetes and OSAS, assisting clinicians in the clinical identification and intervention of high-risk groups. Methods Study design and participants We performed a multicenter cohort study analyzing the medical records of 662 consecutive patients with Type 2 diabetes and OSAS who were referred to our hospital for scheduled sleep monitoring from January 2018 to December 2020. Ethical approval for this study was obtained from the local research ethics committee (Approval No. 2022XE0103-1 and NO. KY2025060502). Detailed information concerning the inclusion and exclusion criteria is available in the Supplementary Materials Appendix. Sleep monitoring All participants were scheduled to undergo polysomnography utilizing the Grael system (Compumedics, Melbourne, VIC, Australia). This comprehensive diagnostic tool was utilized to record and assess various physiological metrics, including airflow, thoraco-abdominal movements, pulse oximetry, and snoring episodes. Sleep stages and arousal levels were evaluated based on established criteria [16]. AHI is a quantitative metric that indicates the frequency of apnea and hypopnea events per hour of sleep [16]. Laboratory tests The morning after admission, peripheral venous blood was collected from each patient to analyze fasting blood glucose (FBG), lipid levels, fibrinogen, kidney function parameters, and routine blood tests. The triglyceride-glucose (TyG) index, an indicator of insulin resistance, was calculated using the formula: ln [fasting triglyceride (mg/dL) × fasting glucose (mg/dL)/2] [17]. The body mass index (BMI) was calculated by dividing weight (kg) divided by the square of height (m2). The TyG-BMI, TyG-NC, and TyG-WC indices were calculated by multiplying the original TyG with BMI, neck circumference (NC), and waist circumference (WC), respectively [18]. The ratios of neutrophil-to-lymphocyte (NLR), platelet-to-lymphocyte (PLR), monocyte-to-HDL-C (MHR), and neutrophil-to-HDL-C (NHR) are dependable markers for evaluating systemic inflammation, a condition that is closely associated with cardiovascular disease [19, 20]. Clinical endpoint Following discharge, patients were monitored through routine clinical visits. AF events were identified by identifying AF episodes lasting at least 30 s during the follow-up duration [5]. Herein, the primary method for AF detection was 24-h Holter monitoring. Furthermore, standard electrocardiography (ECG) recordings obtained during clinical consultations were thoroughly examined and considered. Model development The random forest algorithm, an ML technique, is an ensemble learning method that integrates multiple regression trees based on data. It employs a random subset of predictor variables for each model to predict the response variable [21]. Random forest propagates variable importance across all variables to address highly collinear predators [21]. Variable importance is assessed by the increase in node purity, reflecting the decrease in the residual sum of squares when splitting regression trees with various predictor variables [21]. Herein, the random forest algorithm was utilized on the training cohort data to identify potential predictors of AF from a comprehensive set of 49 variables, encompassing demographic characteristics, laboratory examination results, and sleep monitoring data (Table 1). Subsequently, to enhance the selection of variables and account for confounding factors, multivariate analysis using backward stepwise Cox regression was performed. The efficacy of the prediction nomogram was assessed using three methods: discrimination, calibration, and clinical utility. First, the discriminatory capacity of the model was assessed by calculating Harrell’s concordance index (C-index) and area under the curve (AUC) values. Furthermore, the C-indexes were adjusted using bootstrapping to assess expected predictive accuracy for the future (500 times sampling). Second, the calibration of the model was assessed using calibration plots generated from 500 bootstrap replications, comparing the predicted probabilities of AF at 2-, 3-, and 4-years with the actual observed probabilities. Third, the net benefit of the nomogram was assessed at various threshold probabilities through decision curve analysis (DCA). Kaplan–Meier survival analysis was performed to assess the potential predictive effectiveness of the nomogram in high-risk and low-risk groups, classified according to the median nomogram score. Table 1Baseline characteristics of patients and occurrence of AF (clinical outcome) in the development and independent validation groupCharacteristic or OutcomeTotal cohort(n = 662)Development group(n = 417)Independent Validation group(n = 245) P Male sex, n (%)489 (73.87%)309 (74.10%)180 (73.47%)0.931Age, years54.00 [47.00;61.00]54.00 [47.00;61.00]55.00 [46.00;62.00]0.981Coronary heart disease, n (%)347 (52.42%)215 (51.56%)132 (53.88%)0.620Current smoking, n (%)278 (41.99%)170 (40.77%)108 (44.08%)0.452Current alcohol consumption, n (%)258 (38.97%)162 (38.85%)96 (39.18%)0.998Hypertension, n (%)183 (27.64%)121 (29.02%)62 (25.31%)0.347Impaired glucose tolerance, n (%)101 (15.26%)65 (15.59%)36 (14.69%)0.844Family history of CAD, n (%)107 (16.16%)64 (15.35%)43 (17.55%)0.526Family history of diabetes, n (%)86 (12.99%)54 (12.95%)32 (13.06%)1.000Family history of hypertension, n (%)237 (35.80%)151 (36.21%)86 (35.10%)0.839Non-alcoholic fatty liver disease, n (%)372 (56.19%)230 (55.16%)142 (57.96%)0.535BMI, kg/m227.79 [25.66;31.14]27.75 [25.72;31.14]28.03 [25.35;31.10]0.855Neck circumference, cm40.00 [38.00;44.00]40.00 [38.00;44.00]40.00 [38.00;44.00]0.796Waist circumference, cm98.00 [89.00;107.00]98.00 [89.00;108.00]97.00 [89.00;107.00]0.835Fasting blood glucose, mmol/L5.31 [4.75;6.35]5.29 [4.73;6.32]5.43 [4.77;6.44]0.353High-density lipoprotein cholesterol, mmol/L1.23 [1.07;1.39]1.24 [1.08;1.39]1.21 [1.06;1.37]0.445Low-density lipoprotein cholesterol, mmol/L2.27 [1.77;2.75]2.29 [1.77;2.73]2.24 [1.77;2.79]0.750Very low-density lipoprotein cholesterol, mmol/L0.71 [0.52;0.98]0.73 [0.55;0.97]0.69 [0.49;0.98]0.127Total cholesterol, mmol/L4.28 [3.57;4.95]4.30 [3.68;4.95]4.25 [3.46;4.90]0.745Triglyceride, mmol/L1.64 [1.18;2.30]1.68 [1.23;2.35]1.59 [1.11;2.22]0.078TyG index8.91 [8.50;9.33]8.92 [8.56;9.35]8.85 [8.45;9.29]0.241TyG-BMI251.12 [225.42;284.54]251.21 [226.85;283.85]250.18 [222.88;286.91]0.862TyG-WC870.91 [771.11;979.55]875.17 [776.73;981.95]868.72 [767.52;976.42]0.510TyG-NC362.54 [329.61;398.52]362.94 [331.85;402.34]359.38 [327.92;396.80]0.501Apolipoprotein A1, g/L1.22 [1.11;1.36]1.22 [1.12;1.36]1.22 [1.10;1.36]0.788Apolipoprotein B, g/L0.92 (0.23)0.93 (0.23)0.91 (0.23)0.372Lipoprotein (a), mg/L123.78 [61.03;262.47]122.63 [65.27;259.98]126.23 [55.99;270.22]0.908Creatinine, μmol/L77.00 [65.35;87.00]77.70 [65.00;87.00]76.00 [65.90;86.00]0.706Urea nitrogen, mmol/L5.30 [4.60;6.20]5.30 [4.50;6.20]5.30 [4.60;6.20]0.836Uric acid, µmol/L346.65 [294.85;403.37]345.70 [293.00;401.60]348.00 [297.80;406.00]0.732Fibrinogen, g/L2.94 [2.56;3.41]2.94 [2.58;3.38]2.94 [2.54;3.43]0.922Hemoglobin, g/L149.00 [138.00;159.00]149.00 [138.00;159.00]149.00 [138.00;159.00]0.738White blood cell count, 10⁹/L6.54 [5.58;7.69]6.53 [5.59;7.61]6.55 [5.54;7.76]0.564Neutrophil count, 10⁹/L4.23 [3.25;5.57]4.32 [3.33;5.61]4.12 [3.18;5.47]0.256Lymphocyte count, 10⁹/L2.26 [1.82;2.81]2.27 [1.86;2.84]2.26 [1.76;2.79]0.345Neutrophil count/Lymphocyte count1.87 [1.51;2.38]1.89 [1.51;2.40]1.83 [1.52;2.31]0.661Platelet count, 10⁹/L233.00 [196.00;272.00]232.00 [193.00;274.00]235.00 [200.00;269.00]0.430Platelet count/Lymphocyte count104.25 [80.45;135.27]101.63 [79.03;132.97]107.47 [80.77;139.25]0.131Platelet distribution width, %12.00 [10.90;13.40]12.00 [11.10;13.40]11.80 [10.80;13.40]0.166Mean platelet volume, fL10.30 [9.70;11.00]10.30 [9.80;11.00]10.20 [9.60;10.90]0.198Monocyte count, 10⁹/L0.46 [0.36;0.65]0.46 [0.35;0.63]0.46 [0.36;0.67]0.711Neutrophil count/High-density lipoprotein cholesterol3.53 [2.62;4.66]3.57 [2.67;4.64]3.52 [2.48;4.68]0.345Monocyte count/High-density lipoprotein cholesterol0.38 [0.28;0.56]0.37 [0.28;0.55]0.39 [0.29;0.59]0.535Apnea hypopnea index15.00 [7.90;27.25]15.00 [7.60;26.80]15.00 [8.70;27.40]0.464Average blood oxygen saturation92.00 [90.00;93.00]92.00 [90.00;93.00]92.00 [90.00;93.00]0.621Lowest heart rate during sleep, beats/min58.00 [52.00;63.00]58.00 [53.00;63.00]58.00 [52.00;62.00]0.536Highest heart rate during sleep, beats/min79.00 [73.00;86.00]79.00 [73.00;86.00]78.00 [72.00;87.00]0.400Mean heart rate during sleep, beats/min66.00 [60.00;71.00]66.00 [61.00;72.00]66.00 [60.00;71.00]0.349Continuous postive airway pressure, n (%)84 (12.69%)54 (12.95%)30 (12.24%)0.887 Clinical endpoint Atrial fibrillation, n (%)71 (10.73%)49 (11.75%)22 (8.98%)0.326Continuous variables are presented as mean (standard deviation) for normally distributed data or median [interquartile range] for non-normally distributed data. Categorical variables are presented as number (percentage).CAD, coronary artery disease; BMI: body mass index; TyG, triglyceride-glucose; TyG-neck circumference (TyG-NC), and TyG-waist circumference (TyG-WC) Baseline characteristics of patients and occurrence of AF (clinical outcome) in the development and independent validation group Continuous variables are presented as mean (standard deviation) for normally distributed data or median [interquartile range] for non-normally distributed data. Categorical variables are presented as number (percentage).CAD, coronary artery disease; BMI: body mass index; TyG, triglyceride-glucose; TyG-neck circumference (TyG-NC), and TyG-waist circumference (TyG-WC) Feature selection and model explanation Obtaining accurate interpretations of ML models poses a significant challenge. The Shapley Additive Explanations (SHAP) method provides a framework for ranking the significance of input features and elucidating prediction results, thereby effectively mitigating the inherent ‘black box’ issue [22]. SHAP value-assisted feature selection was utilized to reduce the prediction model from 49 to 7 features according to their importance ranking. Consequently, the final model with enhanced predictive capability was selected for further analysis. The SHAP method offers global and local explanations for model interpretation. The global explanation offers consistent and accurate attribution values for each feature within the model, revealing the associations between input features and AF. However, the local explanation demonstrates specific predictions for an individual with OSA and Type 2 diabetes by inputting their respective data. Statistical analysis Statistical Package for the Social Sciences software (version 26) and R software (version 4.2.2) were utilized for statistical analyses of the study outcomes. For categorical variables, we presented data as counts and percentages, while continuous variables are described using medians with interquartile ranges or mean with standard deviations, depending on their distribution. We utilized the Mann–Whitney U test to compare continuous variables with non-normal distributions between the training and independent validation groups. Categorical variables were assessed using either Fisher’s exact test or the chi-squared (χ²) test, as appropriate. The Kaplan–Meier method was used to analyze the median incidence of AF, accompanied by a 95% confidence interval (CI). A two-tailed P < 0.05 was considered statistically significant. Results Clinical characteristics We utilized data from multiple hospitals to establish study cohorts, with participants stratified by hospital source into a development cohort of 417 participants and an independent validation cohort of 245 participants derived from separate institutions. The mean age of the included patients was 54.5 years, and 489 (73.87%) were male (Table 1). The mean follow-up period was 45.82 months, during which 71 (10.7%) patients developed AF. We employed data from various hospitals to build a development group of 417 participants and an independent validation group of 245 participants. No significant differences were observed in the baseline clinical characteristics between patients with Type 2 diabetes and those with OSAS, thereby supporting their use as development and independent validation groups. Construction of the nomogram The development group data was utilized to apply the random forest algorithm, identifying seven potential predictors of AF from 49 variables, including demographic characteristics, laboratory examination results, and sleep monitoring data (Table 1). The random forest algorithm was employed to identify prognostic factors (Figs. 1, 2 and 3). We identified age, average blood oxygen saturation, fasting blood glucose, TyG-NC, TyG, TyG-BMI, and AHI using the random forest algorithm. Subsequent multivariate analysis utilizing backward stepwise Cox regression revealed that age (hazard ratio [HR]: 1.087, 95% confidence interval CI: 1.061–1.114, P < 0.001), TyG index (HR: 1.689, 95% CI: 1.152–2.478, P = 0.007), TyG-BMI index (HR: 1.011, 95% CI: 1.005–1.016, P < 0.001), and AHI (HR: 1.022, 95% CI: 1.009–1.036, P = 0.001) were independent risk factors for AF (Fig. 4). Thus, these four specific variables were employed to develop a predictive nomogram for the probability of AF at 2-, 3-, and 4- years among patients with Type 2 diabetes and OSAS (Fig. 5). Average classification rate of the random forest classifier according to the number of trees (A). Ranking according to feature importance, determined using a random forest classifier (B) Comprehensive analysis of feature importance using the SurvSHAP (t) model, encompassing both aggregated feature importance and the temporal evolution of feature importance. (A) Significance of various features. Each bar represents the average SurvSHAP (t) value for a specific feature, with higher values indicating greater importance in the model’s predictions. (B) Dynamic changes in feature importance over time, titled “Ranger.” The x-axis denotes time from 0 to 48, while the y-axis represents the corresponding SurvSHAP (t) values. Different colored lines correspond to distinct features listed, providing insight into how each feature’s importance evolves over time Aggregated summary plot of SurvSHAP(t), which is utilized to analyze the contributions of different variables in a Ranger model. The SurvSHAP values, derived from SHAP, are employed to elucidate the outputs generated by ML models. The horizontal axis depicts the aggregated SurvSHAP (t) values, ranging from negative to positive, indicating whether each factor’s contribution to the model output is positive or negative. Adjacent to each variable, multiple points are displayed. The horizontal position of these points signifies the influence value exerted by the variable on the model’s prediction. Furthermore, the color intensity of these points corresponds to the magnitude of their respective variable values; darker colors indicate larger values Forest plot of HRs for independent prognostic variables identified by multivariate Cox regression in the development group Prediction nomogram developed from variable identified by multivariate Cox regression analysis. The top row displays the values of each clinical characteristic, which are used to assign points in each case. The cumulative point values are subsequently combined into a unified matrix in the central row. To ascertain the risk of AF, the cumulative point totals are used to trace a vertical line across the lower three rows Diagnostic performance of the nomogram The concordance index (C-index), calculated using 500 bootstrap samples, was 0.862 (95% CI: 0.813–0.910) for predicting AF in the development group and 0.843 (95% CI: 0.753–0.918) in the independent validation group. Receiver operating characteristic (ROC) curve analysis yielded AUC values for the nomogram’s prognostic potential for 2-, 3- and 4-year AF risks of 0.877 (95% CI: 0.788–0.965), 0.867 (95% CI: 0.808–0.926), and 0.878 (95% CI: 0.828–0.928), respectively, in the development group. The corresponding values were 0.941 (95% CI: 0.905–0.978), 0.875 (95% CI: 0.783–0.968), and 0.85(95% CI: 0.759–0.94), respectively, in the independent validation group (Fig. 6A-B). Calibration plots indicated good consistency between the predicted 2-, 3-, and 4-year AF probabilities derived from the nomogram and the observed outcomes in the development and independent validation groups (Fig. 7A-B). Furthermore, DCA analysis revealed that the threshold probability ranges for predicting AF risk were 1%–40% over 2 years, 2%–60% over 3 years, and 3%–75% over 4 years in the development cohort (Supplemental Figs. 1A–C). Similarly, in the independent validation cohort, the corresponding threshold probability ranges were 1%–35% for 2-year AF risk, 1%–60% for 3-year AF risk, and 3%–70% for 4-year AF risk (Supplemental Figs. 1D–F). Furthermore, DCA revealed that the net benefit rate of the prediction nomogram surpassed that of the individual models associated with each of the four dependent variables (age, TyG index, TyG-BMI, and AHI) in development (Supplemental Figs. 2A–C) and independent validation groups (Supplemental Figs. 2D–F). The stratification of 21 patients into high- and low-risk groups was accomplished by utilizing the median risk score in development and independent validation groups (Supplemental Figs. 3A-B). Kaplan–Meier analysis revealed that the frequency of AF was significantly greater in the high-risk group than in the low-risk group in development and independent validation groups (P < 0.001). Predictive accuracy of the nomogram for AF was evaluated through ROC curve analysis in (A) development and (B) independent validation groups Calibration curves for 2- and 3-year AF risk predictors in (A) development and (B) independent validation groups Dynamic nomogram We developed an online, user-friendly platform, the CycleDream Platform (https://cycleosas.shinyapps.io/dynnomapp/), to facilitate the application of our model. This platform included a simplified risk model with four features for AF prediction. Users can predict AF risk by entering the values for age, TyG, TyG-BMI, and AHI into the corresponding text boxes on the CycleDream Platform (Fig. 8). It is important to ensure that the units of these variables are consistent with the interface requirements. Upon submission, the platform calculates and displays a 4-year probability of AF. The CycleDream Platform, a dynamic nomogram calculator, is utilized to discriminate AF risk based on four key features. The provided image showcases the dynamic nomogram interface used for predicting freedom from AF probabilities. On the left side, adjustable sliders allow modification of parameters such as age, TyG index, TyG-BMI, and AHI. On the right side, a survival plot illustrates the estimated probability of remaining free from AF over time, with the x-axis representing time and the y-axis representing the probability of freedom from AF. This plot demonstrates a gradual decline in the probability of remaining free from AF as time progresses Discussion This multicenter cohort study provides robust evidence that integrating metabolic dysfunction metrics with sleep-disordered breathing parameters significantly improves AF risk prediction in patients with Type 2 diabetes and OSAS. The resultant nomogram demonstrates superior discrimination, calibration, and DCA across various time frames, serving as an essential tool for risk stratification and clinical decision-making. The interplay of age, TyG, TyG-BMI, and AHI reveals a synergistic pathophysiological interaction wherein intermittent hypoxia from OSAS exacerbates metabolic disturbances, fostering a proarrhythmic milieu that persists beyond conventional risk factor limits (Graphical abstract). The clinical management of AF requires a multimodal and personalized care approach, considering the patient’s age, symptom severity, risk factors, comorbidities, and disease progression [5, 10]. Alongside the established concepts of electrical and structural remodeling, a growing body of research highlights significant alterations in cellular metabolism associated with AF [10]. These alterations, termed metabolic remodeling, encompass changes in metabolic pathways and energy balance within the atrial myocardium. This metabolic remodeling may impair atrial function and catalyze the onset and perpetuation of AF. The mechanisms underlying individual susceptibility to AF are dependent on specific etiologies, highlighting the need for personalized therapeutic approaches that consider an individual’s metabolic profile. AF can induce alterations in glucose, lipid, and ketone metabolism, mitochondrial function, and myofibrillar energetics, a process known as “metabolic remodeling,” which collectively leads to atrial dysfunction [10]. The pathophysiological mechanisms underlying the increased risk of AF in patients with diabetes mellitus or OSAS include shared factors, including metabolic disturbances [10]. Accordingly, clinical awareness of this synergistic risk is essential for AF prevention and management in patients with diabetes mellitus and OSAS, as prompt intervention and treatment of both conditions may reduce the risk of AF and enhance overall cardiovascular outcomes. Despite the well-established associations between AF and diabetes mellitus and OSAS [23]– [24], conventional risk factors frequently demonstrate limited accuracy in predicting individual patient risk levels. This limitation establishes a significant deficiency in current clinical practice. Therefore, integrating comprehensive multivariable data to develop a predictive risk score for early-stage disease progression is essential for enhancing treatment planning. We utilized the random forest algorithm, an ML technique, to effectively identify predictors for a nomogram intended to estimate the 2-year, 3-year, and 4-year risk of AF in patients with Type 2 diabetes and OSAS. This nomogram is based on the TyG index, TyG-BMI (a marker of insulin resistance), age, and the AHI. The prediction nomogram was first developed using a training cohort, and its efficacy was evaluated in an independent validation cohort by calculating AUC values, the concordance index, calibration curves, and DCA. Our model exhibited robust predictive efficacy, indicating that the selected variables offer substantial insights into the underlying pathophysiology of AF. Furthermore, we examined the potential of existing and emerging therapeutic strategies to address metabolic remodeling in the context of AF, highlighting critical questions and challenges that must be resolved to enhance patient outcomes. TyG and TyG-BMI indices are recognized as reliable surrogate markers for insulin resistance, a significant risk factor for cardiovascular diseases [18]– [25]. Extensive studies have demonstrated a strong correlation between these indices and cardiovascular health, highlighting their potential in predicting cardiovascular risk and disease severity [18]– [25]. A recent study investigating the predictive value of non-insulin-based insulin resistance indices for AF recurrence after ablation revealed that TyG and TyG-BMI indices were independent risk factors for AF recurrence [26]. Furthermore, a previous study has demonstrated that among different non-insulin-based indices, the TyG-BMI index exhibited the highest predictive value for AF recurrence, followed by the metabolic score for insulin resistance [26]. This indicates that these indices may function as essential instruments in identifying patients at higher risk of AF recurrence, thereby facilitating management and prevention strategies for AF. The increased TyG and TyG-BMI indices in our study group highlight the significant predictive value of insulin resistance for the early onset of AF. The concept of personalized medicine increasingly emphasizes disease-specific risk stratification rather than universal prediction models, particularly relevant when distinct pathophysiological mechanisms drive clinical outcomes [27–33]. While general population models such as those developed by Hill et al. [34], analyzing nearly 3 million adults with time-varying neural networks (AUROC 0.827), effectively capture temporal dynamics of conventional cardiovascular risk factors through routine electronic health records, such approaches may inadequately address specialized high-risk cohorts. Our investigation targets the mechanistically distinct population with coexisting T2DM and OSAS, where synergistic metabolic-respiratory pathophysiology necessitates disease-specific predictors. By incorporating age, polysomnographic parameters (AHI) alongside insulin resistance markers (TyG, TyG-BMI), our model captures arrhythmogenic mechanisms unique to this vulnerable population that general cardiovascular risk models may not adequately represent. Furthermore, it is essential to develop a simplified AF risk calculator that incorporates the proposed variables and effectively assesses their relative significance in predicting 2-, 3-, and 4-year AF episodes, with the aim of enhancing clinical accessibility. The CycleDream Platform is designed to optimize AF risk prediction, allowing healthcare professionals to assess patient AF risk prediction efficiently and accurately. Users can input the values of the specific clinical parameters into the designated text boxes while adhering to interface specifications. Upon submission, the CycleDream platform computes and presents the probability of AF risk. The CycleDream Platform integrates these commonly used clinical indicators, offering a convenient tool for risk assessment and facilitating early identification of high-risk patients, thereby aiding in implementing more effective preventive measures. However, our future research aims to provide clinicians with more precise tools for risk stratification among patients with OSA. We will conduct additional large-scale prospective cohort studies to validate the robustness and reliability of this risk calculator across diverse populations and settings. Study limitations First, our investigation was limited by a relatively small sample size. An extensive prospective cohort study is needed to validate the predictive performance of the nomogram. Second, the exclusion of dynamic biomarkers, including continuous glucose monitoring data, may result in an underestimation of the role of metabolic variability in AF pathogenesis. Third, the dependence on ECG or dynamic electrocardiography as primary diagnostic methods might restrict the identification of paroxysmal and asymptomatic AF. Due to the sporadic nature of paroxysmal AF and the absence of symptoms in silent AF, identifying these conditions without continuous surveillance is particularly challenging. Compared to standard 24-h ECG recordings, implantable loop recorders and smartwatches provide enhanced and more extensive monitoring capabilities. Fourth, at baseline, patients with very infrequent paroxysmal AF may have been inadvertently included despite negative recordings, though comprehensive medical record review and exclusion of any prior AF documentation mitigated this risk. Fifth, the retrospective design precludes systematic quantification of AF burden, limiting outcome assessment to binary AF presence versus absence and preventing examination of relationships between predicted risk and AF severity. Sixth, it is crucial to acknowledge that the predictive outcomes generated by the nomogram are based on the assumption of constant disease progression over time. Considering that disease outcomes can be affected by various factors, including enhanced treatment alternatives, prompt diagnosis, and changes in the natural progression of the disease, the precision of the nomogram may be diminished over an extended period. Although the interface enhances accessibility, real-world implementation requires validation across diverse healthcare settings with varying resource availability. Finally, our study cohort was derived exclusively from Chinese populations across multiple centers, which limits the generalizability of our findings to individuals of other ethnic and racial backgrounds. Ethnic differences in metabolic phenotypes, body composition, craniofacial anatomy, genetic variants, and baseline atrial fibrillation risk may influence the performance characteristics of our predictive model when applied to non-Asian populations. External validation in ethnically diverse cohorts is essential before widespread clinical implementation. Conclusions Our study underscores the critical significance of metabolic dysregulation, specifically insulin resistance measured by TyG and TyG-BMI surrogate markers, in predicting AF among patients with Type 2 diabetes and OSAS. The findings present a new, accessible framework for early intervention, which could significantly enhance care pathways and improve long-term outcomes for this vulnerable patient population. Supplementary Information Supplementary Material 1 Acknowledgements None. Author contributions Y.X., S.D. W.Y.,X.Z., and J.W. conceived and performed the study. J.W. and Y.X. performed the clinical study and wrote the manuscript. Y.Y., J.W. and Y.X. performed data collection and analysis. All authors contributed to the article and approved the submitted version. Funding Clinical and Translational Research Project of Anhui Province (202427b10020086, 202427b10020089), Anhui Provincial Health and Health Commission Scientific Research Project (AHWJ2024Aa10053), Youth Embarking at Xinjiang Medical University (2022YFY-QKMS-08) and Open Research Proiect of Hubei Clinical Medical Research Center for Atherosclerotic Cardiovascular Diseases (2025ASCYD07, 2025ASCVD09). Data availability Individual participant data that underlie the results reported in this article, after de-identification can be obtained from the corresponding author upon reasonable request. Declarations Ethics approval and consent to participate Ethical approval for this study was granted by the local research ethics committee (Xinjiang Medical University Affiliated Hospital of Traditional Chinese Medicine, NO. 2022XE0103-1 and People’s Hospital of Xinjiang Uygur Autonomous Region, NO. KY2025060502). Because of the retrospective design of the study, the need to obtain informed consent from eligible patients 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. Yanan Xu, Shoupeng Duan and Wenyuan Yin contributed equally to this work. Contributor Information Yi Yang, Email: 644956539@qq.com. Xianlin Zhang, Email: zxlmas@163.com. Jun Wang, Email: junwang0607@163.com. References Associated Data Supplementary Materials Supplementary Material 1 Data Availability Statement Individual participant data that underlie the results reported in this article, after de-identification can be obtained from the corresponding author upon reasonable request.