| is_within_pregnancy_interval |
Events that are within a potential pregnancy interval |
has_pregnancy_event AND date >= (pregnancy_event_date - weeks(40L)) AND date <= (pregnancy_event_date + weeks(12L)) |
The potential pregnancy interval is defined as 40 weeks before and 12 weeks after the pregnancy event date (birth or miscarriage). |
| is_podiatrist_services |
Podiatrist services |
speciale =~ ‘^54’ AND barnmak == 0 |
When barnmak == 0, the PNR belongs to the recipient of the service. When barnmak == 1, the PNR belongs to the child of the individual. |
| is_not_metformin_for_pcos |
Metformin purchases that aren’t potentially for the treatment of PCOS |
NOT (koen == 2 AND atc =~ ‘^A10BA02$’ AND (date < (foed_dato + years(40)) OR indication_code %in% c(‘0000092’, ‘0000276’, ‘0000781’))) |
Woman is defined as 2 in koen. |
| has_t1d |
Classifying type 1 diabetes status |
(from_diabetes_diagnosis OR from_podiatrist_service OR from_gld_purchase OR from_hba1c_over_threshold) AND (has_only_insulin_purchases & has_any_t1d_primary_diagnosis) OR (!has_only_insulin_purchases & has_majority_t1d_diagnoses & has_two_thirds_insulin & has_insulin_purchases_within_180_days) |
The final classification for type 1 diabetes. Depends on all the previous steps to create these intermediate logical variables. |
| has_any_t1d_primary_diagnosis |
Any primary diagnosis for type 1 diabetes |
(n_t1d_endocrinology + n_t1d_medical) >= 1 |
This is used to classify type 1 diabetes. Naturally, having any type 1 diabetes diagnosis is indicative of type 1 diabetes. |
| has_majority_t1d_diagnoses |
Determine if the majority of diagnoses are for type 1 diabetes |
if_else(n_t1d_endocrinology + n_t2d_endocrinology > 0, n_t1d_endocrinology > n_t2d_endocrinology, n_t1d_medical > n_t2d_medical) |
This is used to classify type 1 diabetes. Endocrinology diagnoses are prioritised if available, otherwise other medical department diagnoses are used. If no diabetes type-specific primary diagnoses are available from an endocrinology or other medical departments, this variable is returned as FALSE. |
| has_two_thirds_insulin |
Whether two-thirds of GLD doses are insulin doses |
(n_insulin_doses / n_gld_doses) >= 2/3 |
This is used to classify type 1 diabetes. If multiple types of GLD are purchased, this indicates if at least two-thirds are insulin, which is important to determine type 1 diabetes status. |
| has_only_insulin_purchases |
Whether only insulin was purchased as a GLD |
n_insulin_doses >= 1 & n_insulin_doses == n_gld_doses |
This is used to classify type 1 diabetes. If only insulin is purchased, this is a strong reason to suspect type 1 diabetes. |
| has_insulin_purchases_within_180_days |
Whether any insulin was purchased within 180 days of the first purchase of GLD |
any(is_insulin_gld_code & date <= (first_gld_date + days(180L)), na.rm = TRUE) |
This is used to classify type 1 diabetes. It determines if any insulin was bought shortly after first buying any type of GLD, which suggests type 1 diabetes. |