Skip to contents

This document describes the sources of data needed by the OSDC algorithm and gives a brief overview of each of these sources and how they might look like. In addition, the final section contains information on how to gain access to these data.

The algorithm uses these Danish registers as input data sources:

Danish registers used in the OSDC algorithm.
Register Abbreviation Years
CPR-registerets befolkningstabel bef 1968 - present
Laegemiddelstatistikregisteret lmdb 1995 - present
Landspatientregisterets administrationstabel (LPR2) lpr_adm 1977 - 2018
Landspatientregisterets diagnosetabel (LPR2) lpr_diag 1977 - 2018
Landspatientregisterets kontakttabel (LPR3) kontakter 2019 - present
Landspatientregisterets diagnosetabel (LPR3) diagnoser 2019 - present
Sygesikringsregisteret sysi 1990 - 2005
Sygesikringsregisteret sssy 2005 - present
Laboratoriedatabasens forskertabel lab_forsker 2011 - present

In a future revision, the algorithm can also use the Danish Medical Birth Register to extend the period of time of valid inclusions further back in time compared to what is possible using obstetric codes from the National Patient Register.

Data required from registers

The following is a list of the variables required from specific registers in order for the package to classify diabetes status:

Register Variable
CPR-registerets befolkningstabel (bef) pnr
CPR-registerets befolkningstabel (bef) koen
CPR-registerets befolkningstabel (bef) foed_dato
Laegemiddelstatistikregisteret (lmdb) pnr
Laegemiddelstatistikregisteret (lmdb) eksd
Laegemiddelstatistikregisteret (lmdb) atc
Laegemiddelstatistikregisteret (lmdb) volume
Laegemiddelstatistikregisteret (lmdb) apk
Laegemiddelstatistikregisteret (lmdb) indo
Landspatientregisterets administrationstabel (LPR2) (lpr_adm) pnr
Landspatientregisterets administrationstabel (LPR2) (lpr_adm) recnum
Landspatientregisterets administrationstabel (LPR2) (lpr_adm) d_inddto
Landspatientregisterets administrationstabel (LPR2) (lpr_adm) c_spec
Landspatientregisterets diagnosetabel (LPR2) (lpr_diag) recnum
Landspatientregisterets diagnosetabel (LPR2) (lpr_diag) c_diag
Landspatientregisterets diagnosetabel (LPR2) (lpr_diag) c_diagtype
Landspatientregisterets kontakttabel (LPR3) (kontakter) cpr
Landspatientregisterets kontakttabel (LPR3) (kontakter) dw_ek_kontakt
Landspatientregisterets kontakttabel (LPR3) (kontakter) dato_start
Landspatientregisterets kontakttabel (LPR3) (kontakter) hovedspeciale_ans
Landspatientregisterets diagnosetabel (LPR3) (diagnoser) dw_ek_kontakt
Landspatientregisterets diagnosetabel (LPR3) (diagnoser) diagnosekode
Landspatientregisterets diagnosetabel (LPR3) (diagnoser) diagnosetype
Landspatientregisterets diagnosetabel (LPR3) (diagnoser) senere_afkraeftet
Sygesikringsregisteret (sysi) pnr
Sygesikringsregisteret (sysi) barnmak
Sygesikringsregisteret (sysi) speciale
Sygesikringsregisteret (sysi) honuge
Sygesikringsregisteret (sssy) pnr
Sygesikringsregisteret (sssy) barnmak
Sygesikringsregisteret (sssy) speciale
Sygesikringsregisteret (sssy) honuge
Laboratoriedatabasens forskertabel (lab_forsker) patient_cpr
Laboratoriedatabasens forskertabel (lab_forsker) samplingdate
Laboratoriedatabasens forskertabel (lab_forsker) analysiscode
Laboratoriedatabasens forskertabel (lab_forsker) value

Expected data structure

This section describes how the data sources listed from the above table are expected to look like when they are input into the OSDC algorithm. We try to mimic as much as possible how the raw data looks like within Denmark Statistics. So since registers are often stored on a per year basis, we don’t expect a year variable in the data itself. If you’ve processed the data so that it has a year variable, you will likely need to do a split-apply-combine approach when using the osdc package. We internally convert all variable names to lower case, and so we present them here in lower case, but case may vary between data sources (and even between years in the same data source) in real data.

A small note about the National Patient Register. It contains several tables and types of data. The algorithm uses only hospital diagnosis data that contained in four registers, which are a pair of two related registers used before (LPR2) and after (LPR3) 2019. So the LPR2 to LPR3 equivalents are lpr_adm to kontakter and lpr_diag to diagnoser. Most of the variables have equivalents as well, except that while c_spec is the LPR2 equivalent of hovedspeciale_ans in LPR3, the specialty values in hovedspeciale_ans are coded as literal specialty names and are different from the padded integer codes that c_spec contains.

On Statistics Denmark, these tables are provided as a mix of separate files for each calendar year prior to 2019 (in LPR2 format) and a single file containing all the data from 2019 onward (LPR3 format). The two tables can be joined with either the recnum variable (LPR2 data) or the dw_ek_kontakt variable (LPR3 data).

