Usage
addDrugUse(
cohort,
cdm = lifecycle::deprecated(),
ingredientConceptId,
conceptSet = NULL,
duration = TRUE,
quantity = TRUE,
dose = TRUE,
gapEra = 0,
eraJoinMode = "zero",
overlapMode = "sum",
sameIndexMode = "sum",
imputeDuration = "none",
imputeDailyDose = "none",
durationRange = c(1, Inf),
dailyDoseRange = c(0, Inf)
)
Arguments
- cohort
Cohort in the cdm
- cdm
deprecated
- ingredientConceptId
Ingredient OMOP concept that we are interested for the study. It is a compulsory input, no default value is provided.
- conceptSet
List of concepts to be included. If NULL all the descendants of ingredient concept id will be used.
- duration
Whether to add duration related columns.
- quantity
Whether to add quantity related columns.
- dose
Whether to add dose related columns.
- gapEra
Number of days between two continuous exposures to be considered in the same era.
- eraJoinMode
How two different continuous exposures are joined in an era. There are four options: "zero" the exposures are joined considering that the period between both continuous exposures the subject is treated with a daily dose of zero. The time between both exposures contributes to the total exposed time. "join" the exposures are joined considering that the period between both continuous exposures the subject is treated with a daily dose of zero. The time between both exposures does not contribute to the total exposed time. "previous" the exposures are joined considering that the period between both continuous exposures the subject is treated with the daily dose of the previous subexposure. The time between both exposures contributes to the total exposed time. "subsequent" the exposures are joined considering that the period between both continuous exposures the subject is treated with the daily dose of the subsequent subexposure. The time between both exposures contributes to the total exposed time.
- overlapMode
How the overlapping between two exposures that do not start on the same day is solved inside a subexposure. There are five possible options: "previous" the considered daily_dose is the one of the earliest exposure. "subsequent" the considered daily_dose is the one of the new exposure that starts in that subexposure. "minimum" the considered daily_dose is the minimum of all of the exposures in the subexposure. "maximum" the considered daily_dose is the maximum of all of the exposures in the subexposure. "sum" the considered daily_dose is the sum of all the exposures present in the subexposure.
- sameIndexMode
How the overlapping between two exposures that start on the same day is solved inside a subexposure. There are three possible options: "minimum" the considered daily_dose is the minimum of all of the exposures in the subexposure. "maximum" the considered daily_dose is the maximum of all of the exposures in the subexposure. "sum" the considered daily_dose is the sum of all the exposures present in the subexposure.
- imputeDuration
Whether/how the duration should be imputed "none", "median", "mean", "mode" or a number
- imputeDailyDose
Whether/how the daily_dose should be imputed "none", "median", "mean", "mode" or a number
- durationRange
Range between the duration must be comprised. It should be a numeric vector of length two, with no NAs and the first value should be equal or smaller than the second one. It must not be NULL if imputeDuration is not "none". If NULL no restrictions are applied.
- dailyDoseRange
Range between the daily_dose must be comprised. It should be a numeric vector of length two, with no NAs and the first value should be equal or smaller than the second one. It must not be NULL if imputeDailyDose is not "none". If NULL no restrictions are applied.
Examples
# \donttest{
library(DrugUtilisation)
cdm <- mockDrugUtilisation()
#> Warning: ! 6 column in person do not match expected column type:
#> • `gender_concept_id` is numeric but expected integer
#> • `race_concept_id` is numeric but expected integer
#> • `ethnicity_concept_id` is numeric but expected integer
#> • `location_id` is numeric but expected integer
#> • `provider_id` is numeric but expected integer
#> • `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#> • `period_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in visit_occurrence do not match expected column type:
#> • `visit_concept_id` is numeric but expected integer
#> • `visit_type_concept_id` is numeric but expected integer
#> Warning: ! 10 column in condition_occurrence do not match expected column type:
#> • `condition_concept_id` is numeric but expected integer
#> • `condition_type_concept_id` is numeric but expected integer
#> • `condition_status_concept_id` is numeric but expected integer
#> • `stop_reason` is logical but expected character
#> • `provider_id` is logical but expected integer
#> • `visit_occurrence_id` is logical but expected integer
#> • `visit_detail_id` is logical but expected integer
#> • `condition_source_value` is logical but expected character
#> • `condition_source_concept_id` is logical but expected integer
#> • `condition_status_source_value` is logical but expected character
#> Warning: ! 2 column in drug_exposure do not match expected column type:
#> • `drug_concept_id` is numeric but expected integer
#> • `drug_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in observation do not match expected column type:
#> • `observation_concept_id` is numeric but expected integer
#> • `observation_type_concept_id` is numeric but expected integer
#> Warning: ! 4 column in concept do not match expected column type:
#> • `concept_id` is numeric but expected integer
#> • `valid_start_date` is character but expected date
#> • `valid_end_date` is character but expected date
#> • `invalid_reason` is logical but expected character
#> Warning: ! 2 column in concept_relationship do not match expected column type:
#> • `concept_id_1` is numeric but expected integer
#> • `concept_id_2` is numeric but expected integer
#> Warning: ! 4 column in concept_ancestor do not match expected column type:
#> • `ancestor_concept_id` is numeric but expected integer
#> • `descendant_concept_id` is numeric but expected integer
#> • `min_levels_of_separation` is numeric but expected integer
#> • `max_levels_of_separation` is numeric but expected integer
#> Warning: ! 9 column in drug_strength do not match expected column type:
#> • `drug_concept_id` is numeric but expected integer
#> • `ingredient_concept_id` is numeric but expected integer
#> • `amount_unit_concept_id` is numeric but expected integer
#> • `numerator_unit_concept_id` is numeric but expected integer
#> • `denominator_unit_concept_id` is numeric but expected integer
#> • `box_size` is logical but expected integer
#> • `valid_start_date` is character but expected date
#> • `valid_end_date` is character but expected date
#> • `invalid_reason` is logical but expected character
#> Warning: ! 6 column in person do not match expected column type:
#> • `gender_concept_id` is numeric but expected integer
#> • `race_concept_id` is numeric but expected integer
#> • `ethnicity_concept_id` is numeric but expected integer
#> • `location_id` is numeric but expected integer
#> • `provider_id` is numeric but expected integer
#> • `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#> • `period_type_concept_id` is numeric but expected integer
codelist <- CodelistGenerator::getDrugIngredientCodes(
cdm,
name = "acetaminophen"
)
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
cdm <- generateDrugUtilisationCohortSet(cdm, "dus_cohort", codelist)
cdm[["dus_cohort"]] |>
addDrugUse(ingredientConceptId = 1125315)
#> Warning: `addDrugUse()` was deprecated in DrugUtilisation 0.7.0.
#> ℹ Please use `addDrugUtilisation()` instead.
#> # Source: table<og_026_1730712110> [6 x 13]
#> # Database: DuckDB v1.1.2 [unknown@Linux 6.5.0-1025-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date duration
#> <int> <int> <date> <date> <dbl>
#> 1 1 6 2012-12-18 2013-09-05 262
#> 2 1 9 2019-06-06 2020-10-30 513
#> 3 1 8 2011-07-17 2012-03-08 236
#> 4 1 4 2004-02-29 2004-03-21 22
#> 5 1 10 2002-04-04 2015-02-03 4689
#> 6 1 1 2022-04-23 2022-05-17 25
#> # ℹ 8 more variables: number_exposures <dbl>, cumulative_quantity <dbl>,
#> # initial_quantity <dbl>, impute_duration_percentage <dbl>,
#> # number_eras <dbl>, impute_daily_dose_percentage <dbl>,
#> # initial_daily_dose_milligram <dbl>, cumulative_dose_milligram <dbl>
# }