Abstract Background Cardiovascular disease (CVD) remains the leading cause of mortality worldwide, underscoring the need for accurate risk stratification tools to improve primary prevention. Traditional prediction models inadequately capture temporal dynamics and complex predictor interactions. Deep learning algorithms such as Transformer have emerged as promising candidates to effectively extract temporal patterns in CVD risk prediction. Purpose To develop and validate a Transformer-based Risk Assessment model for Cardiovascular diseases using Electronic health Records (TRACER), a deep learning framework that captures temporal dependencies in longitudinal phenotypes for 5-year CVD risk prediction. Methods We utilized data from the CHinese Electronic health Records Research in Yinzhou study (2010–2020), comprising 213,973 individuals aged 40-79 years without prior CVD. Participants were followed from baseline (last recorded before January 1, 2015) until the earliest occurrence of incident CVD, death, loss to follow-up, or January 1, 2020. Longitudinal data (2010-2015) were structured into time-series matrices encompassing 96 predictors across 10 domains: demographics, lifestyle factors, physical measurements, lipid and glucose metabolism markers, renal function markers, blood count parameters, inflammatory markers, cardiac function indicators, electrocardiogram-derived diagnoses, history of chronic diseases, and medication use. The outcome was a composite of CVD mortality, non-fatal myocardial infarction, and non-fatal stroke. The cohort was randomly allocated into derivation and validation sets (8:2). TRACER, a Long Short-Term Memory (LSTM) model, and a refitted SCORE2 model were compared against the original SCORE2 model in discrimination (C-index). The risk distribution was also evaluated. Results The study population (54.6% women, mean age 57.0 years) had mean values (standard deviation) of systolic blood pressure 134.3 (14.3) mmHg, total cholesterol 4.9 (0.9) mmol/L, and high-density lipoprotein cholesterol 1.3 (0.3) mmol/L. During a median follow-up of 6 years, 16,678 participants developed CVD. TRACER demonstrated superior discriminative performance (C-index: 0.8058, 95% confidence interval: 0.7988-0.8128) compared to LSTM model (0.8001, 0.7929-0.8073), refitted SCORE2 (0.7753, 0.7679-0.7828), and original SCORE2 (0.7521, 0.7519-0.7524). Compared to SCORE2, discrimination improvements were 0.0324 (0.0216-0.0432) for refitted SCORE2, 0.0572 (0.0465-0.0679) for LSTM, and 0.0629 (0.0524-0.0734) for TRACER. Risk stratification identified 41.6% of participants as low-to-moderate risk (5%), 20.1% as high risk (5%-10%), and 38.3% as very high risk (≥10%). Conclusions TRACER improved CVD risk prediction using readily accessible electronic health records predictors without additional measures. Its capability in capturing temporal dependencies highlights the potential for advancing CVD risk prediction in electronic health records.The input matrix and discrimination
Wang et al. (Sat,) studied this question.