OSDC β€” Open Source Diabetes Classifier

Diabetes type classification in Danish register data

Published

June 6, 2026

OSDC is an open source algorithm that classifies everyone in Denmark as having type 1 diabetes (T1D), type 2 diabetes (T2D) or no diabetes, based on data in the national registers.

Article: doi:10.2147/CLEP.S407019 Documentation and code: steno-aarhus.github.io/osdc


What does OSDC give you?

A pre-computed population with: - Diabetes type: T1D, T2D or no diabetes - Onset date: when the diabetes criteria were first met - Age at onset

The classification is based on a combination of diagnosis codes (LPR), medication information (LMDB) and laboratory results.


When is it used?

  • To define a diabetes population as an exposure or inclusion criterion
  • To exclude diabetes patients from a control group
  • To classify type β€” LPR alone is not sufficient to reliably distinguish T1D from T2D

How to use OSDC

DARTER β€” project 708421 (pre-computed file)

On DARTER the OSDC classification is already computed and ready as an .rds file. You do not need to run the algorithm yourself.

# Load the pre-computed classification:
dm_pop <- readRDS("E:/workdata/708421/cleaned-data/diabetes-register-pop/dm_population_1977_2022.rds")

names(dm_pop)
# [1] "PNR"           "diabetes_type"  "do_dm"          "age_at_onset"

library(dplyr)
dm_pop <- dm_pop %>% rename(pnr = PNR)   # rename PNR to lowercase pnr

# diabetes_type: 1 = T1D, 2 = T2D  |  do_dm: onset date
Example: filter to T1D patients
t1d <- dm_pop %>%
  filter(diabetes_type == 1) %>%
  select(pnr, diabetes_type, do_dm) %>%
  rename(date_diabetes = do_dm)

Other projects β€” run the algorithm yourself

If your OSDC classification has not been pre-computed, you need to run the algorithm yourself.

Warning

Is the OSDC package available on DST for your project? It is not yet confirmed whether the osdc package (GitHub: steno-aarhus/osdc) is available in your project’s CRAN snapshot. Check with "osdc" %in% rownames(installed.packages()) on the server. If it is not there, it must be imported via your data manager.

See documentation and installation guide at steno-aarhus.github.io/osdc.


Coverage and limitations

  • The DARTER version covers diagnoses up to 2022 β€” check when your version was computed
  • Classifies everyone in Denmark β€” not just your cohort
  • Uses LPR, LMDB and laboratory results β€” requires access to these registers

See the full methodology in the article and documentation site.


Next steps

Back to top