
Exclude any pregnancy events that could be gestational diabetes.
Source:R/exclude-pregnancies.R
exclude_pregnancies.RdThis function takes the combined outputs from
keep_pregnancy_dates(), include_hba1c(), and
exclude_potential_pcos() and uses diagnoses from LPR2 or LPR3 to
exclude both elevated HbA1c tests and GLD purchases during pregnancy, as
these may be due to gestational diabetes, rather than type 1 or type 2
diabetes. The aim is to identify pregnancies based on diagnosis codes
specific to pregnancy-ending events (e.g. live births or miscarriages),
and then use the dates of these events to remove inclusion events in the
preceding months that may be related to gestational diabetes (e.g.
elevated HbA1c tests or purchases of glucose-lowering drugs during
pregnancy).
Arguments
- excluded_pcos
Output from
exclude_potential_pcos().- pregnancy_dates
Output from
keep_pregnancy_dates().- included_hba1c
Output from
include_hba1c().
Value
The same type as the input data, default as a tibble::tibble().
Has the same output data as the input exclude_potential_pcos(), except
for a helper logical variable no_pregnancy that is used in later
functions.
Details
After these exclusion functions have been applied, the output serves as inputs to:
The censored HbA1c and GLD data are passed to the
join_inclusions()function for the final step of the inclusion process.
See also
See the vignette("algorithm") for the logic used to filter these
patients.
Examples
if (FALSE) { # \dontrun{
register_data <- simulate_registers(
c(
"lpr_adm",
"lpr_diag",
"kontakter",
"diagnoser",
"lmdb",
"bef",
"lab_forsker"
),
n = 1000
)
lpr2 <- prepare_lpr2(
lpr_adm = register_data$lpr_adm,
lpr_diag = register_data$lpr_diag
)
lpr3 <- prepare_lpr3(
kontakter = register_data$kontakter,
diagnoser = register_data$diagnoser
)
# Exclude pregnancy dates
register_data$lmdb |>
include_gld_purchases() |>
add_insulin_purchases_cols() |>
exclude_potential_pcos(register_data$bef) |>
exclude_pregnancies(
keep_pregnancy_dates(lpr2, lpr3),
include_hba1c(register_data$lab_forsker)
)
} # }