A machine learning model to simplify recognition of patients with atrial fibrillation based on diagnostic codes in Swedish primary health care
Atrial fibrillation (AF) is a major risk factor for atherothrombotic complications but is often asymptomatic and undiagnosed. This study aimed to develop a machine learning model to distinguish between individuals with low and high risk of AF, using routinely collected diagnostic data from Swedish primary health care. Cases (n = 42,607, aged ≥ 45 years) with diagnosed new onset AF and controls (n = 427,169) matched by age and sex. Machine learning models stratified for age (45–69 and ≥ 70 years) and sex were developed using stochastic gradient boosting, based on number of primary health care visits during the year before the index AF diagnosis, age, and ICD-10 codes from electronic medical records 2014–2019. Performance was evaluated by AUC, sensitivity and specificity, and key predictors ranked by normalized relative influence (NRI) and odds ratios for marginal effects. The most influential predictors were the number of visits (NRI: 29.9–46.3%) and age (NRI: 6.2–15.9%), followed by risk factors for AF such as heart failure, hypertension, and cardiac arrhythmias. Model AUC ranged from 0.77 to 0.79 across subgroups. Sensitivity was 0.76–0.80, and specificity 0.58–0.66, with higher sensitivity in older groups and higher specificity in younger ones. The models correctly identified 95–98% of individuals without known AF. The models show good predictive ability, effectively ruling out low-risk patients while identifying known risk factors. With AUC values comparable to more complex models, our approach using only visit frequency, age, and diagnoses may support initial risk assessment in primary health care for identifying individuals at risk of AF.
Authors
- Caroline Wachtler (ORCID: https://orcid.org/0000-0002-1317-7732)
- Per Wändell (ORCID: https://orcid.org/0000-0001-5169-2965)
- Thomas Kahan (ORCID: https://orcid.org/0000-0001-9909-4956)
- Boel Brynedal (ORCID: https://orcid.org/0000-0002-7872-2981)
- Toralph Ruge (ORCID: https://orcid.org/0000-0002-1170-5183)
- Jan Hasselström (ORCID: https://orcid.org/0000-0001-9521-2345)
- Axel C. Carlsson
- Anders Norrman
- Julia Eriksson
Institutions
- Lund University (SE)
- Karolinska Institutet (SE)
- Stockholm Health Care Services (SE)
- Skåne University Hospital (SE)
- Centre for Palaeogenetics (SE)
Publication Details
- Journal
- BMC Medical Informatics and Decision Making
- Published
- 2026-04-17
- DOI
- https://doi.org/10.1186/s12911-026-03491-4
- Primary Topic
- Atrial Fibrillation Management and Outcomes
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Karolinska Institutet