Skip to main content

Lund University Publications

LUND UNIVERSITY LIBRARIES

A machine learning model to simplify recognition of patients with atrial fibrillation based on diagnostic codes in Swedish primary health care

Norrman, Anders ; Wachtler, Caroline ; Wändell, Per LU ; Eriksson, Julia ; Ruge, Toralph LU ; Brynedal, Boel ; Hasselström, Jan ; Kahan, Thomas and Carlsson, Axel C. (2026) In BMC Medical Informatics and Decision Making 26(1).
Abstract

Background: 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. Methods: 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.... (More)

Background: 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. Methods: 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. Results: 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. Conclusions: 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.

(Less)
Please use this url to cite or link to this publication:
author
; ; ; ; ; ; ; and
organization
publishing date
type
Contribution to journal
publication status
published
subject
keywords
Artificial intelligence, Atrial fibrillation, Gradient boosting, Normalized relative influence, Prediction
in
BMC Medical Informatics and Decision Making
volume
26
issue
1
article number
126
publisher
BioMed Central (BMC)
external identifiers
  • pmid:41998624
  • scopus:105036190846
ISSN
1472-6947
DOI
10.1186/s12911-026-03491-4
language
English
LU publication?
yes
id
b855a9ab-5bb5-48d8-a648-ae4126300c7a
date added to LUP
2026-05-27 15:17:48
date last changed
2026-07-24 02:19:43
@article{b855a9ab-5bb5-48d8-a648-ae4126300c7a,
  abstract     = {{<p>Background: 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. Methods: 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. Results: 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. Conclusions: 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.</p>}},
  author       = {{Norrman, Anders and Wachtler, Caroline and Wändell, Per and Eriksson, Julia and Ruge, Toralph and Brynedal, Boel and Hasselström, Jan and Kahan, Thomas and Carlsson, Axel C.}},
  issn         = {{1472-6947}},
  keywords     = {{Artificial intelligence; Atrial fibrillation; Gradient boosting; Normalized relative influence; Prediction}},
  language     = {{eng}},
  number       = {{1}},
  publisher    = {{BioMed Central (BMC)}},
  series       = {{BMC Medical Informatics and Decision Making}},
  title        = {{A machine learning model to simplify recognition of patients with atrial fibrillation based on diagnostic codes in Swedish primary health care}},
  url          = {{http://dx.doi.org/10.1186/s12911-026-03491-4}},
  doi          = {{10.1186/s12911-026-03491-4}},
  volume       = {{26}},
  year         = {{2026}},
}