Skip to contents

This package serves two overarching purposes:

  1. To provide an open-source, code-based algorithm to classify type 1 and type 2 diabetes using Danish registers as data sources.
  2. To inspire discussions within the Danish register-based research space on the openness and ease of use on the existing tooling and registers, and on the need for an official process for updating or contributing to existing data sources.

To read up on the overall design of this package as well as on the algorithm, check out the vignette("design"). For more explanation on the motivations, rationale, and needs for this algorithm and package, check out the vignette("rationale").

Usage

First, let’s load up the package, as well as dplyr.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(osdc)

The core of this package depends on the list of variables within different registers that are needed in order to classify the diabetes status of an individual. This can be found in the dataset:

variable_description
#> # A tibble: 38 × 7
#>    register_name               register_abbrev variable_name start_year end_year
#>    <chr>                       <chr>           <chr>              <dbl>    <dbl>
#>  1 CPR-registerets befolkning… bef             pnr                 1968       NA
#>  2 CPR-registerets befolkning… bef             koen                1968       NA
#>  3 CPR-registerets befolkning… bef             foed_dato           1968       NA
#>  4 Laegemiddelstatistikregist… lmdb            pnr                 1995       NA
#>  5 Laegemiddelstatistikregist… lmdb            eksd                1995       NA
#>  6 Laegemiddelstatistikregist… lmdb            atc                 1995       NA
#>  7 Laegemiddelstatistikregist… lmdb            volume              1995       NA
#>  8 Laegemiddelstatistikregist… lmdb            apk                 1995       NA
#>  9 Laegemiddelstatistikregist… lmdb            indo                1995       NA
#> 10 Laegemiddelstatistikregist… lmdb            name                1995       NA
#> # ℹ 28 more rows
#> # ℹ 2 more variables: danish_description <chr>, english_description <chr>

Let’s convert that to a nicer format to show the list as a table.

variable_description |> 
  select(register_name, register_abbrev, variable_name, english_description) |> 
  knitr::kable()
register_name register_abbrev variable_name english_description
CPR-registerets befolkningstabel bef pnr pseudonymised social security number
CPR-registerets befolkningstabel bef koen sex
CPR-registerets befolkningstabel bef foed_dato date of birth
Laegemiddelstatistikregisteret lmdb pnr pseudonymised social security number
Laegemiddelstatistikregisteret lmdb eksd date of purchase
Laegemiddelstatistikregisteret lmdb atc ATC code (fully specified)
Laegemiddelstatistikregisteret lmdb volume number of daily standard doses (DDD) in package
Laegemiddelstatistikregisteret lmdb apk number of packages purchased
Laegemiddelstatistikregisteret lmdb indo indication code
Laegemiddelstatistikregisteret lmdb name drug retail name
Laegemiddelstatistikregisteret lmdb vnr item code
Landspatientregisterets administrationstabel (LPR2) lpr_adm pnr pseudonymised social security number
Landspatientregisterets administrationstabel (LPR2) lpr_adm recnum record id number
Landspatientregisterets administrationstabel (LPR2) lpr_adm d_inddto date of admission or initial contact
Landspatientregisterets administrationstabel (LPR2) lpr_adm c_spec specialty code of department
Landspatientregisterets diagnosetabel (LPR2) lpr_diag recnum record id number
Landspatientregisterets diagnosetabel (LPR2) lpr_diag c_diag diagnosis code
Landspatientregisterets diagnosetabel (LPR2) lpr_diag c_diagtype diagnosis type
Landspatientregisterets kontakttabel (LPR3) kontakter cpr pseudonymised social security number
Landspatientregisterets kontakttabel (LPR3) kontakter dw_ek_kontakt record id number
Landspatientregisterets kontakttabel (LPR3) kontakter dato_start date of admission or initial contact
Landspatientregisterets kontakttabel (LPR3) kontakter hovedspeciale_ans specialty of department
Landspatientregisterets diagnosetabel (LPR3) diagnoser dw_ek_kontakt record id number
Landspatientregisterets diagnosetabel (LPR3) diagnoser diagnosekode diagnosis code
Landspatientregisterets diagnosetabel (LPR3) diagnoser diagnosetype diagnosis type
Landspatientregisterets diagnosetabel (LPR3) diagnoser senere_afkraeftet was the diagnosis retracted later?
Sygesikringsregisteret sysi pnr pseudonymised social security number
Sygesikringsregisteret sysi barnmak was the service provided to the patient’s child?
Sygesikringsregisteret sysi speciale billing code of the service (fully specified)
Sygesikringsregisteret sysi honuge week and year of service
Sygesikringsregisteret sssy pnr pseudonymised social security number
Sygesikringsregisteret sssy barnmak was the service provided to the patient’s child?
Sygesikringsregisteret sssy speciale billing code of the service (fully specified)
Sygesikringsregisteret sssy honuge week and year of service
Laboratoriedatabasens forskertabel lab_forsker patient_cpr pseudonymised social security number
Laboratoriedatabasens forskertabel lab_forsker samplingdate date of sampling
Laboratoriedatabasens forskertabel lab_forsker analysiscode NPU code of analysis
Laboratoriedatabasens forskertabel lab_forsker value numerical result of analysis