Skip to contents

This function is used to summarise the dose utilisation table over multiple cohorts.

Usage

summariseDrugUtilisation(
  cohort,
  strata = list(),
  estimates = c("q25", "median", "q75", "mean", "sd", "count_missing",
    "percentage_missing"),
  ingredientConceptId = NULL,
  conceptSet = NULL,
  indexDate = "cohort_start_date",
  censorDate = "cohort_end_date",
  restrictIncident = TRUE,
  gapEra = 1,
  numberExposures = TRUE,
  numberEras = TRUE,
  exposedTime = TRUE,
  timeToExposure = TRUE,
  initialQuantity = TRUE,
  cumulativeQuantity = TRUE,
  initialDailyDose = TRUE,
  cumulativeDose = TRUE
)

Arguments

cohort

Cohort with drug use variables and strata.

strata

Stratification list.

estimates

Estimates that we want for the columns.

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.

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.

gapEra

Number of days between two continuous exposures to be considered in the same era.

numberExposures

Whether to add a column with the number of exposures.

numberEras

Whether to add a column with the number of eras.

exposedTime

Whether to add a column with the number of exposed days.

timeToExposure

Whether to add a column with the number of days between indexDate and start of the first exposure.

initialQuantity

Whether to add a column with the initial quantity.

cumulativeQuantity

Whether to add a column with the cumulative quantity of the identified prescription.

initialDailyDose

Whether to add a column with the initial daily dose.

cumulativeDose

Whether to add a column with the cumulative dose.

Value

A summary of drug utilisation stratified by cohort_name and strata_name

Examples

# \donttest{
library(DrugUtilisation)
library(CodelistGenerator)

cdm <- mockDrugUtilisation()
#> Warning: ! 7 column in condition_occurrence do not match expected column type:
#>  `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: ! 3 column in concept do not match expected column type:
#>  `valid_start_date` is character but expected date
#>  `valid_end_date` is character but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 4 column in drug_strength do not match expected column type:
#>  `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
codelist <- CodelistGenerator::getDrugIngredientCodes(cdm, "acetaminophen")
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
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"]] |>
  summariseDrugUtilisation(ingredientConceptId = 1125315)
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
#> # A tibble: 58 × 13
#>    result_id cdm_name group_name  group_level       strata_name strata_level
#>        <int> <chr>    <chr>       <chr>             <chr>       <chr>       
#>  1         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  2         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  3         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  4         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  5         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  6         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  7         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  8         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#>  9         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#> 10         1 DUS MOCK cohort_name 161_acetaminophen overall     overall     
#> # ℹ 48 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
# }