generateIngredientCohortSet {DrugUtilisation} | R Documentation |
Generate a set of drug cohorts based on drug ingredients
Description
Adds a new cohort table to the cdm reference with individuals who have drug exposure records with the specified drug ingredient. Cohort start and end dates will be based on drug record start and end dates, respectively. Records that overlap or have fewer days between them than the specified gap era will be concatenated into a single cohort entry.
Usage
generateIngredientCohortSet(
cdm,
name,
ingredient = NULL,
doseForm = NULL,
doseUnit = NULL,
routeCategory = NULL,
ingredientRange = c(1, Inf),
gapEra = 1,
durationRange = lifecycle::deprecated(),
imputeDuration = lifecycle::deprecated(),
priorUseWashout = lifecycle::deprecated(),
priorObservation = lifecycle::deprecated(),
cohortDateRange = lifecycle::deprecated(),
limit = lifecycle::deprecated()
)
Arguments
cdm |
A cdm reference. |
name |
The name of the new cohort table to add to the cdm reference. |
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. |
doseForm |
Only descendants codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. |
doseUnit |
Only descendants codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit |
routeCategory |
Only descendants codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of route category. |
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. |
gapEra |
Number of days between two continuous exposures to be considered in the same era. Records that have fewer days between them than this gap will be concatenated into the same cohort record. |
durationRange |
Deprecated. |
imputeDuration |
Deprecated. |
priorUseWashout |
Deprecated |
priorObservation |
Deprecated. |
cohortDateRange |
Deprecated. |
limit |
Deprecated. |
Value
The function returns the cdm reference provided with the addition of the new cohort table.
Examples
library(DrugUtilisation)
library(dplyr)
cdm <- mockDrugUtilisation()
cdm <- generateIngredientCohortSet(
cdm = cdm,
ingredient = "acetaminophen",
name = "acetaminophen"
)
cdm$acetaminophen |>
glimpse()