
Requirements on Presence and Absence
+
Requirements related to other cohorts, concept sets, or tables
Source:vignettes/a04_require_intersections.Rmd
@@ -90,8 +90,10 @@
-library(CohortConstructor)
+library(CodelistGenerator)
+library(CohortConstructor)
library(CohortCharacteristics)
+library(visOmopResults)
library(ggplot2)
For this example we’ll use the Eunomia synthetic data from the CDMConnector package.
@@ -99,71 +101,66 @@con <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomia_dir())
cdm <- cdm_from_con(con, cdm_schema = "main",
write_schema = c(prefix = "my_study_", schema = "main"))
Let’s start by creating two drug cohorts, one for users of diclofenac -and another for users of acetaminophen.
+Let’s start by creating a cohort of warfarin users.
-cdm$medications <- conceptCohort(cdm = cdm,
- conceptSet = list("diclofenac" = 1124300,
- "acetaminophen" = 1127433),
- name = "medications")
-cohortCount(cdm$medications)
-#> # A tibble: 2 × 3
+warfarin_codes <- getDrugIngredientCodes(cdm, "warfarin")
+cdm$warfarin <- conceptCohort(cdm = cdm,
+ conceptSet = warfarin_codes,
+ name = "warfarin")
+cohortCount(cdm$warfarin)
+#> # A tibble: 1 × 3
#> cohort_definition_id number_records number_subjects
#> <int> <int> <int>
-#> 1 1 9365 2580
-#> 2 2 830 830
As well as our medication cohorts, let’s also make another cohort +#> 1 1 137 137