Some projects are interested in the number of unique medications a patient is prescribed. For example, this can be used to derive a "polypharmacy" flag, which is typically defined as the regular use of 5 or more medications at the same time. Pharmacy data are not fully mapped, so we need to use some approximation to derive the number of unique medications per patient.
Previous projects used the following approach:
Impute missing med_id_generic_name_raw with med_id_brand_name_raw, med_id_hospital_code_raw, or order_description (whichever one is available).
Count unique drug names based on the unique (imputed) entries in med_id_generic_name_raw. Since drug names are not standardized and occasionally contain additional text (e.g., dosage/route information), we may want to perform some additional pre-processing of drug names (e.g., ignore capitalization, ignore leading/trailing whitespace, only use first N characters etc.) - however, given that drug names tend to be consistent within hospitals/time periods, this may not make a big difference
Note that this approach will only provide an approximation of the unique medications, and users should not rely on this method if they are interested in specific drugs (in that case, Rxnorm mapping would be required).
Function structure:
input: dbcon, cohort (table containing all genc_ids of interest) [e.g., see n_routine_bloodwork() function for similar input arguments, but you can ignore the exclude_ed input for now)
output: cohort table with a single row for each genc_id that is part of cohort input, together with the new derived variable indicating the count of unique medications (integer)
Please mention (if applicable), any research projects for which this functionality was needed:
New Feature Request
Some projects are interested in the number of unique medications a patient is prescribed. For example, this can be used to derive a "polypharmacy" flag, which is typically defined as the regular use of 5 or more medications at the same time. Pharmacy data are not fully mapped, so we need to use some approximation to derive the number of unique medications per patient.
Previous projects used the following approach:
med_id_generic_name_raw
withmed_id_brand_name_raw
,med_id_hospital_code_raw
, ororder_description
(whichever one is available).med_id_generic_name_raw
. Since drug names are not standardized and occasionally contain additional text (e.g., dosage/route information), we may want to perform some additional pre-processing of drug names (e.g., ignore capitalization, ignore leading/trailing whitespace, only use first N characters etc.) - however, given that drug names tend to be consistent within hospitals/time periods, this may not make a big differenceNote that this approach will only provide an approximation of the unique medications, and users should not rely on this method if they are interested in specific drugs (in that case, Rxnorm mapping would be required).
Function structure:
dbcon
,cohort
(table containing allgenc_ids
of interest) [e.g., seen_routine_bloodwork()
function for similar input arguments, but you can ignore theexclude_ed
input for now)cohort
table with a single row for eachgenc_id
that is part ofcohort
input, together with the new derived variable indicating the count of unique medications (integer)Please mention (if applicable), any research projects for which this functionality was needed: