# A machine learning tool for predicting newly diagnosed osteoporosis in primary healthcare in the Stockholm Region

**Authors:** Per Wändell, Axel C. Carlsson, Per Swärd, Julia Eriksson, Johan Ärnlöv, Andreas Rosenblad, Caroline Wachtler, Toralph Ruge

PMC · DOI: 10.1038/s41598-025-24450-5 · Scientific Reports · 2025-10-20

## TL;DR

This study developed a machine learning tool to predict new osteoporosis diagnoses in primary healthcare, showing that frequent visits and certain symptoms are strong indicators.

## Contribution

A novel machine learning model using primary care diagnoses to predict osteoporosis with high accuracy across age and sex groups.

## Key findings

- The number of primary care visits strongly predicted new osteoporosis diagnoses across all age and sex groups.
- Unspecific musculoskeletal diagnoses like Dorsalgia showed high predictive value for osteoporosis risk.
- Hypertension was a strong predictor for older patients (>65 years) but not for those aged 40–65.

## Abstract

Improving accuracy and timeliness for osteoporosis diagnosis could help prevent fragility fractures, morbidity, and mortality for older individuals. Osteoporosis is an often silent health condition, especially as regards vertebral fractures, and WHO issued a call to action for primary care to lead efforts in screening, assessing, and managing diseases such as osteoporosis. We used a machine learning method, Stochastic Gradient Boosting (SGB), to identify what diagnoses in a primary care setting predict a new osteoporosis diagnosis, using a sex- and age-matched case–control design. Cases of new osteoporosis (ICD-10 code: M80, M81, M82) were identified across all outpatient care settings during 2012–2019. We included individuals aged ≥ 40 years old, stratified by sex and age-groups 40–65 years and > 65 years old. Controls were sampled from outpatients that did not have osteoporosis at any time during 2010–2019. Using the SGB model, we ranked the most important diagnoses related to newly diagnosed osteoporosis, presented as the normalized relative influence (NRI) score with a corresponding odds ratio of marginal effects (ORME) of being newly diagnosed with osteoporosis. A train-test approach was used to develop the model, with the performance evaluated using area under the curve (AUC). In total, we included 30,741 patients with osteoporosis aged ≥ 40 years. AUC was high, > 0.899 for all age and sex stratas. The number of visits to primary care in the year prior to the osteoporosis diagnosis contributed with the most predictive information for all age and sex stratas. For all age groups several other factors also showed high NRI and ORME and among them many unspecific diagnoses such as Dorsalgia showed high NRI, (2.6–9.0%) and other painful musculoskeletal disorders. However, our study also showed that the diagnosis of Hypertension had a very high NRI for patients aged > 65 years but not in patients 40–65 years of age. In this AI study, including only diagnoses from patients seen in primary health care centres, we found that the number of consultations in primary care had high predictive information as well unspecific diagnoses including muscle and skeletal pain predicted high risk for osteoporosis in all age groups.

## Linked entities

- **Diseases:** osteoporosis (MONDO:0005298)

## Full-text entities

- **Diseases:** fragility fractures (MESH:D005600), Osteoporosis (MESH:D010024), muscle and skeletal pain (MESH:D063806), painful musculoskeletal disorders (MESH:D059352), Hypertension (MESH:D006973), vertebral fractures (MESH:C535781)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12537854/full.md

## Figures

2 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12537854/full.md

## References

3 references — full list in the complete paper: https://tomesphere.com/paper/PMC12537854/full.md

---
Source: https://tomesphere.com/paper/PMC12537854