# \donttest{
library(CohortConstructor)
cdm <- mockCohortConstructor(conditionOccurrence = TRUE, drugExposure = TRUE)
cdm$cohort <- conceptCohort(cdm = cdm, conceptSet = list(a = 444074), name = "cohort")
cdm$cohort |> attrition()
# Create a cohort based on a concept set. The cohort exit is set to the event start date.
# If two records overlap, the cohort end date is set as the sum of the duration of
# all overlapping records. Only individuals included in the existing `cohort` will be considered.
conceptSet <- list("nitrogen" = c(35604434, 35604439),
"potassium" = c(40741270, 42899580, 44081436))
cohort_drugs <- conceptCohort(cdm,
conceptSet = conceptSet,
name = "cohort_drugs",
exit = "event_start_date",
overlap = "extend",
subsetCohort = "cohort"
)
cohort_drugs |> attrition()
# }
Run the code above in your browser using DataLab