generateIngredientCohortSet {DrugUtilisation}R Documentation

Generates a cohort of the drug use of ingredient name(s) of interest.

Description

Generates a cohort of the drug use of ingredient name(s) of interest.

Usage

generateIngredientCohortSet(
  cdm,
  name,
  ingredient = NULL,
  durationRange = c(1, Inf),
  imputeDuration = "none",
  gapEra = 0,
  priorUseWashout = 0,
  priorObservation = 0,
  cohortDateRange = as.Date(c(NA, NA)),
  limit = "all",
  doseForm = NULL,
  ingredientRange = c(1, Inf)
)

Arguments

cdm

A cdm_reference object.

name

Name of the GeneratedCohortSet

ingredient

Accepts both vectors and named lists of ingredient names. For a vector input, e.g., c("acetaminophen", "codeine"), it generates a cohort table with descendant concept codes for each ingredient, assigning unique cohort_definition_id. For a named list input, e.g., list( "test_1" = c("simvastatin", "acetaminophen"), "test_2" = "metformin"), it produces a cohort table based on the structure of the input, where each name leads to a combined set of descendant concept codes for the specified ingredients, creating distinct cohort_definition_id for each named group.

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 is only required if imputeDuration = TRUE. If NULL no restrictions are applied.

imputeDuration

Whether/how the duration should be imputed "none", "median", "mean", "mode", or it can be a count

gapEra

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

priorUseWashout

Prior days without exposure.

priorObservation

Minimum number of days of prior observation required for the incident eras to be considered.

cohortDateRange

Range for cohort_start_date and cohort_end_date

limit

Choice on how to summarise the exposures. There are two options: "all" we summarise the output will be a summary of the exposed eras of each individual. Each individual can contribute multiple times. "first" we only consider the first observable era of each individual that fulfills the criteria provided in previous parameters. In this case each individual can not contribute with multiple rows.

doseForm

Only descendants codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form.

ingredientRange

Used to restrict descendant codes to those associated with a specific number of ingredients. Must be a vector of length two with the first element the minimum number of ingredients allowed and the second the maximum. A value of c(2, 2) would restrict to only concepts associated with two ingredients.

Value

The function returns the 'cdm' object with the created cohorts as references of the object.

Examples


library(DrugUtilisation)
cdm <- mockDrugUtilisation()
cdm <- generateIngredientCohortSet(
  cdm = cdm,
  ingredient = "acetaminophen",
  name = "test"
)
cdm



[Package DrugUtilisation version 0.6.1 Index]