Skip to contents

Include diabetes diagnoses from LPR2 and LPR3.

Usage

include_diabetes_diagnoses(lpr2, lpr3)

Arguments

lpr2

The output from join_lpr2().

lpr3

The output from join_lpr3().

Value

The same type as the input data, default as a tibble::tibble(), with the following columns and up to two rows per individual:

  • pnr: The personal identification variable.

  • dates: The dates of the first and second hospital diabetes diagnosis.

  • n_t1d_endocrinology: The number of type 1 diabetes-specific primary diagnosis codes from endocrinology departments.

  • n_t2d_endocrinology: The number of type 2 diabetes-specific primary diagnosis codes from endocrinology departments.

  • n_t1d_medical: The number of type 1 diabetes-specific primary diagnosis codes from medical departments.

  • n_t2d_medical: The number of type 2 diabetes-specific primary diagnosis codes from medical departments.

Details

Uses the hospital contacts from LPR2 and LPR3 to include all dates of diabetes diagnoses to use for inclusion, as well as additional information needed to classify diabetes type. Diabetes diagnoses from both ICD-8 and ICD-10 are included.

The output is used as inputs to join_inclusions(). This output is passed to the join_inclusions() function, where the dates variable is used for the final step of the inclusion process. The variables of counts of diabetes type-specific primary diagnoses (the four columns prefixed n_) are carried over for the subsequent classification of diabetes type, initially as inputs to the get_t1d_primary_diagnosis() and get_majority_of_t1d_diagnoses() functions.

See also

See the vignette("algorithm") for the logic used to filter these patients.

Examples

if (FALSE) { # \dontrun{
register_data <- simulate_registers(c("lpr_diag", "lpr_adm", "diagnoser", "kontakter"))
include_diabetes_diagnoses(
  lpr2 = prepare_lpr2(register_data$lpr_adm, register_data$lpr_diag),
  lpr3 = prepare_lpr3(register_data$kontakter, register_data$diagnoser)
)
} # }