Skip to contents

The output is used as inputs to include_diabetes_diagnoses() and to get_pregnancy_dates() (see exclusion events).

Usage

prepare_lpr2(lpr_adm, lpr_diag)

Arguments

lpr_adm

The LPR2 register containing hospital admissions.

lpr_diag

The LPR2 register containing diabetes diagnoses.

Value

The same type as the input data, default as a tibble::tibble(), with the following columns:

  • pnr: The personal identification variable.

  • date: The date of all the recorded diagnosis (renamed from d_inddto or dato_start).

  • is_primary_dx: Whether the diagnosis was a primary diagnosis.

  • is_diabetes_code: Whether the diagnosis was any type of diabetes.

  • is_t1d_code: Whether the diagnosis was T1D-specific.

  • is_t2d_code: Whether the diagnosis was T2D-specific.

  • is_pregnancy_code: Whether the person has an event related to pregnancy like giving birth or having a miscarriage at the given date.

  • is_endocrinology_dept: Whether the diagnosis was made by an endocrinology medical department.

  • is_medical_dept: Whether the diagnosis was made by a non-endocrinology medical department.

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"), 100000)
lpr2 <- prepare_lpr2(
  lpr_diag = register_data$lpr_diag,
  lpr_adm = register_data$lpr_adm
)
} # }