bef: CPR-registerets befolkningstabel

Variables and their descriptions within the bef register.
variable_name english_description
pnr Pseudonymised social security number
koen Sex
foed_dato Date of birth
Simulated example of what the data looks like for the bef register.
koen pnr foed_dato
2 295879519622 20190425
1 052484763211 19600411
2 473656557183 19360804
1 539882494700 20081206

lmdb: Laegemiddelstatistikregisteret

Variables and their descriptions within the lmdb register.
variable_name english_description
pnr Pseudonymised social security number
eksd Date of purchase
atc Atc code (fully specified)
volume Number of daily standard doses (ddd) in package
apk Number of packages purchased
indo Indication code
Simulated example of what the data looks like for the lmdb register.
volume pnr eksd atc apk indo
4.533506 147984702032 20060924 N02AC54 1.574508 0042792
1.351237 083970684754 19980806 N05AF05 4.117670 0706765
5.844536 561044861491 20161023 G03EK01 2.079107 5280885
8.763184 914165936316 20160303 A10AE56 4.974808 8739373

lpr_adm: Landspatientregisterets administrationstabel (LPR2)

Variables and their descriptions within the lpr_adm register.
variable_name english_description
pnr Pseudonymised social security number
recnum Record id number
d_inddto Date of admission or initial contact
c_spec Specialty code of department
Simulated example of what the data looks like for the lpr_adm register.
c_spec pnr recnum d_inddto
81 036625008624 692088110968529476 20010625
90 998619262488 508879511776395750 19841018
87 034739382189 356292023160324193 19791106
03 966957471138 167936488877794449 20090926

lpr_diag: Landspatientregisterets diagnosetabel (LPR2)

Variables and their descriptions within the lpr_diag register.
variable_name english_description
recnum Record id number
c_diag Diagnosis code
c_diagtype Diagnosis type
Simulated example of what the data looks like for the lpr_diag register.
c_diagtype recnum c_diag
B 437823253484852508 DB958
B 050971173523403506 DR13
A 777378071916480689 DO700B
A 277017543702845196 DK754A

kontakter: Landspatientregisterets kontakttabel (LPR3)

Variables and their descriptions within the kontakter register.
variable_name english_description
cpr Pseudonymised social security number
dw_ek_kontakt Record id number
dato_start Date of admission or initial contact
hovedspeciale_ans Specialty of department
Simulated example of what the data looks like for the kontakter register.
cpr dw_ek_kontakt dato_start hovedspeciale_ans
479497165788 701164834656651184 19910430 Dermato-venerologi
592500805436 184973744127885455 20020815 Børne- og ungdomspsykiatri
255670621038 718615486876865290 20121101 Hæmatologi
493041743629 974782023363670879 20061218 Samfundsmedicin

diagnoser: Landspatientregisterets diagnosetabel (LPR3)

Variables and their descriptions within the diagnoser register.
variable_name english_description
dw_ek_kontakt Record id number
diagnosekode Diagnosis code
diagnosetype Diagnosis type
senere_afkraeftet Was the diagnosis retracted later?
Simulated example of what the data looks like for the diagnoser register.
dw_ek_kontakt diagnosekode diagnosetype senere_afkraeftet
295967218205190103 DQ600 B Nej
419136150597320977 DL022 B Ja
733999403212878558 DF252 B Ja
263706881734175834 DI252B A Nej

sysi: Sygesikringsregisteret

Variables and their descriptions within the sysi register.
variable_name english_description
pnr Pseudonymised social security number
barnmak Was the service provided to the patient’s child?
speciale Billing code of the service (fully specified)
honuge Year and week of service
Simulated example of what the data looks like for the sysi register.
pnr barnmak speciale honuge
558843081164 0 70200 0302
125417342293 1 07107 0402
101150906190 0 15874 9031
735054834392 0 75440 0109

sssy: Sygesikringsregisteret

Variables and their descriptions within the sssy register.
variable_name english_description
pnr Pseudonymised social security number
barnmak Was the service provided to the patient’s child?
speciale Billing code of the service (fully specified)
honuge Year and week of service
Simulated example of what the data looks like for the sssy register.
pnr barnmak speciale honuge
949048896915 0 76581 1534
917925900176 0 70652 1925
141858753104 0 65647 0538
010080256306 0 96171 2304

lab_forsker: Laboratoriedatabasens forskertabel

Variables and their descriptions within the lab_forsker register.
variable_name english_description
patient_cpr Pseudonymised social security number
samplingdate Date of sampling
analysiscode Npu code of analysis
value Numerical result of analysis
Simulated example of what the data looks like for the lab_forsker register.
patient_cpr samplingdate analysiscode value
215104581333 20201220 NPU27300 159.98672
995011179485 20160906 NPU70363 66.82853
430295258937 20220301 NPU60750 137.51173
217144925484 20140603 NPU01153 89.97764

Getting access to data

The above data is available through Statistics Denmark and the Danish Health Data Authority. Researchers must be affiliated with an approved research institute in Denmark and fees apply. Information on how to gain access to data can be found at https://www.dst.dk/en/TilSalg/Forskningsservice.