Add new columns with drug use related information
Source:R/addDrugUtilisation.R
addDrugUtilisation.Rd
Add new columns with drug use related information
Usage
addDrugUtilisation(
cohort,
gapEra,
conceptSet = NULL,
ingredientConceptId = NULL,
indexDate = "cohort_start_date",
censorDate = "cohort_end_date",
restrictIncident = TRUE,
numberExposures = TRUE,
numberEras = TRUE,
daysExposed = TRUE,
daysPrescribed = TRUE,
timeToExposure = TRUE,
initialExposureDuration = TRUE,
initialQuantity = TRUE,
cumulativeQuantity = TRUE,
initialDailyDose = TRUE,
cumulativeDose = TRUE,
nameStyle = "{value}_{concept_name}_{ingredient}",
name = NULL,
exposedTime = lifecycle::deprecated()
)
Arguments
- cohort
A cohort_table object.
- gapEra
Number of days between two continuous exposures to be considered in the same era.
- conceptSet
List of concepts to be included.
- ingredientConceptId
Ingredient OMOP concept that we are interested for the study.
- indexDate
Name of a column that indicates the date to start the analysis.
- censorDate
Name of a column that indicates the date to stop the analysis, if NULL end of individuals observation is used.
- restrictIncident
Whether to include only incident prescriptions in the analysis. If FALSE all prescriptions that overlap with the study period will be included.
- numberExposures
Whether to include 'number_exposures' (number of drug exposure records between indexDate and censorDate).
- numberEras
Whether to include 'number_eras' (number of continuous exposure episodes between indexDate and censorDate).
- daysExposed
Whether to include 'days_exposed' (number of days that the individual is in a continuous exposure episode, including allowed treatment gaps, between indexDate and censorDate; sum of the length of the different drug eras).
- daysPrescribed
Whether to include 'days_prescribed' (sum of the number of days for each prescription that contribute in the analysis).
- timeToExposure
Whether to include 'time_to_exposure' (number of days between indexDate and the first episode).
- initialExposureDuration
Whether to include 'initial_exposure_duration' (number of prescribed days of the first drug exposure record).
- initialQuantity
Whether to include 'initial_quantity' (quantity of the first drug exposure record).
- cumulativeQuantity
Whether to include 'cumulative_quantity' (sum of the quantity of the different exposures considered in the analysis).
- initialDailyDose
Whether to include 'initial_daily_dose_{unit}' (daily dose of the first considered prescription).
- cumulativeDose
Whether to include 'cumulative_dose_{unit}' (sum of the cumulative dose of the analysed drug exposure records).
- nameStyle
Character string to specify the nameStyle of the new columns.
- name
Name of the new computed cohort table, if NULL a temporary table will be created.
- exposedTime
deprecated.
Examples
# \donttest{
library(DrugUtilisation)
cdm <- mockDrugUtilisation()
codelist <- CodelistGenerator::getDrugIngredientCodes(
cdm,
name = "acetaminophen"
)
cdm <- generateDrugUtilisationCohortSet(cdm, "dus_cohort", codelist)
#> ℹ Subsetting drug_exposure table
#> ℹ Checking whether any record needs to be dropped.
#> ℹ Collapsing overlaping records.
#> ℹ Collapsing records with gapEra = 1 days.
cdm[["dus_cohort"]] |>
addDrugUtilisation(ingredientConceptId = 1125315, gapEra = 30)
#> # Source: table<og_064_1734614264> [?? x 14]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 5 2011-03-26 2012-01-07
#> 2 1 9 2019-09-07 2019-11-23
#> 3 1 7 1982-08-25 1983-06-05
#> 4 1 4 2022-02-19 2022-06-03
#> 5 1 2 2021-12-21 2021-12-24
#> 6 1 7 1985-04-10 1986-11-25
#> 7 1 10 2022-11-27 2022-11-30
#> # ℹ 10 more variables: number_exposures_ingredient_1125315_descendants <int>,
#> # time_to_exposure_ingredient_1125315_descendants <int>,
#> # cumulative_quantity_ingredient_1125315_descendants <dbl>,
#> # initial_quantity_ingredient_1125315_descendants <dbl>,
#> # initial_exposure_duration_ingredient_1125315_descendants <int>,
#> # number_eras_ingredient_1125315_descendants <int>,
#> # days_exposed_ingredient_1125315_descendants <int>, …
# }