diff --git a/404.html b/404.html index 30a08e6..5cc0a54 100644 --- a/404.html +++ b/404.html @@ -27,7 +27,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/LICENSE.html b/LICENSE.html index b5be911..5c28891 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a00_introduction.html b/articles/a00_introduction.html index c4b588b..ac700b6 100644 --- a/articles/a00_introduction.html +++ b/articles/a00_introduction.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a01_building_base_cohorts.html b/articles/a01_building_base_cohorts.html index 464712c..77469c0 100644 --- a/articles/a01_building_base_cohorts.html +++ b/articles/a01_building_base_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -130,7 +130,7 @@ Demographic based cohort creation median_start_age = median(age), max_start_age = max(age)) #> # Source: SQL [1 x 3] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmphiMfJs/file21f25684f9b7.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmpLmw3lH/file219068203c18.duckdb] #> min_start_age median_start_age max_start_age #> <int> <dbl> <int> #> 1 17 18 18 @@ -141,7 +141,7 @@ Demographic based cohort creation median_start_age = median(age), max_start_age = max(age)) #> # Source: SQL [1 x 3] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmphiMfJs/file21f25684f9b7.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmpLmw3lH/file219068203c18.duckdb] #> min_start_age median_start_age max_start_age #> <int> <dbl> <int> #> 1 31 57 65 diff --git a/articles/a02_cohort_table_requirements.html b/articles/a02_cohort_table_requirements.html index 6c536a8..249df89 100644 --- a/articles/a02_cohort_table_requirements.html +++ b/articles/a02_cohort_table_requirements.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a03_require_demographics.html b/articles/a03_require_demographics.html index 19304e8..4822541 100644 --- a/articles/a03_require_demographics.html +++ b/articles/a03_require_demographics.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a04_require_intersections.html b/articles/a04_require_intersections.html index d9c3982..76fea6a 100644 --- a/articles/a04_require_intersections.html +++ b/articles/a04_require_intersections.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a05_update_cohort_start_end.html b/articles/a05_update_cohort_start_end.html index 5169650..1f60b02 100644 --- a/articles/a05_update_cohort_start_end.html +++ b/articles/a05_update_cohort_start_end.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a06_concatanate_cohorts.html b/articles/a06_concatanate_cohorts.html index 0dee58d..f8d91a3 100644 --- a/articles/a06_concatanate_cohorts.html +++ b/articles/a06_concatanate_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -121,17 +121,17 @@ cdm$medications %>% filter(subject_id == 1) #> # Source: SQL [4 x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp7X9hnP/file23597b1a402e.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp63eoUI/file230130379d08.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 1 1976-10-20 1976-11-03 -#> 2 1 1 1971-01-04 1971-01-18 -#> 3 1 1 1982-09-11 1982-10-02 -#> 4 1 1 1980-03-15 1980-03-29 +#> 1 1 1 1971-01-04 1971-01-18 +#> 2 1 1 1982-09-11 1982-10-02 +#> 3 1 1 1980-03-15 1980-03-29 +#> 4 1 1 1976-10-20 1976-11-03 cdm$medications_collapsed %>% filter(subject_id == 1) #> # Source: SQL [3 x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp7X9hnP/file23597b1a402e.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp63eoUI/file230130379d08.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> #> 1 1 1 1976-10-20 1976-11-03 diff --git a/articles/a07_filter_cohorts.html b/articles/a07_filter_cohorts.html index 7f9f800..e8b76c8 100644 --- a/articles/a07_filter_cohorts.html +++ b/articles/a07_filter_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -108,26 +108,26 @@ cdm$medications |> sampleCohorts(cohortId = NULL, n = 100) #> # Source: table<main.my_study_medications> [?? x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp4IP3Tf/file239e6d25bc76.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmpCf9KA8/file23437cc57145.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 887 1974-10-05 1974-10-19 -#> 2 1 5048 1978-01-22 1978-01-29 -#> 3 1 1550 1981-02-07 1981-05-08 -#> 4 1 4490 1956-04-15 1956-04-29 -#> 5 1 3488 1960-04-20 1960-05-04 -#> 6 1 3655 1997-08-04 1997-08-25 -#> 7 2 1227 1980-05-31 1980-05-31 -#> 8 1 4078 1967-09-12 1967-09-19 -#> 9 1 4655 1982-11-20 1982-12-25 -#> 10 1 2228 2001-02-26 2001-03-12 +#> 1 1 1246 1947-11-06 1947-11-20 +#> 2 1 1246 2011-03-12 2011-03-26 +#> 3 1 2576 1993-10-25 1993-11-15 +#> 4 1 4758 1995-10-21 1995-11-04 +#> 5 1 4758 1999-11-11 2000-02-09 +#> 6 1 4364 2005-03-18 2005-04-01 +#> 7 1 1804 1989-07-12 1989-07-19 +#> 8 2 640 1992-11-07 1992-11-07 +#> 9 1 3389 1973-01-15 1973-02-14 +#> 10 1 3389 2005-02-04 2005-02-18 #> # ℹ more rows cohortCount(cdm$medications) #> # A tibble: 2 × 3 #> cohort_definition_id number_records number_subjects #> <int> <int> <int> -#> 1 1 324 100 +#> 1 1 345 100 #> 2 2 100 100 When cohortId = NULL all cohorts in the table are used. Note that this function does not reduced the number of records in each cohort, diff --git a/articles/a08_split_cohorts.html b/articles/a08_split_cohorts.html index 35da880..98ca063 100644 --- a/articles/a08_split_cohorts.html +++ b/articles/a08_split_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a09_combine_cohorts.html b/articles/a09_combine_cohorts.html index 755bd59..fb55323 100644 --- a/articles/a09_combine_cohorts.html +++ b/articles/a09_combine_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a10_match_cohorts.html b/articles/a10_match_cohorts.html index c5d767c..9be8219 100644 --- a/articles/a10_match_cohorts.html +++ b/articles/a10_match_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a11_benchmark.html b/articles/a11_benchmark.html index a7138c2..150a003 100644 --- a/articles/a11_benchmark.html +++ b/articles/a11_benchmark.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/index.html b/articles/index.html index 6324593..54ee3a3 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/authors.html b/authors.html index 0b77172..aebdcab 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -90,13 +90,13 @@ Citation Burn E, Catala M, Mercade-Besora N, Alcalde-Herraiz M, Du M, Guo Y, Chen X, Lopez-Guell K, Rowlands E (2024). CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model. -R package version 0.3.1, https://ohdsi.github.io/CohortConstructor/. +R package version 0.3.1.900, https://ohdsi.github.io/CohortConstructor/. @Manual{, title = {CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model}, author = {Edward Burn and Marti Catala and Nuria Mercade-Besora and Marta Alcalde-Herraiz and Mike Du and Yuchen Guo and Xihang Chen and Kim Lopez-Guell and Elin Rowlands}, year = {2024}, - note = {R package version 0.3.1}, + note = {R package version 0.3.1.900}, url = {https://ohdsi.github.io/CohortConstructor/}, } diff --git a/index.html b/index.html index 9385ede..3373601 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/pkgdown.yml b/pkgdown.yml index dad9b05..46fc45a 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -14,7 +14,7 @@ articles: a09_combine_cohorts: a09_combine_cohorts.html a10_match_cohorts: a10_match_cohorts.html a11_benchmark: a11_benchmark.html -last_built: 2024-10-11T14:52Z +last_built: 2024-10-11T15:31Z urls: reference: https://ohdsi.github.io/CohortConstructor/reference article: https://ohdsi.github.io/CohortConstructor/articles diff --git a/reference/CohortConstructor-package.html b/reference/CohortConstructor-package.html index 0fc0c10..096463e 100644 --- a/reference/CohortConstructor-package.html +++ b/reference/CohortConstructor-package.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/benchmarkData.html b/reference/benchmarkData.html index 097fc19..06e197d 100644 --- a/reference/benchmarkData.html +++ b/reference/benchmarkData.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cdmDoc.html b/reference/cdmDoc.html index 2134bf9..771e974 100644 --- a/reference/cdmDoc.html +++ b/reference/cdmDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortDoc.html b/reference/cohortDoc.html index c8ab3cf..8364922 100644 --- a/reference/cohortDoc.html +++ b/reference/cohortDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdModifyDoc.html b/reference/cohortIdModifyDoc.html index 1ac353a..951e840 100644 --- a/reference/cohortIdModifyDoc.html +++ b/reference/cohortIdModifyDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdSubsetDoc.html b/reference/cohortIdSubsetDoc.html index 9327a0f..b7319b7 100644 --- a/reference/cohortIdSubsetDoc.html +++ b/reference/cohortIdSubsetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/collapseCohorts.html b/reference/collapseCohorts.html index 1e48519..4a8210e 100644 --- a/reference/collapseCohorts.html +++ b/reference/collapseCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/columnDateDoc.html b/reference/columnDateDoc.html index 331c1e3..31842d5 100644 --- a/reference/columnDateDoc.html +++ b/reference/columnDateDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptCohort.html b/reference/conceptCohort.html index 7cc2b20..54155db 100644 --- a/reference/conceptCohort.html +++ b/reference/conceptCohort.html @@ -53,7 +53,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptSetDoc.html b/reference/conceptSetDoc.html index 3f205c7..934e317 100644 --- a/reference/conceptSetDoc.html +++ b/reference/conceptSetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/demographicsCohort.html b/reference/demographicsCohort.html index 4a27b6c..c1df445 100644 --- a/reference/demographicsCohort.html +++ b/reference/demographicsCohort.html @@ -13,7 +13,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/entryAtFirstDate.html b/reference/entryAtFirstDate.html index 75ce1d9..4ca43a6 100644 --- a/reference/entryAtFirstDate.html +++ b/reference/entryAtFirstDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -181,10 +181,10 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> <dbl> <dbl> <date> <date> <chr> -#> 1 1 1 2001-08-01 2001-09-01 date_2; dat… +#> 1 1 2 2001-01-01 2001-01-12 date_1 #> 2 1 3 2015-02-14 2015-02-15 date_2 -#> 3 1 4 2002-12-09 2002-12-09 date_2; dat… -#> 4 1 2 2001-01-01 2001-01-12 date_1 +#> 3 1 1 2001-08-01 2001-09-01 date_1; dat… +#> 4 1 4 2002-12-09 2002-12-09 date_1; dat… # } diff --git a/reference/entryAtLastDate.html b/reference/entryAtLastDate.html index 7ee6635..a132709 100644 --- a/reference/entryAtLastDate.html +++ b/reference/entryAtLastDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -181,10 +181,10 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> <dbl> <dbl> <date> <date> <chr> -#> 1 1 1 2001-08-01 2001-09-01 date_2; dat… -#> 2 1 4 2002-12-09 2002-12-09 date_2; dat… -#> 3 1 2 2001-01-01 2001-01-12 date_1 -#> 4 1 3 2015-02-14 2015-02-15 date_2 +#> 1 1 2 2001-01-01 2001-01-12 date_1 +#> 2 1 3 2015-02-14 2015-02-15 date_2 +#> 3 1 4 2002-12-09 2002-12-09 date_1; dat… +#> 4 1 1 2001-08-01 2001-09-01 date_1; dat… # } diff --git a/reference/exitAtDeath.html b/reference/exitAtDeath.html index ef4b85a..4fbfec7 100644 --- a/reference/exitAtDeath.html +++ b/reference/exitAtDeath.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -105,16 +105,16 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 2 5 1966-05-05 1970-11-15 -#> 2 2 3 1939-07-24 1944-01-14 -#> 3 1 10 1948-08-08 1952-03-27 +#> 1 1 1 1943-11-26 1949-06-21 +#> 2 2 5 1966-05-05 1970-11-15 +#> 3 2 3 1939-07-24 1944-01-14 #> 4 2 4 1949-03-07 1951-05-08 -#> 5 3 6 1966-09-27 1975-03-05 -#> 6 3 2 1918-06-14 1921-11-28 -#> 7 3 8 1921-10-07 1931-05-01 -#> 8 1 9 1940-05-01 1945-06-29 -#> 9 3 7 1962-05-14 1964-03-08 -#> 10 1 1 1943-11-26 1949-06-21 +#> 5 1 10 1948-08-08 1952-03-27 +#> 6 3 6 1966-09-27 1975-03-05 +#> 7 3 2 1918-06-14 1921-11-28 +#> 8 3 8 1921-10-07 1931-05-01 +#> 9 1 9 1940-05-01 1945-06-29 +#> 10 3 7 1962-05-14 1964-03-08 # } diff --git a/reference/exitAtFirstDate.html b/reference/exitAtFirstDate.html index cc327b5..74343fe 100644 --- a/reference/exitAtFirstDate.html +++ b/reference/exitAtFirstDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -182,8 +182,8 @@ Examples#> cohort_definition_id subject_id cohort_start_date cohort_end_date exit_reason #> <dbl> <dbl> <date> <date> <chr> #> 1 1 3 2015-01-15 2015-01-15 date_1 -#> 2 1 4 2000-12-09 2002-12-09 date_2; dat… -#> 3 1 2 2000-01-01 2001-01-01 date_1 +#> 2 1 2 2000-01-01 2001-01-01 date_1 +#> 3 1 4 2000-12-09 2002-12-09 date_2; dat… #> 4 1 1 2000-06-03 2001-08-01 date_2; dat… # } diff --git a/reference/exitAtLastDate.html b/reference/exitAtLastDate.html index f077f60..9c3d6c2 100644 --- a/reference/exitAtLastDate.html +++ b/reference/exitAtLastDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -181,8 +181,8 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date exit_reason #> <dbl> <dbl> <date> <date> <chr> -#> 1 1 4 2000-12-09 2002-12-09 date_1; dat… -#> 2 1 3 2015-01-15 2015-04-15 date_2 +#> 1 1 3 2015-01-15 2015-04-15 date_2 +#> 2 1 4 2000-12-09 2002-12-09 date_1; dat… #> 3 1 1 2000-06-03 2001-08-01 date_1; dat… #> 4 1 2 2000-01-01 2001-01-01 date_1 # } diff --git a/reference/exitAtObservationEnd.html b/reference/exitAtObservationEnd.html index 66a2b6a..01685e1 100644 --- a/reference/exitAtObservationEnd.html +++ b/reference/exitAtObservationEnd.html @@ -15,7 +15,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -101,12 +101,12 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 6 2003-10-31 2005-11-04 -#> 2 1 5 2007-10-19 2014-09-25 -#> 3 1 3 1976-11-28 2000-04-25 -#> 4 1 2 1964-09-18 1968-04-03 -#> 5 1 4 1998-06-22 2013-05-12 -#> 6 1 9 2012-01-18 2012-06-30 +#> 1 1 2 1964-09-18 1968-04-03 +#> 2 1 4 1998-06-22 2013-05-12 +#> 3 1 9 2012-01-18 2012-06-30 +#> 4 1 6 2003-10-31 2005-11-04 +#> 5 1 5 2007-10-19 2014-09-25 +#> 6 1 3 1976-11-28 2000-04-25 # } diff --git a/reference/gapDoc.html b/reference/gapDoc.html index cbfd865..4538250 100644 --- a/reference/gapDoc.html +++ b/reference/gapDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/index.html b/reference/index.html index 557ab83..5a2537e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -260,6 +260,12 @@ Update cohort start and end datesSet cohort end date to end of observation + padCohortEnd() + + + Add days to cohort end + + padCohortStart() diff --git a/reference/intersectCohorts.html b/reference/intersectCohorts.html index 602c177..5397cc4 100644 --- a/reference/intersectCohorts.html +++ b/reference/intersectCohorts.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/matchCohorts.html b/reference/matchCohorts.html index 149df86..424558b 100644 --- a/reference/matchCohorts.html +++ b/reference/matchCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -141,16 +141,16 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date cluster_id #> <int> <int> <date> <date> <dbl> -#> 1 1 110 2005-06-30 2005-09-30 99 +#> 1 1 110 2005-10-01 2006-06-12 99 #> 2 1 19 2015-04-24 2015-09-01 108 -#> 3 1 33 1993-05-10 1997-04-01 14 -#> 4 1 39 2002-07-11 2004-08-07 44 -#> 5 1 16 2007-05-18 2007-10-08 101 -#> 6 1 80 2000-12-22 2002-04-17 18 -#> 7 1 91 1995-05-16 2002-02-02 42 -#> 8 1 30 2008-04-20 2010-01-04 27 -#> 9 1 123 1983-11-30 1995-08-19 21 -#> 10 1 148 2006-09-04 2011-12-31 37 +#> 3 1 166 2017-05-16 2017-09-25 59 +#> 4 1 33 1993-05-10 1997-04-01 14 +#> 5 1 39 2004-08-08 2006-11-19 45 +#> 6 1 123 1983-11-30 1995-08-19 21 +#> 7 1 16 2004-09-11 2006-10-01 102 +#> 8 1 80 2000-12-22 2002-04-17 18 +#> 9 1 91 1995-05-16 2002-02-02 42 +#> 10 1 89 2007-06-18 2007-10-03 54 #> # ℹ more rows # } diff --git a/reference/measurementCohort.html b/reference/measurementCohort.html index 5a16a17..9fa287c 100644 --- a/reference/measurementCohort.html +++ b/reference/measurementCohort.html @@ -31,7 +31,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/mockCohortConstructor.html b/reference/mockCohortConstructor.html index e3dcfb9..719984f 100644 --- a/reference/mockCohortConstructor.html +++ b/reference/mockCohortConstructor.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/nameDoc.html b/reference/nameDoc.html index 03e2134..5c6ad98 100644 --- a/reference/nameDoc.html +++ b/reference/nameDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/padCohortEnd.html b/reference/padCohortEnd.html new file mode 100644 index 0000000..83d0bb1 --- /dev/null +++ b/reference/padCohortEnd.html @@ -0,0 +1,152 @@ + +Add days to cohort end — padCohortEnd • CohortConstructor + Skip to contents + + + + + CohortConstructor + + 0.3.1.900 + + + + + + + + Reference + + Articles + Introduction + Building base cohorts + Cohort Requirements + Demographic Requirements + Requirements on Presence and Absence + Update cohort start and end dates + Concatenate Cohorts + Filter Cohorts + a07_split_cohorts + a08_combine_cohorts + Generate a matched age and sex cohort + CohortConstructor benchmark + + + + + + + + + + + Add days to cohort end + + padCohortEnd.Rd + + + + padCohortStart() Adds (or subtracts) a certain number of days to the cohort +end date. Note:If the days added means that cohort end would be after observation +period end date, then observation period end date will be used for cohort +exit. +If the days added means that cohort exit would be after the next cohort +start then these overlapping cohort entries will be collapsed. +If days subtracted means that cohort end would be before cohort start then +the cohort entry will be dropped. + + + + Usage + padCohortEnd(cohort, days, cohortId = NULL, name = tableName(cohort)) + + + + Arguments + + +cohort +A cohort table in a cdm reference. + + +days +Number of day to add to the cohort end date. + + +cohortId +Vector identifying which cohorts to modify +(cohort_definition_id or cohort_name). If NULL, all cohorts will be +used; otherwise, only the specified cohorts will be modified, and the +rest will remain unchanged. + + +name +Name of the new cohort table created in the cdm object. + + + + Value + Cohort table + + + + Examples + # \donttest{ +library(CohortConstructor) +cdm <- mockCohortConstructor() +# add 10 days to each cohort exit +cdm$cohort1 |> + padCohortEnd(days = 10) +#> # Source: table<main.cohort1> [6 x 4] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] +#> cohort_definition_id subject_id cohort_start_date cohort_end_date +#> <int> <int> <date> <date> +#> 1 1 2 1964-09-18 1965-09-09 +#> 2 1 6 2003-10-31 2004-04-20 +#> 3 1 9 2012-01-18 2012-03-18 +#> 4 1 4 1998-06-22 2001-02-22 +#> 5 1 5 2007-10-19 2011-09-22 +#> 6 1 3 1976-11-28 1987-03-08 +# } + + + + + + + + + + + + + diff --git a/reference/padCohortStart.html b/reference/padCohortStart.html index 5e67bc7..a56b0c1 100644 --- a/reference/padCohortStart.html +++ b/reference/padCohortStart.html @@ -21,7 +21,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/reexports.html b/reference/reexports.html index 8383dba..4d51a7c 100644 --- a/reference/reexports.html +++ b/reference/reexports.html @@ -29,7 +29,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireAge.html b/reference/requireAge.html index e1698a8..0f472c0 100644 --- a/reference/requireAge.html +++ b/reference/requireAge.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireCohortIntersect.html b/reference/requireCohortIntersect.html index b7e66c5..751e383 100644 --- a/reference/requireCohortIntersect.html +++ b/reference/requireCohortIntersect.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireConceptIntersect.html b/reference/requireConceptIntersect.html index dd451c7..380fd56 100644 --- a/reference/requireConceptIntersect.html +++ b/reference/requireConceptIntersect.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireDeathFlag.html b/reference/requireDeathFlag.html index 8015f9b..3f637cf 100644 --- a/reference/requireDeathFlag.html +++ b/reference/requireDeathFlag.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireDemographics.html b/reference/requireDemographics.html index 14382d5..df6a6de 100644 --- a/reference/requireDemographics.html +++ b/reference/requireDemographics.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireDemographicsDoc.html b/reference/requireDemographicsDoc.html index 6a89859..e932133 100644 --- a/reference/requireDemographicsDoc.html +++ b/reference/requireDemographicsDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireFutureObservation.html b/reference/requireFutureObservation.html index 1ebe4c3..6e0985c 100644 --- a/reference/requireFutureObservation.html +++ b/reference/requireFutureObservation.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -111,15 +111,15 @@ Examples#> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> #> 1 1 2 1964-09-18 1965-08-30 -#> 2 1 3 1978-04-04 1987-02-26 +#> 2 1 3 1976-11-28 1977-03-11 #> 3 1 4 1998-06-22 2001-02-12 -#> 4 1 5 2007-10-19 2008-11-10 +#> 4 1 5 2008-11-11 2011-09-12 #> 5 1 6 2003-11-15 2004-04-10 #> 6 1 9 2012-01-18 2012-03-08 -#> 7 1 3 1977-03-12 1978-04-03 -#> 8 1 5 2008-11-11 2011-09-12 +#> 7 1 3 1978-04-04 1987-02-26 +#> 8 1 5 2007-10-19 2008-11-10 #> 9 1 6 2003-10-31 2003-11-14 -#> 10 1 3 1976-11-28 1977-03-11 +#> 10 1 3 1977-03-12 1978-04-03 # } diff --git a/reference/requireInDateRange.html b/reference/requireInDateRange.html index 4bed005..a251801 100644 --- a/reference/requireInDateRange.html +++ b/reference/requireInDateRange.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireIntersectDoc.html b/reference/requireIntersectDoc.html index ec0e166..dc4c514 100644 --- a/reference/requireIntersectDoc.html +++ b/reference/requireIntersectDoc.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireIsEntry.html b/reference/requireIsEntry.html index 570d6be..7d63df4 100644 --- a/reference/requireIsEntry.html +++ b/reference/requireIsEntry.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireIsFirstEntry.html b/reference/requireIsFirstEntry.html index 9209672..3684222 100644 --- a/reference/requireIsFirstEntry.html +++ b/reference/requireIsFirstEntry.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireIsLastEntry.html b/reference/requireIsLastEntry.html index 976d809..6c76b40 100644 --- a/reference/requireIsLastEntry.html +++ b/reference/requireIsLastEntry.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireMinCohortCount.html b/reference/requireMinCohortCount.html index 2f7d807..e5a3000 100644 --- a/reference/requireMinCohortCount.html +++ b/reference/requireMinCohortCount.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requirePriorObservation.html b/reference/requirePriorObservation.html index 4a1b08c..1faa6d0 100644 --- a/reference/requirePriorObservation.html +++ b/reference/requirePriorObservation.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireSex.html b/reference/requireSex.html index 0c1c8b3..e9ecc5f 100644 --- a/reference/requireSex.html +++ b/reference/requireSex.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/requireTableIntersect.html b/reference/requireTableIntersect.html index ff82935..15dbbfc 100644 --- a/reference/requireTableIntersect.html +++ b/reference/requireTableIntersect.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/sampleCohorts.html b/reference/sampleCohorts.html index 4a92d2b..4784d83 100644 --- a/reference/sampleCohorts.html +++ b/reference/sampleCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -97,16 +97,16 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 13 1991-04-14 1992-10-21 -#> 2 1 13 1992-11-03 2000-11-27 -#> 3 1 17 2009-06-18 2013-02-01 -#> 4 1 23 2000-10-08 2001-06-04 -#> 5 1 23 2001-06-05 2003-08-26 -#> 6 1 34 2005-06-12 2006-03-16 -#> 7 1 34 2006-03-17 2008-07-24 -#> 8 1 38 1978-07-24 1979-07-04 -#> 9 1 38 1979-07-05 1982-01-31 -#> 10 1 46 2014-12-14 2015-08-31 +#> 1 1 6 2003-04-11 2004-02-23 +#> 2 1 32 1982-10-28 1984-05-05 +#> 3 1 32 1984-05-06 1989-01-03 +#> 4 1 39 2000-03-07 2009-03-17 +#> 5 1 43 1987-05-07 1987-05-08 +#> 6 1 43 1987-05-09 1995-03-03 +#> 7 1 46 2014-12-14 2015-08-31 +#> 8 1 46 2015-09-01 2017-05-20 +#> 9 1 54 2014-11-14 2016-06-22 +#> 10 1 64 2018-01-25 2018-02-01 #> # ℹ more rows # } diff --git a/reference/stratifyCohorts.html b/reference/stratifyCohorts.html index ee39a9a..e758b0f 100644 --- a/reference/stratifyCohorts.html +++ b/reference/stratifyCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/subsetCohorts.html b/reference/subsetCohorts.html index 0938d9f..1309036 100644 --- a/reference/subsetCohorts.html +++ b/reference/subsetCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/trimDemographics.html b/reference/trimDemographics.html index 1d374c1..2b19a8a 100644 --- a/reference/trimDemographics.html +++ b/reference/trimDemographics.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/trimToDateRange.html b/reference/trimToDateRange.html index 31c0755..5588397 100644 --- a/reference/trimToDateRange.html +++ b/reference/trimToDateRange.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/unionCohorts.html b/reference/unionCohorts.html index 18ebd77..0b41a5f 100644 --- a/reference/unionCohorts.html +++ b/reference/unionCohorts.html @@ -11,7 +11,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/windowDoc.html b/reference/windowDoc.html index 8f33c2d..1c09dc9 100644 --- a/reference/windowDoc.html +++ b/reference/windowDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/yearCohorts.html b/reference/yearCohorts.html index b785b80..2c5f987 100644 --- a/reference/yearCohorts.html +++ b/reference/yearCohorts.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/search.json b/search.json index e9c7d0a..26c45bd 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"Apache License","title":"Apache License","text":"Version 2.0, January 2004 ","code":""},{"path":[]},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_1-definitions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"1. Definitions","title":"Apache License","text":"“License” shall mean terms conditions use, reproduction, distribution defined Sections 1 9 document. “Licensor” shall mean copyright owner entity authorized copyright owner granting License. “Legal Entity” shall mean union acting entity entities control, controlled , common control entity. purposes definition, “control” means () power, direct indirect, cause direction management entity, whether contract otherwise, (ii) ownership fifty percent (50%) outstanding shares, (iii) beneficial ownership entity. “” (“”) shall mean individual Legal Entity exercising permissions granted License. “Source” form shall mean preferred form making modifications, including limited software source code, documentation source, configuration files. “Object” form shall mean form resulting mechanical transformation translation Source form, including limited compiled object code, generated documentation, conversions media types. “Work” shall mean work authorship, whether Source Object form, made available License, indicated copyright notice included attached work (example provided Appendix ). “Derivative Works” shall mean work, whether Source Object form, based (derived ) Work editorial revisions, annotations, elaborations, modifications represent, whole, original work authorship. purposes License, Derivative Works shall include works remain separable , merely link (bind name) interfaces , Work Derivative Works thereof. “Contribution” shall mean work authorship, including original version Work modifications additions Work Derivative Works thereof, intentionally submitted Licensor inclusion Work copyright owner individual Legal Entity authorized submit behalf copyright owner. purposes definition, “submitted” means form electronic, verbal, written communication sent Licensor representatives, including limited communication electronic mailing lists, source code control systems, issue tracking systems managed , behalf , Licensor purpose discussing improving Work, excluding communication conspicuously marked otherwise designated writing copyright owner “Contribution.” “Contributor” shall mean Licensor individual Legal Entity behalf Contribution received Licensor subsequently incorporated within Work.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_2-grant-of-copyright-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"2. Grant of Copyright License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable copyright license reproduce, prepare Derivative Works , publicly display, publicly perform, sublicense, distribute Work Derivative Works Source Object form.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_3-grant-of-patent-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"3. Grant of Patent License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable (except stated section) patent license make, made, use, offer sell, sell, import, otherwise transfer Work, license applies patent claims licensable Contributor necessarily infringed Contribution(s) alone combination Contribution(s) Work Contribution(s) submitted. institute patent litigation entity (including cross-claim counterclaim lawsuit) alleging Work Contribution incorporated within Work constitutes direct contributory patent infringement, patent licenses granted License Work shall terminate date litigation filed.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_4-redistribution","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"4. Redistribution","title":"Apache License","text":"may reproduce distribute copies Work Derivative Works thereof medium, without modifications, Source Object form, provided meet following conditions: () must give recipients Work Derivative Works copy License; (b) must cause modified files carry prominent notices stating changed files; (c) must retain, Source form Derivative Works distribute, copyright, patent, trademark, attribution notices Source form Work, excluding notices pertain part Derivative Works; (d) Work includes “NOTICE” text file part distribution, Derivative Works distribute must include readable copy attribution notices contained within NOTICE file, excluding notices pertain part Derivative Works, least one following places: within NOTICE text file distributed part Derivative Works; within Source form documentation, provided along Derivative Works; , within display generated Derivative Works, wherever third-party notices normally appear. contents NOTICE file informational purposes modify License. may add attribution notices within Derivative Works distribute, alongside addendum NOTICE text Work, provided additional attribution notices construed modifying License. may add copyright statement modifications may provide additional different license terms conditions use, reproduction, distribution modifications, Derivative Works whole, provided use, reproduction, distribution Work otherwise complies conditions stated License.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_5-submission-of-contributions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"5. Submission of Contributions","title":"Apache License","text":"Unless explicitly state otherwise, Contribution intentionally submitted inclusion Work Licensor shall terms conditions License, without additional terms conditions. Notwithstanding , nothing herein shall supersede modify terms separate license agreement may executed Licensor regarding Contributions.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_6-trademarks","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"6. Trademarks","title":"Apache License","text":"License grant permission use trade names, trademarks, service marks, product names Licensor, except required reasonable customary use describing origin Work reproducing content NOTICE file.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_7-disclaimer-of-warranty","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"7. Disclaimer of Warranty","title":"Apache License","text":"Unless required applicable law agreed writing, Licensor provides Work (Contributor provides Contributions) “” BASIS, WITHOUT WARRANTIES CONDITIONS KIND, either express implied, including, without limitation, warranties conditions TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS PARTICULAR PURPOSE. solely responsible determining appropriateness using redistributing Work assume risks associated exercise permissions License.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_8-limitation-of-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"8. Limitation of Liability","title":"Apache License","text":"event legal theory, whether tort (including negligence), contract, otherwise, unless required applicable law (deliberate grossly negligent acts) agreed writing, shall Contributor liable damages, including direct, indirect, special, incidental, consequential damages character arising result License use inability use Work (including limited damages loss goodwill, work stoppage, computer failure malfunction, commercial damages losses), even Contributor advised possibility damages.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"id_9-accepting-warranty-or-additional-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"9. Accepting Warranty or Additional Liability","title":"Apache License","text":"redistributing Work Derivative Works thereof, may choose offer, charge fee , acceptance support, warranty, indemnity, liability obligations /rights consistent License. However, accepting obligations, may act behalf sole responsibility, behalf Contributor, agree indemnify, defend, hold Contributor harmless liability incurred , claims asserted , Contributor reason accepting warranty additional liability. END TERMS CONDITIONS","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/LICENSE.html","id":"appendix-how-to-apply-the-apache-license-to-your-work","dir":"","previous_headings":"","what":"APPENDIX: How to apply the Apache License to your work","title":"Apache License","text":"apply Apache License work, attach following boilerplate notice, fields enclosed brackets [] replaced identifying information. (Don’t include brackets!) text enclosed appropriate comment syntax file format. also recommend file class name description purpose included “printed page” copyright notice easier identification within third-party archives.","code":"Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a00_introduction.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Introduction","text":"CohortConstructor package designed support cohort building pipelines. using package general workflow first build set base cohorts subsequently apply inclusion criteria derive final study cohorts interest. Base cohorts built domain (rather cohort definition) one base cohort many study cohorts can derived.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a00_introduction.html","id":"building-a-cohort-set-by-domain","dir":"Articles","previous_headings":"","what":"Building a cohort set by domain","title":"Introduction","text":"Let´s say want build 5 cohorts 3 (asthma, copd, diabetes) defined based concepts seen condition occurrence table 2 (acetaminophen warfarin) based concepts recorded drug exposure table. can build cohorts independently, one . However, approach mean repeating 3 joins condition occurrence tables 2 joins drug exposure table (concepts concept sets). make less computationally expensive, instead create cohorts domain. case instead make one join condition occurrence table one drug exposure (using concept sets together).","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a00_introduction.html","id":"deriving-study-cohorts-from-base-cohorts","dir":"Articles","previous_headings":"","what":"Deriving study cohorts from base cohorts","title":"Introduction","text":"making study cohorts often concept sets define clinical event along various study-specific inclusion criteria, example criteria around amount prior observation age. Often may sensitivity analysis concept set remains inclusion criteria change. situations can make cohorts one--one. However, can lead duplication can see example identify asthma records multiple times. alternative approach build base cohort, case based asthma records, derive multiple cohorts different inclusion criteria applied.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a00_introduction.html","id":"considerations-when-building-cohorts","dir":"Articles","previous_headings":"","what":"Considerations when building cohorts","title":"Introduction","text":"CohortConstructor provides means building cohorts via pipeline, cohorts created application sequence functions. important note order sequence often important implications. example just one individual three recorded diagnoses asthma. One diagnosis 2008 two 2009, last coming individual´s 18th birthday. three cohort pipelines shown restrictions around calendar dates, age, record first. cohort pipeline , however, individual included final cohort, third diagnosis used cohort start. pipeline B C individual excluded.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a01_building_base_cohorts.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Building base cohorts","text":"Let’s first create cdm reference Eunomia synthetic data.","code":"library(CDMConnector) library(CodelistGenerator) library(PatientProfiles) library(CohortConstructor) library(dplyr) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomia_dir()) cdm <- cdm_from_con(con, cdm_schema = \"main\", write_schema = c(prefix = \"my_study_\", schema = \"main\"))"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a01_building_base_cohorts.html","id":"demographic-based-cohort-creation","dir":"Articles","previous_headings":"","what":"Demographic based cohort creation","title":"Building base cohorts","text":"One base cohort can create based around patient demographics. example create cohort people enter 18th birthday leave age 65 ","code":"cdm$working_age_cohort <- demographicsCohort(cdm = cdm, ageRange = c(18, 65), name = \"working_age_cohort\") settings(cdm$working_age_cohort) #> # A tibble: 1 × 3 #> cohort_definition_id cohort_name age_range #> #> 1 1 demographics 18_65 cohortCount(cdm$working_age_cohort) #> # A tibble: 1 × 3 #> cohort_definition_id number_records number_subjects #> #> 1 1 2694 2694 attrition(cdm$working_age_cohort) #> # A tibble: 2 × 7 #> cohort_definition_id number_records number_subjects reason_id reason #> #> 1 1 2694 2694 1 Initial qualify… #> 2 1 2694 2694 2 Age requirement… #> # ℹ 2 more variables: excluded_records , excluded_subjects cdm$working_age_cohort |> addAge(indexDate = \"cohort_start_date\") |> summarise(min_start_age = min(age), median_start_age = median(age), max_start_age = max(age)) #> # Source: SQL [1 x 3] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmphiMfJs/file21f25684f9b7.duckdb] #> min_start_age median_start_age max_start_age #> #> 1 17 18 18 cdm$working_age_cohort |> addAge(indexDate = \"cohort_end_date\") |> summarise(min_start_age = min(age), median_start_age = median(age), max_start_age = max(age)) #> # Source: SQL [1 x 3] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmphiMfJs/file21f25684f9b7.duckdb] #> min_start_age median_start_age max_start_age #> #> 1 31 57 65"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a01_building_base_cohorts.html","id":"concept-based-cohort-creation","dir":"Articles","previous_headings":"","what":"Concept based cohort creation","title":"Building base cohorts","text":"","code":"drug_codes <- getDrugIngredientCodes(cdm, name = c(\"diclofenac\", \"acetaminophen\")) drug_codes #> #> - 161_acetaminophen (7 codes) #> - 3355_diclofenac (1 codes) cdm$medications <- conceptCohort(cdm = cdm, conceptSet = drug_codes, name = \"medications\") settings(cdm$medications) #> # A tibble: 2 × 4 #> cohort_definition_id cohort_name cdm_version vocabulary_version #> #> 1 1 161_acetaminophen 5.3 v5.0 18-JAN-19 #> 2 2 3355_diclofenac 5.3 v5.0 18-JAN-19 cohortCount(cdm$medications) #> # A tibble: 2 × 3 #> cohort_definition_id number_records number_subjects #> #> 1 1 13908 2679 #> 2 2 830 830"},{"path":[]},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"keep-only-the-first-record-per-person","dir":"Articles","previous_headings":"","what":"Keep only the first record per person","title":"Cohort Requirements","text":"Individuals can contribute multiple records per cohort. However now ’ll keep earliest cohort entry remaining records using requireIsFirstEntry() CohortConstructor. flow chart illustrates changes cohort 1 (acetaminophen users) restricted first record individual. number individuals remains unchanged, 6,785 records excluded.","code":"cdm$medications <- cdm$medications %>% requireIsFirstEntry() summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"keep-only-a-specific-range-of-records","dir":"Articles","previous_headings":"","what":"Keep only a specific range of records","title":"Cohort Requirements","text":"can also choose specific range records using requireIsEntry() CohortConstructor. flow chart illustrates changes cohort 1 restricted first five records individual. number individuals remains unchanged, 6,785 records excluded.","code":"cdm$medications <- cdm$medications %>% requireIsEntry(c(1,5)) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"keep-only-the-last-record-per-person","dir":"Articles","previous_headings":"","what":"Keep only the last record per person","title":"Cohort Requirements","text":"also possible include last record individual using requireIsLastEntry() CohortConstructor. flow chart illustrates changes cohort 1 restricted last record individual. number individuals remains unchanged, 6,785 records excluded.","code":"cdm$medications <- cdm$medications %>% requireIsLastEntry() summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"keep-only-records-within-a-date-range","dir":"Articles","previous_headings":"","what":"Keep only records within a date range","title":"Cohort Requirements","text":"Individuals may contribute multiple records extended periods. can define study’s start end dates, filtering records fall outside specified date range using requireInDateRang function CohortConstructor. flow chart illustrates changes cohort 1 restricted specified date range. 1,948 individuals 8,660 records excluded.","code":"cdm$medications <- cdm$medications %>% requireInDateRange(dateRange = as.Date(c(\"2010-01-01\", \"2015-01-01\"))) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"keep-only-records-from-cohorts-with-a-minimum-number-of-individuals","dir":"Articles","previous_headings":"","what":"Keep only records from cohorts with a minimum number of individuals","title":"Cohort Requirements","text":"studies might require minimum cohort size. can define minimum size, filtering records smaller required, using requireMinCohortCount function CohortConstructor. Cohort 1 includes 2,580 individuals, none excluded due minimum cohort size restriction 1,000.","code":"cdm$medications <- cdm$medications %>% requireMinCohortCount(minCohortCount = 1000) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a02_cohort_table_requirements.html","id":"running-multiple-requirements","dir":"Articles","previous_headings":"","what":"Running multiple requirements","title":"Cohort Requirements","text":"Multiple restrictions can applied cohort, however care needs taken restrictions placed correct order. example, recommended apply minimum size restriction last. flow chart illustrates changes cohort 1 restricted include first record individual specified date range. 2,529 individuals 9,314 records excluded.","code":"cdm$medications <- cdm$medications %>% requireIsFirstEntry() %>% requireInDateRange(dateRange = as.Date(c(\"2010-01-01\", \"2016-01-01\"))) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a03_require_demographics.html","id":"restrict-cohort-by-age","dir":"Articles","previous_headings":"","what":"Restrict cohort by age","title":"Demographic Requirements","text":"can choose specific age range individuals cohort using requireAge() CohortConstructor. flow chart illustrates changes cohort 1 (users acetaminophen) restricted include individuals aged 18 90. 226 individuals 2,863 records excluded. variable ‘cohort_start_date’ used individuals filtered based age entered cohort.","code":"cdm$medications <- cdm$medications %>% requireAge(indexDate = \"cohort_start_date\", ageRange = list(c(18,100))) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a03_require_demographics.html","id":"restrict-cohort-by-sex","dir":"Articles","previous_headings":"","what":"Restrict cohort by sex","title":"Demographic Requirements","text":"can also specify sex criteria individuals cohort using requireSex() CohortConstructor. flow chart illustrates changes cohort 1 restricted include ‘female’ individuals. 1,264 individuals 4,647 records excluded.","code":"cdm$medications <- cdm$medications %>% requireSex(sex = \"Female\") summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a03_require_demographics.html","id":"restrict-cohort-by-number-of-prior-observations","dir":"Articles","previous_headings":"","what":"Restrict cohort by number of prior observations","title":"Demographic Requirements","text":"can also specify minimum number days prior observations individual using requirePriorObservation() CohortConstructor. flow chart illustrates changes cohort 1 restricted include individuals least 365 days prior observations. 5 individuals 109 records excluded.","code":"cdm$medications <- cdm$medications %>% requirePriorObservation(indexDate = \"cohort_start_date\", minPriorObservation = 365) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a03_require_demographics.html","id":"restrict-cohort-by-number-of-future-observations","dir":"Articles","previous_headings":"","what":"Restrict cohort by number of future observations","title":"Demographic Requirements","text":"can also specify minimum number days prior observations individual using requireFutureObservation() CohortConstructor. flow chart illustrates changes cohort 1 restricted include individuals least 365 days future observations. 14 individuals 206 records excluded.","code":"cdm$medications <- cdm$medications %>% requireFutureObservation(indexDate = \"cohort_start_date\", minFutureObservation = 365) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a03_require_demographics.html","id":"applying-multiple-demographic-requirements-to-a-cohort","dir":"Articles","previous_headings":"","what":"Applying multiple demographic requirements to a cohort","title":"Demographic Requirements","text":"can implement multiple demographic requirements cohort using requireDemographics() CohortConstructor. flow chart illustrates changes cohort 1 multiple demographic restrictions, female individuals 18 100 years old, least 365 days prior future observations included. 1,413 individuals 6156 records excluded.","code":"cdm$medications <- cdm$medications %>% requireDemographics(indexDate = \"cohort_start_date\", ageRange = c(18,100), sex = \"Female\", minPriorObservation = 365, minFutureObservation = 365) summary_attrition <- summariseCohortAttrition(cdm$medications) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a04_require_intersections.html","id":"restrictions-on-cohort-presence","dir":"Articles","previous_headings":"","what":"Restrictions on cohort presence","title":"Requirements on Presence and Absence","text":"require individuals medication cohorts seen (seen) another cohort. can use requireCohortIntersect() function, requiring individuals one intersections GI bleed cohort. flow chart illustrates changes cohort 1 (users acetaminophen) restricted include individuals intersect GI bleed cohort least cohort start date. 2,296 individuals 8,765 records excluded. Instead requiring individuals intersect GI bleed cohort, instead require don’t intersect . case can use requireCohortIntersect() function, time set intersections argument 0 require individuals’ absence cohort rather presence . flow chart illustrates changes cohort 1 restricted include individuals intersects GI bleed cohort cohort start date. 36 individuals 600 records excluded.","code":"cdm$medications_gi_bleed <- cdm$medications %>% requireCohortIntersect(intersections = c(1,Inf), targetCohortTable = \"gi_bleed\", targetCohortId = 1, indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_gi_bleed\") summary_attrition <- summariseCohortAttrition(cdm$medications_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1) cdm$medications_no_gi_bleed <- cdm$medications %>% requireCohortIntersect(intersections = 0, targetCohortTable = \"gi_bleed\", targetCohortId = 1, indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_no_gi_bleed\") summary_attrition <- summariseCohortAttrition(cdm$medications_no_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a04_require_intersections.html","id":"restrictions-on-concept-presence","dir":"Articles","previous_headings":"","what":"Restrictions on concept presence","title":"Requirements on Presence and Absence","text":"require individuals medication cohorts seen (seen) events related concept list. can use requireConceptIntersect() function, allowing us filter cohort based whether events GI bleeding entered cohort. flow chart illustrates changes cohort 1 restricted include individuals events GI bleeding least cohort start date. 2,296 individuals 8,765 records excluded. Instead requiring individuals events GI bleeding, instead require don’t events . case can use requireConceptIntersect() function, time set intersections argument 0 require individuals without past events GI bleeding. flow chart illustrates changes cohort 1 restricted include individuals events GI bleeding cohort start date. 36 individuals 600 records excluded.","code":"cdm$medications_gi_bleed <- cdm$medications %>% requireConceptIntersect(conceptSet = list(\"gi_bleed\" = 192671), indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_gi_bleed\") summary_attrition <- summariseCohortAttrition(cdm$medications_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1) cdm$medications_no_gi_bleed <- cdm$medications %>% requireConceptIntersect(intersections = 0, conceptSet = list(\"gi_bleed\" = 192671), indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_no_gi_bleed\") summary_attrition <- summariseCohortAttrition(cdm$medications_no_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a04_require_intersections.html","id":"restrictions-on-presence-in-clinical-tables","dir":"Articles","previous_headings":"","what":"Restrictions on presence in clinical tables","title":"Requirements on Presence and Absence","text":"clinical table table contains ‘raw’ clinical data. can use clinical tables filter cohorts using requireTableIntersect() function. allow us filter individuals medications cohort based whether intersections GI bleed clinical table . flow chart illustrates changes cohort 1 restricted include individuals intersect GI bleeding clinical table least cohort start date. 2,296 individuals 8,765 records excluded. Instead requiring individuals intersect GI bleed clinical table, instead require don’t intersect . case can use requireCohortIntersect() function, time set intersections argument 0 require individuals’ absence GI bleed clinical table. flow chart illustrates changes cohort 1 restricted include individuals intersects GI bleeding clinical table cohort start date. 36 individuals 600 records excluded.","code":"cdm$medications_gi_bleed <- cdm$medications %>% requireTableIntersect(tableName = \"gi_bleed\", indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_gi_bleed\") summary_attrition <- summariseCohortAttrition(cdm$medications_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1) cdm$medications_no_gi_bleed <- cdm$medications %>% requireTableIntersect(tableName = \"gi_bleed\", indexDate = \"cohort_start_date\", window = c(-Inf, 0), name = \"medications_no_gi_bleed\", intersections = 0) summary_attrition <- summariseCohortAttrition(cdm$medications_no_gi_bleed) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a04_require_intersections.html","id":"restrictions-on-deaths","dir":"Articles","previous_headings":"","what":"Restrictions on deaths","title":"Requirements on Presence and Absence","text":"require individuals medication cohorts seen () death. can use requireDeathFlag() function, requiring individuals seen (seen) died cohort start date. flow chart illustrates changes cohort 1 restricted include individuals died cohort start date. None individuals cohort 1 died therefore excluded cohort. exclude individuals died add argument ‘negate = TRUE’ function requireDeathFlag(). flow chart illustrates changes cohort 1 restricted include individuals die cohort start date. None individuals cohort 1 died therefore one excluded.","code":"cdm$medications_deaths <- cdm$medications %>% requireDeathFlag(window = c(0,Inf), name = \"medications_deaths\") summary_attrition <- summariseCohortAttrition(cdm$medications_deaths) plotCohortAttrition(summary_attrition, cohortId = 1) cdm$medications_no_deaths <- cdm$medications %>% requireDeathFlag(window = c(0,Inf), name = \"medications_no_deaths\", negate = TRUE) summary_attrition <- summariseCohortAttrition(cdm$medications_no_deaths) plotCohortAttrition(summary_attrition, cohortId = 1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Generate a matched age and sex cohort","text":"CohortConstructor packages includes function obtain age sex matched cohort, generateMatchedCohortSet() function. vignette, explore usage function.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"create-mock-data","dir":"Articles","previous_headings":"Introduction","what":"Create mock data","title":"Generate a matched age and sex cohort","text":"first use mockDrugUtilisation() function DrugUtilisation package create mock data. use cohort1 explore generateMatchedCohortSet(), let us first use cohort_attrition() CDMConnector package explore cohort:","code":"library(CohortConstructor) library(dplyr) cdm <- mockCohortConstructor(nPerson = 1000) CDMConnector::cohort_set(cdm$cohort1)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"use-generatematchedcohortset-to-create-an-age-sex-matched-cohort","dir":"Articles","previous_headings":"","what":"Use generateMatchedCohortSet() to create an age-sex matched cohort","title":"Generate a matched age and sex cohort","text":"Let us first see example function works. usage, need provide cdm object, targetCohortName, name table containing cohort interest, name new generated tibble containing cohort matched cohort. also use argument targetCohortId specify want matched cohort cohort_definition_id = 1. Notice generated tibble, two cohorts: cohort_definition_id = 1 (original cohort), cohort_definition_id = 4 (matched cohort). target_cohort_name column indicates original cohort. match_sex match_year_of_birth adopt boolean values (TRUE/FALSE) indicating matched sex age, . match_status indicate original cohort (target) matched cohort (matched). target_cohort_id indicates cohort_id original cohort. Check exclusion criteria applied generate new cohorts using cohort_attrition() CDMConnector package: Briefly, original cohort, exclude first individuals match, individuals matching pair observation assigned cohort_start_date. matched cohort, start whole database first exclude individuals original cohort. Afterwards, exclude individuals match, individuals observation assigned cohort_start_date, finally remove many individuals required fulfill ratio. Notice matching pairs randomly assigned, probable every time execute function, generated cohorts change. Use set.seed() avoid .","code":"cdm$matched_cohort1 <- matchCohorts( cohort = cdm$cohort1, cohortId = 1, name = \"matched_cohort1\") CDMConnector::cohort_set(cdm$matched_cohort1) # Original cohort CDMConnector::cohort_attrition(cdm$matched_cohort1) %>% filter(cohort_definition_id == 1) # Matched cohort CDMConnector::cohort_attrition(cdm$matched_cohort1) %>% filter(cohort_definition_id == 4)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"matchsex-parameter","dir":"Articles","previous_headings":"Use generateMatchedCohortSet() to create an age-sex matched cohort","what":"matchSex parameter","title":"Generate a matched age and sex cohort","text":"matchSex boolean parameter (TRUE/FALSE) indicating want match sex (TRUE) want (FALSE).","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"matchyear-parameter","dir":"Articles","previous_headings":"Use generateMatchedCohortSet() to create an age-sex matched cohort","what":"matchYear parameter","title":"Generate a matched age and sex cohort","text":"matchYear another boolean parameter (TRUE/FALSE) indicating want match age (TRUE) want (FALSE). Notice matchSex = FALSE matchYear = FALSE, obtain unmatched comparator cohort.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"ratio-parameter","dir":"Articles","previous_headings":"Use generateMatchedCohortSet() to create an age-sex matched cohort","what":"ratio parameter","title":"Generate a matched age and sex cohort","text":"default matching ratio 1:1 (ratio = 1). Use cohort_counts() CDMConnector check matching done desired. can modify ratio parameter tailor matched cohort. ratio can adopt values 1 Inf.","code":"CDMConnector::cohort_count(cdm$matched_cohort1) cdm$matched_cohort2 <- matchCohorts( cohort = cdm$cohort1, cohortId = 1, name = \"matched_cohort2\", ratio = Inf) CDMConnector::cohort_count(cdm$matched_cohort2)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a10_match_cohorts.html","id":"generate-matched-cohorts-simultaneously-across-multiple-cohorts","dir":"Articles","previous_headings":"Use generateMatchedCohortSet() to create an age-sex matched cohort","what":"Generate matched cohorts simultaneously across multiple cohorts","title":"Generate a matched age and sex cohort","text":"functionalities can implemented across multiple cohorts simultaneously. Specify targetCohortId parameter cohorts interest. set NULL, cohorts present targetCohortName matched. Notice cohort (independent cohorts) matched cohort.","code":"cdm$matched_cohort3 <- matchCohorts( cohort = cdm$cohort1, cohortId = c(1,3), name = \"matched_cohort3\", ratio = 2) CDMConnector::cohort_set(cdm$matched_cohort3) %>% arrange(cohort_definition_id) CDMConnector::cohort_count(cdm$matched_cohort3) %>% arrange(cohort_definition_id)"},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"CohortConstructor benchmark","text":"Cohorts fundamental building block studies use OMOP CDM, identifying people satisfy one inclusion criteria duration time based clinical records. Currently cohorts typically built using CIRCE allows complex cohorts represented using JSON. JSON converted SQL execution database containing data mapped OMOP CDM. CIRCE JSON can created via ATLAS GUI programmatically via Capr R package. However, although powerful tool expressing operationalising cohort definitions, SQL generated can cumbersome especially complex cohort definitions, moreover cohorts instantiated independently, leading duplicated work. CohortConstructor package offers alternative approach, emphasizing cohort building pipeline format. first creates base cohorts applies specific inclusion criteria. Unlike “definition” approach, ::cohorts built independently, CohortConstructor follows “domain” approach, minimizes redundant queries large OMOP tables. details approach can found Introduction vignette. benchmarked package using nine phenotypes OHDSI Phenotype library cover range concept domains, entry inclusion criteria, cohort exit options. replicated cohorts using CodelistGenerator CohortConstructor assess computational time agreement CIRCE CohortConstructor.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"code-and-collaboration","dir":"Articles","previous_headings":"Introduction","what":"Code and collaboration","title":"CohortConstructor benchmark","text":"benchmarking code available BenchmarkCohortConstructor repository GitHub. interested running code database, feel free reach us assistance, can also update vignette results! :) benchmark script executed following four databases: CPRD Gold: primary care database UK, capturing data mostly Northern Ireland, Wales, Scotland clinics. benchmark utilized 100,000-person sample dataset, managed using PostgreSQL. CPRD Aurum: Another UK primary care database, primarily covering clinics England. database managed SQL Server. Coriva: sample approximately 400,000 patients Estonia National Health Insurance database, managed PostgreSQL. OHDSI SQL Server: mock OMOP CDM dataset provided OHDSI, hosted SQL Server. table presents number records OMOP tables used benchmark script participating databases.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"cohorts","dir":"Articles","previous_headings":"","what":"Cohorts","title":"CohortConstructor benchmark","text":"replicated following cohorts OHDSI phenotype library: COVID-19 (ID 56), inpatient hospitalisation (23), new users beta blockers nested essential hypertension (1049), transverse myelitis (63), major non cardiac surgery (1289), asthma without COPD (27), endometriosis procedure (722), new fluoroquinolone users (1043), acquired neutropenia unspecified leukopenia (213). COVID-19 cohort used evaluate performance common cohort stratifications. compare package CIRCE, created definitions Atlas, stratified age groups sex, available benchmark GitHub repository benchmark code.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"cohort-counts-and-overlap","dir":"Articles","previous_headings":"Cohorts","what":"Cohort counts and overlap","title":"CohortConstructor benchmark","text":"following table displays number records subjects cohort across participating databases: also computed overlap patients CIRCE CohortConstructor cohorts, results shown plot :","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"performance","dir":"Articles","previous_headings":"","what":"Performance","title":"CohortConstructor benchmark","text":"evaluate CohortConstructor performance generated CIRCE cohorts using functionalities provided CodelistGenerator CohortConstructor, measured computational time taken. Two different approaches CohortConstructor tested: definition: created cohorts seprately. domain: nine targeted cohorts created together set, following domain approach described Introduction vignette. Briefly, approach involves creating base cohorts , requiring one call involved OMOP table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"by-definition","dir":"Articles","previous_headings":"Performance","what":"By definition","title":"CohortConstructor benchmark","text":"following plot shows times taken create cohort using CIRCE CohortConstructor cohorts created separately.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"by-domain","dir":"Articles","previous_headings":"Performance","what":"By domain","title":"CohortConstructor benchmark","text":"table depicts total time took create nine cohorts using domain approach CohortConstructor.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"cohort-stratification","dir":"Articles","previous_headings":"Performance","what":"Cohort stratification","title":"CohortConstructor benchmark","text":"Cohorts often stratified studies. Atlas cohort definitions, stratum requires new CIRCE JSON instantiated, CohortConstructor allows stratifications generated overall cohort. following table shows time taken create age sex stratifications COVID-19 cohort CIRCE CohortConstructor.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/articles/a11_benchmark.html","id":"use-of-sql-indexes","dir":"Articles","previous_headings":"Performance","what":"Use of SQL indexes","title":"CohortConstructor benchmark","text":"Postgres SQL databases, package uses indexes conceptCohort default. evaluate much indexes reduce computation time, instantiated subset concept sets benchmark, without indexes. Four calls made conceptCohort, involving different number OMOP tables. combinations : Drug exposure Drug exposure + condition occurrence Drug exposure + condition occurrence + procedure occurrence Drug exposure + condition occurrence + procedure occurrence + measurement plot shows computation time without SQL indexes scenario:","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Edward Burn. Author, maintainer. Marti Catala. Author. Nuria Mercade-Besora. Author. Marta Alcalde-Herraiz. Author. Mike Du. Author. Yuchen Guo. Author. Xihang Chen. Author. Kim Lopez-Guell. Author. Elin Rowlands. Author.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Burn E, Catala M, Mercade-Besora N, Alcalde-Herraiz M, Du M, Guo Y, Chen X, Lopez-Guell K, Rowlands E (2024). CohortConstructor: Build Manipulate Study Cohorts Using Common Data Model. R package version 0.3.1, https://ohdsi.github.io/CohortConstructor/.","code":"@Manual{, title = {CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model}, author = {Edward Burn and Marti Catala and Nuria Mercade-Besora and Marta Alcalde-Herraiz and Mike Du and Yuchen Guo and Xihang Chen and Kim Lopez-Guell and Elin Rowlands}, year = {2024}, note = {R package version 0.3.1}, url = {https://ohdsi.github.io/CohortConstructor/}, }"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"cohortconstructor-","dir":"","previous_headings":"","what":"Build and Manipulate Study Cohorts Using a Common Data Model","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"goal CohortConstructor support creation manipulation study cohorts data mapped OMOP CDM.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"package can installed CRAN: can install development version package GitHub:","code":"install.packages(\"CohortConstructor\") # install.packages(\"devtools\") devtools::install_github(\"ohdsi/CohortConstructor\")"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"creating-and-manipulating-cohorts","dir":"","previous_headings":"","what":"Creating and manipulating cohorts","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"illustrate functionality provided CohortConstructor let’s create set fracture cohorts using Eunomia dataset. ’ll first load required packages create cdm reference data.","code":"library(omopgenerics) library(CDMConnector) library(PatientProfiles) library(dplyr) library(CohortConstructor) library(CohortCharacteristics) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomia_dir()) cdm <- cdm_from_con(con, cdm_schema = \"main\", write_schema = c(prefix = \"my_study_\", schema = \"main\")) cdm #> #> ── # OMOP CDM reference (duckdb) of Synthea synthetic health database ────────── #> • omop tables: person, observation_period, visit_occurrence, visit_detail, #> condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, #> measurement, observation, death, note, note_nlp, specimen, fact_relationship, #> location, care_site, provider, payer_plan_period, cost, drug_era, dose_era, #> condition_era, metadata, cdm_source, concept, vocabulary, domain, #> concept_class, concept_relationship, relationship, concept_synonym, #> concept_ancestor, source_to_concept_map, drug_strength #> • cohort tables: - #> • achilles tables: - #> • other tables: -"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"generating-concept-based-fracture-cohorts","dir":"","previous_headings":"Creating and manipulating cohorts","what":"Generating concept-based fracture cohorts","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"start making simple concept-based cohort fracture interest. First create codelist ankle, forearm hip fractures (note, just use one code using synthetic data). Now can quickly create set cohorts fracture type. need provide codes defined get cohort back, cohort end date set event date associated records, overlapping records collapsed, records observation kept. can see starting cohorts, add additional restrictions, following associated settings, counts, attrition.","code":"fracture_codes <- newCodelist(list(\"ankle_fracture\" = 4059173L, \"forearm_fracture\" = 4278672L, \"hip_fracture\" = 4230399L)) fracture_codes #> #> ── 3 codelists ───────────────────────────────────────────────────────────────── #> #> - ankle_fracture (1 codes) #> - forearm_fracture (1 codes) #> - hip_fracture (1 codes) cdm$fractures <- cdm |> conceptCohort(conceptSet = fracture_codes, name = \"fractures\") settings(cdm$fractures) %>% glimpse() #> Rows: 3 #> Columns: 4 #> $ cohort_definition_id 1, 2, 3 #> $ cohort_name \"ankle_fracture\", \"forearm_fracture\", \"hip_fractu… #> $ cdm_version \"5.3\", \"5.3\", \"5.3\" #> $ vocabulary_version \"v5.0 18-JAN-19\", \"v5.0 18-JAN-19\", \"v5.0 18-JAN-… cohort_count(cdm$fractures) %>% glimpse() #> Rows: 3 #> Columns: 3 #> $ cohort_definition_id 1, 2, 3 #> $ number_records 464, 569, 138 #> $ number_subjects 427, 510, 132 attrition(cdm$fractures) %>% glimpse() #> Rows: 3 #> Columns: 7 #> $ cohort_definition_id 1, 2, 3 #> $ number_records 464, 569, 138 #> $ number_subjects 427, 510, 132 #> $ reason_id 1, 1, 1 #> $ reason \"Initial qualifying events\", \"Initial qualifying … #> $ excluded_records 0, 0, 0 #> $ excluded_subjects 0, 0, 0"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"create-an-overall-fracture-cohort","dir":"","previous_headings":"Creating and manipulating cohorts","what":"Create an overall fracture cohort","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"far created three separate fracture cohorts. Let’s say also want cohort people fractures. union three cohorts create overall cohort like :","code":"cdm$fractures <- unionCohorts(cdm$fractures, cohortName = \"any_fracture\", keepOriginalCohorts = TRUE, name =\"fractures\") settings(cdm$fractures) #> # A tibble: 4 × 5 #> cohort_definition_id cohort_name cdm_version vocabulary_version gap #> #> 1 1 ankle_fracture 5.3 v5.0 18-JAN-19 NA #> 2 2 forearm_fracture 5.3 v5.0 18-JAN-19 NA #> 3 3 hip_fracture 5.3 v5.0 18-JAN-19 NA #> 4 4 any_fracture 0 cohortCount(cdm$fractures) #> # A tibble: 4 × 3 #> cohort_definition_id number_records number_subjects #> #> 1 1 464 427 #> 2 2 569 510 #> 3 3 138 132 #> 4 4 1171 924"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"require-in-date-range","dir":"","previous_headings":"Creating and manipulating cohorts","what":"Require in date range","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"created base fracture cohort, can start applying additional cohort requirements. example, first can require individuals’ cohort start date fall within certain date range. Now ’ve applied date restriction, can see cohort attributes updated","code":"cdm$fractures <- cdm$fractures %>% requireInDateRange(dateRange = as.Date(c(\"2000-01-01\", \"2020-01-01\"))) cohort_count(cdm$fractures) %>% glimpse() #> Rows: 4 #> Columns: 3 #> $ cohort_definition_id 1, 2, 3, 4 #> $ number_records 108, 152, 62, 322 #> $ number_subjects 104, 143, 60, 287 attrition(cdm$fractures) %>% filter(reason == \"cohort_start_date between 2000-01-01 & 2020-01-01\") %>% glimpse() #> Rows: 0 #> Columns: 7 #> $ cohort_definition_id #> $ number_records #> $ number_subjects #> $ reason_id #> $ reason #> $ excluded_records #> $ excluded_subjects "},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"applying-demographic-requirements","dir":"","previous_headings":"Creating and manipulating cohorts","what":"Applying demographic requirements","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"can also add restrictions patient characteristics age (cohort start date default) sex. can see many individuals ’ve lost applying criteria.","code":"cdm$fractures <- cdm$fractures %>% requireDemographics(ageRange = list(c(40, 65)), sex = \"Female\") attrition(cdm$fractures) %>% filter(reason == \"Age requirement: 40 to 65\") %>% glimpse() #> Rows: 4 #> Columns: 7 #> $ cohort_definition_id 1, 2, 3, 4 #> $ number_records 43, 64, 22, 129 #> $ number_subjects 43, 62, 22, 122 #> $ reason_id 4, 4, 4, 4 #> $ reason \"Age requirement: 40 to 65\", \"Age requirement: 40… #> $ excluded_records 65, 88, 40, 193 #> $ excluded_subjects 61, 81, 38, 165 attrition(cdm$fractures) %>% filter(reason == \"Sex requirement: Female\") %>% glimpse() #> Rows: 4 #> Columns: 7 #> $ cohort_definition_id 1, 2, 3, 4 #> $ number_records 19, 37, 12, 68 #> $ number_subjects 19, 36, 12, 65 #> $ reason_id 5, 5, 5, 5 #> $ reason \"Sex requirement: Female\", \"Sex requirement: Fema… #> $ excluded_records 24, 27, 10, 61 #> $ excluded_subjects 24, 26, 10, 57"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"require-presence-in-another-cohort","dir":"","previous_headings":"Creating and manipulating cohorts","what":"Require presence in another cohort","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"can also require individuals () another cohort window. example require study participants GI bleed cohort time prior entry fractures cohort.","code":"cdm$gibleed <- cdm |> conceptCohort(conceptSet = list(\"gibleed\" = 192671L), name = \"gibleed\") cdm$fractures <- cdm$fractures %>% requireCohortIntersect(targetCohortTable = \"gibleed\", intersections = 0, window = c(-Inf, 0)) attrition(cdm$fractures) %>% filter(reason == \"Not in cohort gibleed between -Inf & 0 days relative to cohort_start_date\") %>% glimpse() #> Rows: 4 #> Columns: 7 #> $ cohort_definition_id 1, 2, 3, 4 #> $ number_records 14, 30, 10, 54 #> $ number_subjects 14, 30, 10, 52 #> $ reason_id 8, 8, 8, 8 #> $ reason \"Not in cohort gibleed between -Inf & 0 days rela… #> $ excluded_records 5, 7, 2, 14 #> $ excluded_subjects 5, 6, 2, 13 cdmDisconnect(cdm)"},{"path":"https://ohdsi.github.io/CohortConstructor/index.html","id":"more-information","dir":"","previous_headings":"Creating and manipulating cohorts","what":"More information","title":"Build and Manipulate Study Cohorts Using a Common Data Model","text":"CohortConstructor provides much functionality creating manipulating cohorts. See package website details.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/CohortConstructor-package.html","id":null,"dir":"Reference","previous_headings":"","what":"CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model — CohortConstructor-package","title":"CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model — CohortConstructor-package","text":"Create manipulate study cohorts data mapped Observational Medical Outcomes Partnership Common Data Model.","code":""},{"path":[]},{"path":"https://ohdsi.github.io/CohortConstructor/reference/CohortConstructor-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model — CohortConstructor-package","text":"Maintainer: Edward Burn edward.burn@ndorms.ox.ac.uk (ORCID) Authors: Marti Catala marti.catalasabate@ndorms.ox.ac.uk (ORCID) Nuria Mercade-Besora nuria.mercadebesora@ndorms.ox.ac.uk (ORCID) Marta Alcalde-Herraiz marta.alcaldeherraiz@ndorms.ox.ac.uk (ORCID) Mike Du mike.du@ndorms.ox.ac.uk (ORCID) Yuchen Guo yuchen.guo@ndorms.ox.ac.uk (ORCID) Xihang Chen xihang.chen@ndorms.ox.ac.uk (ORCID) Kim Lopez-Guell kim.lopez@spc.ox.ac.uk (ORCID) Elin Rowlands elin.rowlands@ndorms.ox.ac.uk (ORCID)","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/benchmarkData.html","id":null,"dir":"Reference","previous_headings":"","what":"Benchmarking results — benchmarkData","title":"Benchmarking results — benchmarkData","text":"Benchmarking results","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/benchmarkData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Benchmarking results — benchmarkData","text":"","code":"benchmarkData"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/benchmarkData.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Benchmarking results — benchmarkData","text":"list results benchmarking","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cdmDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of cdm. — cdmDoc","title":"Helper for consistent documentation of cdm. — cdmDoc","text":"Helper consistent documentation cdm.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cdmDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of cdm. — cdmDoc","text":"cdm cdm reference.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of cohort. — cohortDoc","title":"Helper for consistent documentation of cohort. — cohortDoc","text":"Helper consistent documentation cohort.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of cohort. — cohortDoc","text":"cohort cohort table cdm reference.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortIdModifyDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of cohortId. — cohortIdModifyDoc","title":"Helper for consistent documentation of cohortId. — cohortIdModifyDoc","text":"Helper consistent documentation cohortId.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortIdModifyDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of cohortId. — cohortIdModifyDoc","text":"cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortIdSubsetDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of cohortId. — cohortIdSubsetDoc","title":"Helper for consistent documentation of cohortId. — cohortIdSubsetDoc","text":"Helper consistent documentation cohortId.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/cohortIdSubsetDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of cohortId. — cohortIdSubsetDoc","text":"cohortId Vector identifying cohorts include (cohort_definition_id cohort_name). Cohorts included removed cohort set.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/collapseCohorts.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse cohort entries using a certain gap to concatenate records. — collapseCohorts","title":"Collapse cohort entries using a certain gap to concatenate records. — collapseCohorts","text":"collapseCohorts() concatenates cohort records, allowing number days one finishing next starting.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/collapseCohorts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse cohort entries using a certain gap to concatenate records. — collapseCohorts","text":"","code":"collapseCohorts(cohort, cohortId = NULL, gap = 0, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/collapseCohorts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse cohort entries using a certain gap to concatenate records. — collapseCohorts","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. gap Number days two subsequent cohort entries merged single cohort record. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/collapseCohorts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse cohort entries using a certain gap to concatenate records. — collapseCohorts","text":"cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/columnDateDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of dateColumns and returnReason. — columnDateDoc","title":"Helper for consistent documentation of dateColumns and returnReason. — columnDateDoc","text":"Helper consistent documentation dateColumns returnReason.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/columnDateDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of dateColumns and returnReason. — columnDateDoc","text":"dateColumns Character vector indicating date columns cohort table consider. returnReason TRUE return column indicating dateColumns used.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptCohort.html","id":null,"dir":"Reference","previous_headings":"","what":"Create cohorts based on a concept set — conceptCohort","title":"Create cohorts based on a concept set — conceptCohort","text":"conceptCohort() creates cohort table patient records clinical tables OMOP CDM. following tables currently supported creating concept cohorts: condition_occurrence device_exposure drug_exposure measurement observation procedure_occurrence visit_occurrence Cohort duration based record start end (e.g. condition_start_date condition_end_date records coming condition_occurrence tables). resulting table satisfies requirements OMOP CDM cohort table: Overlapping records collapsed single cohort entry. record starts outside observation period silently ignored. record ends outside observation period trimmed end preceding observation period end date.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptCohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create cohorts based on a concept set — conceptCohort","text":"","code":"conceptCohort( cdm, conceptSet, name, exit = \"event_end_date\", useSourceFields = FALSE )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptCohort.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create cohorts based on a concept set — conceptCohort","text":"cdm cdm reference. conceptSet conceptSet, can either codelist conceptSetExpression. name Name new cohort table created cdm object. exit cohort end date defined. Can either \"event_end_date\" \"event_start_date\". useSourceFields TRUE, source concept_id fields also used identifying relevant clinical records. FALSE, standard concept_id fields used.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptCohort.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create cohorts based on a concept set — conceptCohort","text":"cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptCohort.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create cohorts based on a concept set — conceptCohort","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(conditionOccurrence = TRUE) #> Note: method with signature ‘DBIConnection#Id’ chosen for function ‘dbExistsTable’, #> target signature ‘duckdb_connection#Id’. #> \"duckdb_connection#ANY\" would also be valid cohort <- conceptCohort(cdm = cdm, conceptSet = list(a = 1), name = \"cohort\") #> Warning: ! `codelist` contains numeric values, they are casted to integers. #> ✖ Domain NA (1 concept) excluded because it is not supported. #> ℹ No cohort entries found, returning empty cohort table. cohort |> attrition() #> # A tibble: 1 × 7 #> cohort_definition_id number_records number_subjects reason_id reason #> #> 1 1 0 0 1 Initial qualify… #> # ℹ 2 more variables: excluded_records , excluded_subjects # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptSetDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of conceptSet. — conceptSetDoc","title":"Helper for consistent documentation of conceptSet. — conceptSetDoc","text":"Helper consistent documentation conceptSet.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/conceptSetDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of conceptSet. — conceptSetDoc","text":"conceptSet conceptSet, can either codelist conceptSetExpression.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/demographicsCohort.html","id":null,"dir":"Reference","previous_headings":"","what":"Create cohorts based on patient demographics — demographicsCohort","title":"Create cohorts based on patient demographics — demographicsCohort","text":"demographicsCohort() creates cohort table based patient characteristics. individual satisfies criteria enter cohort. stop satisfying criteria cohort entry ends.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/demographicsCohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create cohorts based on patient demographics — demographicsCohort","text":"","code":"demographicsCohort( cdm, name, ageRange = NULL, sex = NULL, minPriorObservation = NULL )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/demographicsCohort.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create cohorts based on patient demographics — demographicsCohort","text":"cdm cdm reference. name Name new cohort table created cdm object. ageRange list vectors specifying minimum maximum age. sex Can \"\", \"Male\" \"Female\". minPriorObservation minimum number continuous prior observation days database.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/demographicsCohort.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create cohorts based on patient demographics — demographicsCohort","text":"cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/demographicsCohort.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create cohorts based on patient demographics — demographicsCohort","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cohort <- cdm |> demographicsCohort(name = \"cohort3\", ageRange = c(18,40), sex = \"Male\") #> ! cohort columns will be reordered to match the expected order: #> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date. #> ℹ Building new trimmed cohort #> Adding demographics information #> Creating initial cohort #> Trim sex #> Trim age #> ✔ Cohort trimmed attrition(cohort) #> # A tibble: 3 × 7 #> cohort_definition_id number_records number_subjects reason_id reason #> #> 1 1 10 10 1 Initial qualify… #> 2 1 2 2 2 Sex requirement… #> 3 1 2 2 3 Age requirement… #> # ℹ 2 more variables: excluded_records , excluded_subjects # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtFirstDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","title":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","text":"entryAtFirstDate() resets cohort start date based set specified column dates. first date occurs chosen.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtFirstDate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","text":"","code":"entryAtFirstDate( cohort, dateColumns, cohortId = NULL, returnReason = TRUE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtFirstDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","text":"cohort cohort table cdm reference. dateColumns Character vector indicating date columns cohort table consider. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. returnReason TRUE return column indicating dateColumns used. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtFirstDate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtFirstDate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Update cohort start date to be the first date from of a set of column dates — entryAtFirstDate","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(tables = list( \"cohort\" = dplyr::tibble( cohort_definition_id = 1, subject_id = c(1, 2, 3, 4), cohort_start_date = as.Date(c(\"2000-06-03\", \"2000-01-01\", \"2015-01-15\", \"2000-12-09\")), cohort_end_date = as.Date(c(\"2001-09-01\", \"2001-01-12\", \"2015-02-15\", \"2002-12-09\")), date_1 = as.Date(c(\"2001-08-01\", \"2001-01-01\", \"2015-01-15\", \"2002-12-09\")), date_2 = as.Date(c(\"2001-08-01\", NA, \"2015-02-14\", \"2002-12-09\")) ) )) #> Warning: ! 7 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `gender_concept_id` is numeric but expected integer #> • `year_of_birth` is numeric but expected integer #> • `month_of_birth` is numeric but expected integer #> • `race_concept_id` is numeric but expected integer #> • `ethnicity_concept_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 2 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> • `period_type_concept_id` is numeric but expected integer #> Warning: ! 9 column in cdm_source do not match expected column type: #> • `cdm_source_abbreviation` is logical but expected character #> • `cdm_holder` is logical but expected character #> • `source_description` is logical but expected character #> • `source_documentation_reference` is logical but expected character #> • `cdm_etl_reference` is logical but expected character #> • `source_release_date` is logical but expected date #> • `cdm_release_date` is logical but expected date #> • `cdm_version` is numeric but expected character #> • `vocabulary_version` is logical but expected character #> Warning: ! 3 column in concept do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 1 column in vocabulary do not match expected column type: #> • `vocabulary_concept_id` is numeric but expected integer #> Warning: ! 5 column in concept_relationship do not match expected column type: #> • `concept_id_1` is numeric but expected integer #> • `concept_id_2` is numeric but expected integer #> • `valid_start_date` is logical but expected date #> • `valid_end_date` is logical but expected date #> • `invalid_reason` is logical but expected character #> Warning: ! 2 column in concept_synonym do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `language_concept_id` is numeric but expected integer #> Warning: ! 4 column in concept_ancestor do not match expected column type: #> • `ancestor_concept_id` is numeric but expected integer #> • `descendant_concept_id` is numeric but expected integer #> • `min_levels_of_separation` is numeric but expected integer #> • `max_levels_of_separation` is numeric but expected integer #> Warning: ! 9 column in drug_strength do not match expected column type: #> • `drug_concept_id` is numeric but expected integer #> • `ingredient_concept_id` is numeric but expected integer #> • `amount_unit_concept_id` is numeric but expected integer #> • `numerator_unit_concept_id` is numeric but expected integer #> • `denominator_value` is logical but expected numeric #> • `denominator_unit_concept_id` is numeric but expected integer #> • `box_size` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> Warning: ! 2 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 1 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer cdm$cohort |> entryAtLastDate(dateColumns = c(\"date_1\", \"date_2\")) #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> # Source: table [4 x 5] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> #> 1 1 1 2001-08-01 2001-09-01 date_2; dat… #> 2 1 3 2015-02-14 2015-02-15 date_2 #> 3 1 4 2002-12-09 2002-12-09 date_2; dat… #> 4 1 2 2001-01-01 2001-01-12 date_1 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtLastDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Set cohort start date to the last of a set of column dates — entryAtLastDate","title":"Set cohort start date to the last of a set of column dates — entryAtLastDate","text":"entryAtLastDate() resets cohort end date based set specified column dates. last date chosen.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtLastDate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set cohort start date to the last of a set of column dates — entryAtLastDate","text":"","code":"entryAtLastDate( cohort, dateColumns, cohortId = NULL, returnReason = TRUE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtLastDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set cohort start date to the last of a set of column dates — entryAtLastDate","text":"cohort cohort table cdm reference. dateColumns Character vector indicating date columns cohort table consider. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. returnReason TRUE return column indicating dateColumns used. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtLastDate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set cohort start date to the last of a set of column dates — entryAtLastDate","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/entryAtLastDate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set cohort start date to the last of a set of column dates — entryAtLastDate","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(tables = list( \"cohort\" = dplyr::tibble( cohort_definition_id = 1, subject_id = c(1, 2, 3, 4), cohort_start_date = as.Date(c(\"2000-06-03\", \"2000-01-01\", \"2015-01-15\", \"2000-12-09\")), cohort_end_date = as.Date(c(\"2001-09-01\", \"2001-01-12\", \"2015-02-15\", \"2002-12-09\")), date_1 = as.Date(c(\"2001-08-01\", \"2001-01-01\", \"2015-01-15\", \"2002-12-09\")), date_2 = as.Date(c(\"2001-08-01\", NA, \"2015-02-14\", \"2002-12-09\")) ) )) #> Warning: ! 7 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `gender_concept_id` is numeric but expected integer #> • `year_of_birth` is numeric but expected integer #> • `month_of_birth` is numeric but expected integer #> • `race_concept_id` is numeric but expected integer #> • `ethnicity_concept_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 2 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> • `period_type_concept_id` is numeric but expected integer #> Warning: ! 9 column in cdm_source do not match expected column type: #> • `cdm_source_abbreviation` is logical but expected character #> • `cdm_holder` is logical but expected character #> • `source_description` is logical but expected character #> • `source_documentation_reference` is logical but expected character #> • `cdm_etl_reference` is logical but expected character #> • `source_release_date` is logical but expected date #> • `cdm_release_date` is logical but expected date #> • `cdm_version` is numeric but expected character #> • `vocabulary_version` is logical but expected character #> Warning: ! 3 column in concept do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 1 column in vocabulary do not match expected column type: #> • `vocabulary_concept_id` is numeric but expected integer #> Warning: ! 5 column in concept_relationship do not match expected column type: #> • `concept_id_1` is numeric but expected integer #> • `concept_id_2` is numeric but expected integer #> • `valid_start_date` is logical but expected date #> • `valid_end_date` is logical but expected date #> • `invalid_reason` is logical but expected character #> Warning: ! 2 column in concept_synonym do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `language_concept_id` is numeric but expected integer #> Warning: ! 4 column in concept_ancestor do not match expected column type: #> • `ancestor_concept_id` is numeric but expected integer #> • `descendant_concept_id` is numeric but expected integer #> • `min_levels_of_separation` is numeric but expected integer #> • `max_levels_of_separation` is numeric but expected integer #> Warning: ! 9 column in drug_strength do not match expected column type: #> • `drug_concept_id` is numeric but expected integer #> • `ingredient_concept_id` is numeric but expected integer #> • `amount_unit_concept_id` is numeric but expected integer #> • `numerator_unit_concept_id` is numeric but expected integer #> • `denominator_value` is logical but expected numeric #> • `denominator_unit_concept_id` is numeric but expected integer #> • `box_size` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> Warning: ! 2 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 1 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer cdm$cohort |> entryAtLastDate(dateColumns = c(\"date_1\", \"date_2\")) #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> # Source: table [4 x 5] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> #> 1 1 1 2001-08-01 2001-09-01 date_2; dat… #> 2 1 4 2002-12-09 2002-12-09 date_2; dat… #> 3 1 2 2001-01-01 2001-01-12 date_1 #> 4 1 3 2015-02-14 2015-02-15 date_2 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtDeath.html","id":null,"dir":"Reference","previous_headings":"","what":"Set cohort end date to death date — exitAtDeath","title":"Set cohort end date to death date — exitAtDeath","text":"functions changes cohort end date subject's death date. case generates overlapping records cohort, overlapping entries merged.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtDeath.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set cohort end date to death date — exitAtDeath","text":"","code":"exitAtDeath( cohort, cohortId = NULL, requireDeath = FALSE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtDeath.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set cohort end date to death date — exitAtDeath","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. requireDeath TRUE, subjects without death record dropped, FALSE end date left . name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtDeath.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set cohort end date to death date — exitAtDeath","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtDeath.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set cohort end date to death date — exitAtDeath","text":"","code":"# \\donttest{ library(PatientProfiles) library(CohortConstructor) cdm <- mockPatientProfiles() cdm$cohort1 |> exitAtDeath() #> # Source: table [10 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 2 5 1966-05-05 1970-11-15 #> 2 2 3 1939-07-24 1944-01-14 #> 3 1 10 1948-08-08 1952-03-27 #> 4 2 4 1949-03-07 1951-05-08 #> 5 3 6 1966-09-27 1975-03-05 #> 6 3 2 1918-06-14 1921-11-28 #> 7 3 8 1921-10-07 1931-05-01 #> 8 1 9 1940-05-01 1945-06-29 #> 9 3 7 1962-05-14 1964-03-08 #> 10 1 1 1943-11-26 1949-06-21 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtFirstDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","title":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","text":"exitAtFirstDate() resets cohort end date based set specified column dates. first date occurs chosen.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtFirstDate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","text":"","code":"exitAtFirstDate( cohort, dateColumns, cohortId = NULL, returnReason = TRUE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtFirstDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","text":"cohort cohort table cdm reference. dateColumns Character vector indicating date columns cohort table consider. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. returnReason TRUE return column indicating dateColumns used. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtFirstDate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtFirstDate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set cohort end date to the first of a set of column dates — exitAtFirstDate","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(tables = list( \"cohort\" = dplyr::tibble( cohort_definition_id = 1, subject_id = c(1, 2, 3, 4), cohort_start_date = as.Date(c(\"2000-06-03\", \"2000-01-01\", \"2015-01-15\", \"2000-12-09\")), cohort_end_date = as.Date(c(\"2001-09-01\", \"2001-01-12\", \"2015-02-15\", \"2002-12-09\")), date_1 = as.Date(c(\"2001-08-01\", \"2001-01-01\", \"2015-01-15\", \"2002-12-09\")), date_2 = as.Date(c(\"2001-08-01\", NA, \"2015-04-15\", \"2002-12-09\")) ) )) #> Warning: ! 7 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `gender_concept_id` is numeric but expected integer #> • `year_of_birth` is numeric but expected integer #> • `month_of_birth` is numeric but expected integer #> • `race_concept_id` is numeric but expected integer #> • `ethnicity_concept_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 2 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> • `period_type_concept_id` is numeric but expected integer #> Warning: ! 9 column in cdm_source do not match expected column type: #> • `cdm_source_abbreviation` is logical but expected character #> • `cdm_holder` is logical but expected character #> • `source_description` is logical but expected character #> • `source_documentation_reference` is logical but expected character #> • `cdm_etl_reference` is logical but expected character #> • `source_release_date` is logical but expected date #> • `cdm_release_date` is logical but expected date #> • `cdm_version` is numeric but expected character #> • `vocabulary_version` is logical but expected character #> Warning: ! 3 column in concept do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 1 column in vocabulary do not match expected column type: #> • `vocabulary_concept_id` is numeric but expected integer #> Warning: ! 5 column in concept_relationship do not match expected column type: #> • `concept_id_1` is numeric but expected integer #> • `concept_id_2` is numeric but expected integer #> • `valid_start_date` is logical but expected date #> • `valid_end_date` is logical but expected date #> • `invalid_reason` is logical but expected character #> Warning: ! 2 column in concept_synonym do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `language_concept_id` is numeric but expected integer #> Warning: ! 4 column in concept_ancestor do not match expected column type: #> • `ancestor_concept_id` is numeric but expected integer #> • `descendant_concept_id` is numeric but expected integer #> • `min_levels_of_separation` is numeric but expected integer #> • `max_levels_of_separation` is numeric but expected integer #> Warning: ! 9 column in drug_strength do not match expected column type: #> • `drug_concept_id` is numeric but expected integer #> • `ingredient_concept_id` is numeric but expected integer #> • `amount_unit_concept_id` is numeric but expected integer #> • `numerator_unit_concept_id` is numeric but expected integer #> • `denominator_value` is logical but expected numeric #> • `denominator_unit_concept_id` is numeric but expected integer #> • `box_size` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> Warning: ! 2 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 1 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer cdm$cohort |> exitAtFirstDate(dateColumns = c(\"date_1\", \"date_2\")) #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> # Source: table [4 x 5] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date exit_reason #> #> 1 1 3 2015-01-15 2015-01-15 date_1 #> 2 1 4 2000-12-09 2002-12-09 date_2; dat… #> 3 1 2 2000-01-01 2001-01-01 date_1 #> 4 1 1 2000-06-03 2001-08-01 date_2; dat… # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtLastDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Set cohort end date to the last of a set of column dates — exitAtLastDate","title":"Set cohort end date to the last of a set of column dates — exitAtLastDate","text":"exitAtLastDate() resets cohort end date based set specified column dates. last date occurs chosen.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtLastDate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set cohort end date to the last of a set of column dates — exitAtLastDate","text":"","code":"exitAtLastDate( cohort, dateColumns, cohortId = NULL, returnReason = TRUE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtLastDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set cohort end date to the last of a set of column dates — exitAtLastDate","text":"cohort cohort table cdm reference. dateColumns Character vector indicating date columns cohort table consider. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. returnReason TRUE return column indicating dateColumns used. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtLastDate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set cohort end date to the last of a set of column dates — exitAtLastDate","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtLastDate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set cohort end date to the last of a set of column dates — exitAtLastDate","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(tables = list( \"cohort\" = dplyr::tibble( cohort_definition_id = 1, subject_id = c(1, 2, 3, 4), cohort_start_date = as.Date(c(\"2000-06-03\", \"2000-01-01\", \"2015-01-15\", \"2000-12-09\")), cohort_end_date = as.Date(c(\"2001-09-01\", \"2001-01-12\", \"2015-02-15\", \"2002-12-09\")), date_1 = as.Date(c(\"2001-08-01\", \"2001-01-01\", \"2015-01-15\", \"2002-12-09\")), date_2 = as.Date(c(\"2001-08-01\", NA, \"2015-04-15\", \"2002-12-09\")) ) )) #> Warning: ! 7 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `gender_concept_id` is numeric but expected integer #> • `year_of_birth` is numeric but expected integer #> • `month_of_birth` is numeric but expected integer #> • `race_concept_id` is numeric but expected integer #> • `ethnicity_concept_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 2 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> • `period_type_concept_id` is numeric but expected integer #> Warning: ! 9 column in cdm_source do not match expected column type: #> • `cdm_source_abbreviation` is logical but expected character #> • `cdm_holder` is logical but expected character #> • `source_description` is logical but expected character #> • `source_documentation_reference` is logical but expected character #> • `cdm_etl_reference` is logical but expected character #> • `source_release_date` is logical but expected date #> • `cdm_release_date` is logical but expected date #> • `cdm_version` is numeric but expected character #> • `vocabulary_version` is logical but expected character #> Warning: ! 3 column in concept do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 1 column in vocabulary do not match expected column type: #> • `vocabulary_concept_id` is numeric but expected integer #> Warning: ! 5 column in concept_relationship do not match expected column type: #> • `concept_id_1` is numeric but expected integer #> • `concept_id_2` is numeric but expected integer #> • `valid_start_date` is logical but expected date #> • `valid_end_date` is logical but expected date #> • `invalid_reason` is logical but expected character #> Warning: ! 2 column in concept_synonym do not match expected column type: #> • `concept_id` is numeric but expected integer #> • `language_concept_id` is numeric but expected integer #> Warning: ! 4 column in concept_ancestor do not match expected column type: #> • `ancestor_concept_id` is numeric but expected integer #> • `descendant_concept_id` is numeric but expected integer #> • `min_levels_of_separation` is numeric but expected integer #> • `max_levels_of_separation` is numeric but expected integer #> Warning: ! 9 column in drug_strength do not match expected column type: #> • `drug_concept_id` is numeric but expected integer #> • `ingredient_concept_id` is numeric but expected integer #> • `amount_unit_concept_id` is numeric but expected integer #> • `numerator_unit_concept_id` is numeric but expected integer #> • `denominator_value` is logical but expected numeric #> • `denominator_unit_concept_id` is numeric but expected integer #> • `box_size` is numeric but expected integer #> • `valid_start_date` is character but expected date #> • `valid_end_date` is character but expected date #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> Warning: ! 2 column in person do not match expected column type: #> • `person_id` is numeric but expected integer #> • `location_id` is numeric but expected integer #> Warning: ! 1 column in observation_period do not match expected column type: #> • `person_id` is numeric but expected integer #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer cdm$cohort |> exitAtLastDate(dateColumns = c(\"date_1\", \"date_2\")) #> Warning: ! 2 column in cohort do not match expected column type: #> • `cohort_definition_id` is numeric but expected integer #> • `subject_id` is numeric but expected integer #> # Source: table [4 x 5] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date exit_reason #> #> 1 1 4 2000-12-09 2002-12-09 date_1; dat… #> 2 1 3 2015-01-15 2015-04-15 date_2 #> 3 1 1 2000-06-03 2001-08-01 date_1; dat… #> 4 1 2 2000-01-01 2001-01-01 date_1 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtObservationEnd.html","id":null,"dir":"Reference","previous_headings":"","what":"Set cohort end date to end of observation — exitAtObservationEnd","title":"Set cohort end date to end of observation — exitAtObservationEnd","text":"exitAtObservationEnd() resets cohort end date based set specified column dates. last date occurs chosen. functions changes cohort end date end date observation period corresponding cohort entry. case generates overlapping records cohort, overlapping entries merged.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtObservationEnd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set cohort end date to end of observation — exitAtObservationEnd","text":"","code":"exitAtObservationEnd(cohort, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtObservationEnd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set cohort end date to end of observation — exitAtObservationEnd","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtObservationEnd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set cohort end date to end of observation — exitAtObservationEnd","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/exitAtObservationEnd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set cohort end date to end of observation — exitAtObservationEnd","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> exitAtObservationEnd() #> # Source: table [6 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 6 2003-10-31 2005-11-04 #> 2 1 5 2007-10-19 2014-09-25 #> 3 1 3 1976-11-28 2000-04-25 #> 4 1 2 1964-09-18 1968-04-03 #> 5 1 4 1998-06-22 2013-05-12 #> 6 1 9 2012-01-18 2012-06-30 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/gapDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of gap. — gapDoc","title":"Helper for consistent documentation of gap. — gapDoc","text":"Helper consistent documentation gap.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/gapDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of gap. — gapDoc","text":"gap Number days two subsequent cohort entries merged single cohort record.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/intersectCohorts.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","title":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","text":"intersectCohorts() combines different cohort entries, records overlap combined kept. Cohort entries individual cohorts.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/intersectCohorts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","text":"","code":"intersectCohorts( cohort, cohortId = NULL, gap = 0, returnNonOverlappingCohorts = FALSE, keepOriginalCohorts = FALSE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/intersectCohorts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts include (cohort_definition_id cohort_name). Cohorts included removed cohort set. gap Number days two subsequent cohort entries merged single cohort record. returnNonOverlappingCohorts Whether generated cohorts mutually exclusive . keepOriginalCohorts TRUE original cohorts newly created intersection cohort returned. FALSE new cohort returned. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/intersectCohorts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/intersectCohorts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate a combination cohort set between the intersection of different cohorts. — intersectCohorts","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(nPerson = 100) cdm$cohort3 <- intersectCohorts( cohort = cdm$cohort2, name = \"cohort3\", ) settings(cdm$cohort3) #> # A tibble: 1 × 5 #> cohort_definition_id cohort_name gap cohort_1 cohort_2 #> #> 1 1 cohort_1_cohort_2 0 1 1 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/matchCohorts.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a new cohort matched cohort — matchCohorts","title":"Generate a new cohort matched cohort — matchCohorts","text":"matchCohorts() generate new cohort matched individuals existing cohort. Individuals can matched based year birth sex.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/matchCohorts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a new cohort matched cohort — matchCohorts","text":"","code":"matchCohorts( cohort, cohortId = NULL, matchSex = TRUE, matchYearOfBirth = TRUE, ratio = 1, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/matchCohorts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a new cohort matched cohort — matchCohorts","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts include (cohort_definition_id cohort_name). Cohorts included removed cohort set. matchSex Whether match sex. matchYearOfBirth Whether match year birth. ratio Number allowed matches per individual target cohort. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/matchCohorts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a new cohort matched cohort — matchCohorts","text":"cohort table.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/matchCohorts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate a new cohort matched cohort — matchCohorts","text":"","code":"# \\donttest{ library(CohortConstructor) library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union cdm <- mockCohortConstructor(nPerson = 200) cdm$new_matched_cohort <- cdm$cohort2 |> matchCohorts( name = \"new_matched_cohort\", cohortId = 2, matchSex = TRUE, matchYearOfBirth = TRUE, ratio = 1) #> Starting matching #> Warning: Multiple records per person detected. The matchCohorts() function is designed #> to operate under the assumption that there is only one record per person within #> each cohort. If this assumption is not met, each record will be treated #> independently. As a result, the same individual may be matched multiple times, #> leading to inconsistent and potentially misleading results. #> ℹ Creating copy of target cohort. #> • 1 cohort to be matched. #> ℹ Creating controls cohorts. #> ℹ Excluding cases from controls #> • Matching by gender_concept_id and year_of_birth #> • Removing controls that were not in observation at index date #> • Excluding target records whose pair is not in observation #> • Adjusting ratio #> Binding both cohorts #> ✔ Done cdm$new_matched_cohort #> # Source: table [?? x 5] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date cluster_id #> #> 1 1 110 2005-06-30 2005-09-30 99 #> 2 1 19 2015-04-24 2015-09-01 108 #> 3 1 33 1993-05-10 1997-04-01 14 #> 4 1 39 2002-07-11 2004-08-07 44 #> 5 1 16 2007-05-18 2007-10-08 101 #> 6 1 80 2000-12-22 2002-04-17 18 #> 7 1 91 1995-05-16 2002-02-02 42 #> 8 1 30 2008-04-20 2010-01-04 27 #> 9 1 123 1983-11-30 1995-08-19 21 #> 10 1 148 2006-09-04 2011-12-31 37 #> # ℹ more rows # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/measurementCohort.html","id":null,"dir":"Reference","previous_headings":"","what":"Create cohorts measurement based cohorts — measurementCohort","title":"Create cohorts measurement based cohorts — measurementCohort","text":"measurementCohort() creates cohorts based patient records contained measurement table. function extends conceptCohort() allows measurement values associated records specified. valueAsConcept valueAsNumber NULL requirements values associated measurement records using measurementCohort() lead result using conceptCohort() (long concepts measurement domain). one valueAsConcept valueAsNumber NULL records required values satisfy requirement specified. valueAsConcept valueAsNumber NULL, records required values fulfill either requirements","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/measurementCohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create cohorts measurement based cohorts — measurementCohort","text":"","code":"measurementCohort( cdm, conceptSet, name, valueAsConcept = NULL, valueAsNumber = NULL )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/measurementCohort.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create cohorts measurement based cohorts — measurementCohort","text":"cdm cdm reference. conceptSet conceptSet, can either codelist conceptSetExpression. name Name new cohort table created cdm object. valueAsConcept vector cohort IDs used filter measurements. measurements values value_as_concept_id column measurement table included. NULL entries independently value concept considered. valueAsNumber named list indicating range values unit correspond , follows: list(\"unit_concept_id\" = c(rangeValue1, rangeValue2)). NULL, entries independently value number included.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/measurementCohort.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create cohorts measurement based cohorts — measurementCohort","text":"cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/measurementCohort.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create cohorts measurement based cohorts — measurementCohort","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(con = NULL) cdm$concept <- cdm$concept |> dplyr::union_all( dplyr::tibble( concept_id = c(4326744, 4298393, 45770407, 8876, 4124457), concept_name = c(\"Blood pressure\", \"Systemic blood pressure\", \"Baseline blood pressure\", \"millimeter mercury column\", \"Normal range\"), domain_id = \"Measurement\", vocabulary_id = c(\"SNOMED\", \"SNOMED\", \"SNOMED\", \"UCUM\", \"SNOMED\"), standard_concept = \"S\", concept_class_id = c(\"Observable Entity\", \"Observable Entity\", \"Observable Entity\", \"Unit\", \"Qualifier Value\"), concept_code = NA, valid_start_date = NA, valid_end_date = NA, invalid_reason = NA ) ) cdm$measurement <- dplyr::tibble( measurement_id = 1:4, person_id = c(1, 1, 2, 3), measurement_concept_id = c(4326744, 4298393, 4298393, 45770407), measurement_date = as.Date(c(\"2000-07-01\", \"2000-12-11\", \"2002-09-08\", \"2015-02-19\")), measurement_type_concept_id = NA, value_as_number = c(100, 125, NA, NA), value_as_concept_id = c(0, 0, 0, 4124457), unit_concept_id = c(8876, 8876, 0, 0) ) cdm <- CDMConnector::copyCdmTo( con = DBI::dbConnect(duckdb::duckdb()), cdm = cdm, schema = \"main\") cdm$cohort <- measurementCohort( cdm = cdm, name = \"cohort\", conceptSet = list(\"normal_blood_pressure\" = c(4326744, 4298393, 45770407)), valueAsConcept = c(4124457), valueAsNumber = list(\"8876\" = c(70, 120)) ) #> Warning: ! `codelist` contains numeric values, they are casted to integers. #> ℹ Getting records in observation. #> ℹ Applying measurement requirements. #> Warning: There are no subjects with the specified value_as_concept_id or #> value_as_number. #> ℹ Creating cohort attributes. #> Warning: ! 1 column in cohort do not match expected column type: #> • `subject_id` is numeric but expected integer #> ✔ Cohort cohort created. cdm$cohort #> # Source: table [0 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> # ℹ 4 variables: cohort_definition_id , subject_id , #> # cohort_start_date , cohort_end_date # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/mockCohortConstructor.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","title":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","text":"mockCohortConstructor() creates example dataset can used demonstrating testing package","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/mockCohortConstructor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","text":"","code":"mockCohortConstructor( nPerson = 10, conceptTable = NULL, tables = NULL, conceptId = NULL, conceptIdClass = NULL, drugExposure = FALSE, conditionOccurrence = FALSE, measurement = FALSE, death = FALSE, otherTables = NULL, con = DBI::dbConnect(duckdb::duckdb()), writeSchema = \"main\", seed = 123 )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/mockCohortConstructor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","text":"nPerson number person cdm conceptTable user defined concept table tables list tables include cdm conceptId list concept id conceptIdClass domain class conceptId drugExposure T/F include drug exposure table cdm conditionOccurrence T/F include condition occurrence cdm measurement T/F include measurement cdm death T/F include death table cdm otherTables takes list single tibble names include tables cdm con DBI connection create cdm mock object. writeSchema Name schema connection writing permissions. seed Seed passed omock::mockCdmFromTable","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/mockCohortConstructor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","text":"cdm object","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/mockCohortConstructor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Function to create a mock cdm reference for CohortConstructor — mockCohortConstructor","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm #> #> ── # OMOP CDM reference (duckdb) of mock database ────────────────────────────── #> • omop tables: person, observation_period, cdm_source, concept, vocabulary, #> concept_relationship, concept_synonym, concept_ancestor, drug_strength #> • cohort tables: cohort1, cohort2 #> • achilles tables: - #> • other tables: - # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/nameDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of name. — nameDoc","title":"Helper for consistent documentation of name. — nameDoc","text":"Helper consistent documentation name.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/nameDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of name. — nameDoc","text":"name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/padCohortStart.html","id":null,"dir":"Reference","previous_headings":"","what":"Add days to cohort start — padCohortStart","title":"Add days to cohort start — padCohortStart","text":"padCohortStart() Adds (subtracts) certain number days cohort start date. Note: days added means cohort start cohort end cohort entry dropped. subtracting day means cohort start observation period start cohort entry dropped.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/padCohortStart.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add days to cohort start — padCohortStart","text":"","code":"padCohortStart(cohort, days, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/padCohortStart.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add days to cohort start — padCohortStart","text":"cohort cohort table cdm reference. days Number day add cohort start date. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/padCohortStart.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add days to cohort start — padCohortStart","text":"Cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/padCohortStart.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add days to cohort start — padCohortStart","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() # add 10 days to each cohort entry cdm$cohort1 |> padCohortStart(days = 10) #> # Source: table [10 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 2 1964-09-28 1965-08-30 #> 2 1 3 1976-12-08 1977-03-11 #> 3 1 3 1977-03-22 1978-04-03 #> 4 1 3 1978-04-14 1987-02-26 #> 5 1 4 1998-07-02 2001-02-12 #> 6 1 5 2007-10-29 2008-11-10 #> 7 1 5 2008-11-21 2011-09-12 #> 8 1 6 2003-11-10 2003-11-14 #> 9 1 6 2003-11-25 2004-04-10 #> 10 1 9 2012-01-28 2012-03-08 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. omopgenerics attrition, bind, cohortCodelist, cohortCount, settings, tableName PatientProfiles endDateColumn, startDateColumn","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireAge.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort on age — requireAge","title":"Restrict cohort on age — requireAge","text":"requireAge() filters cohort records, keeping records individuals satisfy specified age criteria.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireAge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort on age — requireAge","text":"","code":"requireAge( cohort, ageRange, cohortId = NULL, indexDate = \"cohort_start_date\", name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireAge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort on age — requireAge","text":"cohort cohort table cdm reference. ageRange list vectors specifying minimum maximum age. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Variable cohort contains date compute demographics characteristics restrict . name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireAge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort on age — requireAge","text":"cohort table records individuals satisfying age requirement","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireAge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort on age — requireAge","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> requireAge(indexDate = \"cohort_start_date\", ageRange = list(c(18, 65))) #> # Source: table [6 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 3 1978-04-04 1987-02-26 #> 2 1 5 2007-10-19 2008-11-10 #> 3 1 5 2008-11-11 2011-09-12 #> 4 1 6 2003-10-31 2003-11-14 #> 5 1 6 2003-11-15 2004-04-10 #> 6 1 9 2012-01-18 2012-03-08 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireCohortIntersect.html","id":null,"dir":"Reference","previous_headings":"","what":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","title":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","text":"requireCohortIntersect() filters cohort table based requirement individual seen (seen) another cohort time window around index date.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireCohortIntersect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","text":"","code":"requireCohortIntersect( cohort, targetCohortTable, window, intersections = c(1, Inf), cohortId = NULL, targetCohortId = NULL, indexDate = \"cohort_start_date\", targetStartDate = \"cohort_start_date\", targetEndDate = \"cohort_end_date\", censorDate = NULL, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireCohortIntersect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","text":"cohort cohort table cdm reference. targetCohortTable Name cohort want check intersect. window list vectors specifying minimum maximum days indexDate consider events . intersections range indicating number intersections criteria fulfilled. single number passed, number intersections must match . cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. targetCohortId Vector cohort definition ids include. indexDate Name column cohort contains date compute intersection. targetStartDate Start date reference cohort table. targetEndDate End date reference cohort table. NULL, incidence target event window considered intersection, otherwise prevalence event used intersection (overlap cohort event). censorDate Whether censor overlap events specific date column date cohort. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireCohortIntersect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","text":"Cohort table isatisfying criteria kept","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireCohortIntersect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Require cohort subjects are present (or absence) in another cohort — requireCohortIntersect","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> requireCohortIntersect(targetCohortTable = \"cohort2\", targetCohortId = 1, indexDate = \"cohort_start_date\", window = c(-Inf, 0)) #> # Source: table [10 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 2 1964-09-18 1965-08-30 #> 2 1 3 1976-11-28 1977-03-11 #> 3 1 3 1977-03-12 1978-04-03 #> 4 1 3 1978-04-04 1987-02-26 #> 5 1 4 1998-06-22 2001-02-12 #> 6 1 5 2007-10-19 2008-11-10 #> 7 1 5 2008-11-11 2011-09-12 #> 8 1 6 2003-10-31 2003-11-14 #> 9 1 6 2003-11-15 2004-04-10 #> 10 1 9 2012-01-18 2012-03-08 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireConceptIntersect.html","id":null,"dir":"Reference","previous_headings":"","what":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","title":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","text":"requireConceptIntersect() filters cohort table based requirement individual seen (seen) events related concept list time window around index date.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireConceptIntersect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","text":"","code":"requireConceptIntersect( cohort, conceptSet, window, intersections = c(1, Inf), cohortId = NULL, indexDate = \"cohort_start_date\", targetStartDate = \"event_start_date\", targetEndDate = \"event_end_date\", censorDate = NULL, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireConceptIntersect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","text":"cohort cohort table cdm reference. conceptSet conceptSet, can either codelist conceptSetExpression. window list vectors specifying minimum maximum days indexDate consider events . intersections range indicating number intersections criteria fulfilled. single number passed, number intersections must match . cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Name column cohort contains date compute intersection. targetStartDate Start date reference cohort table. targetEndDate End date reference cohort table. NULL, incidence target event window considered intersection, otherwise prevalence event used intersection (overlap cohort event). censorDate Whether censor overlap events specific date column date cohort. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireConceptIntersect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","text":"Cohort table events concept list kept (without event negate = TRUE)","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireConceptIntersect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Require cohort subjects to have (or not have) events of a concept list — requireConceptIntersect","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(conditionOccurrence = TRUE) cdm$cohort2 <- requireConceptIntersect( cohort = cdm$cohort1, conceptSet = list(a = 194152), window = c(-Inf, 0), name = \"cohort2\") #> Warning: ! `codelist` contains numeric values, they are casted to integers. # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDeathFlag.html","id":null,"dir":"Reference","previous_headings":"","what":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","title":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","text":"requireDeathFlag() filters cohort table based requirement individual seen (seen) death time window around index date.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDeathFlag.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","text":"","code":"requireDeathFlag( cohort, window, cohortId = NULL, indexDate = \"cohort_start_date\", censorDate = NULL, negate = FALSE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDeathFlag.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","text":"cohort cohort table cdm reference. window list vectors specifying minimum maximum days indexDate consider events . cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Name column cohort contains date use time 0 window days. censorDate Whether censor overlap events specific date column date cohort. negate set TRUE, criteria applied exclusion rather inclusion (.e. require absence another cohort). name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDeathFlag.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","text":"Cohort table death event kept (without negate = TRUE)","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDeathFlag.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Require cohort subjects have (or do not have) a death record — requireDeathFlag","text":"","code":"# \\donttest{ library(CDMConnector) #> #> Attaching package: ‘CDMConnector’ #> The following objects are masked from ‘package:CohortConstructor’: #> #> intersectCohorts, unionCohorts library(CohortConstructor) cdm <- mockCohortConstructor(death = TRUE) cdm$cohort1 <- cdm$cohort1 |> requireDeathFlag(window = list(c(0, Inf))) attrition(cdm$cohort1) #> # A tibble: 2 × 7 #> cohort_definition_id number_records number_subjects reason_id reason #> #> 1 1 10 6 1 Initial qualify… #> 2 1 10 6 2 Death between 0… #> # ℹ 2 more variables: excluded_records , excluded_subjects # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographics.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort on patient demographics — requireDemographics","title":"Restrict cohort on patient demographics — requireDemographics","text":"requireDemographics() filters cohort records, keeping records individuals satisfy specified demographic criteria.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort on patient demographics — requireDemographics","text":"","code":"requireDemographics( cohort, cohortId = NULL, indexDate = \"cohort_start_date\", ageRange = list(c(0, 150)), sex = c(\"Both\"), minPriorObservation = 0, minFutureObservation = 0, requirementInteractions = TRUE, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort on patient demographics — requireDemographics","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Variable cohort contains date compute demographics characteristics restrict . ageRange list vectors specifying minimum maximum age. sex Can \"\", \"Male\" \"Female\". minPriorObservation minimum number continuous prior observation days database. minFutureObservation minimum number continuous future observation days database. requirementInteractions TRUE, cohorts created combinations ageGroup, sex, daysPriorObservation. FALSE, first value specified factors used. Consequently, order values matters requirementInteractions FALSE. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort on patient demographics — requireDemographics","text":"cohort table records individuals satisfying demographic requirements","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort on patient demographics — requireDemographics","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(nPerson = 100) cdm$cohort1 |> requireDemographics(indexDate = \"cohort_start_date\", ageRange = list(c(18, 65)), sex = \"Female\", minPriorObservation = 365) #> # Source: table [?? x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 13 1991-04-14 1992-10-21 #> 2 1 13 1992-11-03 2000-11-27 #> 3 1 16 2005-12-28 2008-06-11 #> 4 1 17 2009-06-18 2013-02-01 #> 5 1 27 1992-04-16 1993-09-30 #> 6 1 27 1993-10-01 2003-08-01 #> 7 1 41 2000-07-02 2000-11-21 #> 8 1 41 2000-11-22 2010-05-13 #> 9 1 53 1997-03-26 1998-02-22 #> 10 1 53 1998-02-23 2001-04-23 #> # ℹ more rows # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographicsDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of arguments in requireDemographics. — requireDemographicsDoc","title":"Helper for consistent documentation of arguments in requireDemographics. — requireDemographicsDoc","text":"Helper consistent documentation arguments requireDemographics.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireDemographicsDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of arguments in requireDemographics. — requireDemographicsDoc","text":"ageRange list vectors specifying minimum maximum age. sex Can \"\", \"Male\" \"Female\". minPriorObservation minimum number continuous prior observation days database. minFutureObservation minimum number continuous future observation days database. indexDate Variable cohort contains date compute demographics characteristics restrict . requirementInteractions TRUE, cohorts created combinations ageGroup, sex, daysPriorObservation. FALSE, first value specified factors used. Consequently, order values matters requirementInteractions FALSE.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireFutureObservation.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort on future observation — requireFutureObservation","title":"Restrict cohort on future observation — requireFutureObservation","text":"requireFutureObservation() filters cohort records, keeping records individuals satisfy specified future observation criteria.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireFutureObservation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort on future observation — requireFutureObservation","text":"","code":"requireFutureObservation( cohort, minFutureObservation, cohortId = NULL, indexDate = \"cohort_start_date\", name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireFutureObservation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort on future observation — requireFutureObservation","text":"cohort cohort table cdm reference. minFutureObservation minimum number continuous future observation days database. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Variable cohort contains date compute demographics characteristics restrict . name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireFutureObservation.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort on future observation — requireFutureObservation","text":"cohort table records individuals satisfying future observation requirement","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireFutureObservation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort on future observation — requireFutureObservation","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> requireFutureObservation(indexDate = \"cohort_start_date\", minFutureObservation = 30) #> # Source: table [10 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 2 1964-09-18 1965-08-30 #> 2 1 3 1978-04-04 1987-02-26 #> 3 1 4 1998-06-22 2001-02-12 #> 4 1 5 2007-10-19 2008-11-10 #> 5 1 6 2003-11-15 2004-04-10 #> 6 1 9 2012-01-18 2012-03-08 #> 7 1 3 1977-03-12 1978-04-03 #> 8 1 5 2008-11-11 2011-09-12 #> 9 1 6 2003-10-31 2003-11-14 #> 10 1 3 1976-11-28 1977-03-11 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireInDateRange.html","id":null,"dir":"Reference","previous_headings":"","what":"Require that an index date is within a date range — requireInDateRange","title":"Require that an index date is within a date range — requireInDateRange","text":"requireInDateRange() filters cohort records, keeping index date within specified date range.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireInDateRange.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Require that an index date is within a date range — requireInDateRange","text":"","code":"requireInDateRange( cohort, dateRange, cohortId = NULL, indexDate = \"cohort_start_date\", name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireInDateRange.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Require that an index date is within a date range — requireInDateRange","text":"cohort cohort table cdm reference. dateRange date vector minimum maximum dates index date must observed. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Name column cohort contains date interest. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireInDateRange.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Require that an index date is within a date range — requireInDateRange","text":"cohort table cohort entries outside date range dropped","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireInDateRange.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Require that an index date is within a date range — requireInDateRange","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(nPerson = 100) cdm$cohort1 |> requireInDateRange(indexDate = \"cohort_start_date\", dateRange = as.Date(c(\"2010-01-01\", \"2019-01-01\"))) #> # Source: table [?? x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 9 2011-12-20 2011-12-20 #> 2 1 9 2011-12-21 2011-12-29 #> 3 1 9 2011-12-30 2012-04-02 #> 4 1 15 2018-03-20 2018-04-01 #> 5 1 22 2013-01-01 2013-03-07 #> 6 1 25 2018-01-10 2018-03-13 #> 7 1 25 2018-03-14 2018-03-22 #> 8 1 25 2018-03-23 2018-06-26 #> 9 1 25 2018-06-27 2018-11-13 #> 10 1 31 2012-09-03 2013-02-18 #> # ℹ more rows # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIntersectDoc.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for consistent documentation of arguments in requireIntersect functions. — requireIntersectDoc","title":"Helper for consistent documentation of arguments in requireIntersect functions. — requireIntersectDoc","text":"Helper consistent documentation arguments requireIntersect functions.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIntersectDoc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for consistent documentation of arguments in requireIntersect functions. — requireIntersectDoc","text":"indexDate Name column cohort contains date compute intersection. intersections range indicating number intersections criteria fulfilled. single number passed, number intersections must match . targetStartDate Start date reference cohort table. targetEndDate End date reference cohort table. NULL, incidence target event window considered intersection, otherwise prevalence event used intersection (overlap cohort event). censorDate Whether censor overlap events specific date column date cohort. targetCohortTable Name cohort want check intersect. targetCohortId Vector cohort definition ids include. tableName Name table check intersect.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsEntry.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort to specific entry — requireIsEntry","title":"Restrict cohort to specific entry — requireIsEntry","text":"requireIsFirstEntry() filters cohort records, keeping first cohort entry per person.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsEntry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort to specific entry — requireIsEntry","text":"","code":"requireIsEntry(cohort, entryRange, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsEntry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort to specific entry — requireIsEntry","text":"cohort cohort table cdm reference. entryRange Range entries include. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsEntry.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort to specific entry — requireIsEntry","text":"cohort table cdm reference.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsEntry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort to specific entry — requireIsEntry","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 <- requireIsEntry(cdm$cohort1, c(1, Inf)) # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsFirstEntry.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort to first entry — requireIsFirstEntry","title":"Restrict cohort to first entry — requireIsFirstEntry","text":"requireIsFirstEntry() filters cohort records, keeping first cohort entry per person.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsFirstEntry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort to first entry — requireIsFirstEntry","text":"","code":"requireIsFirstEntry(cohort, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsFirstEntry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort to first entry — requireIsFirstEntry","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort restriction.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsFirstEntry.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort to first entry — requireIsFirstEntry","text":"cohort table cdm reference.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsFirstEntry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort to first entry — requireIsFirstEntry","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 <- requireIsFirstEntry(cdm$cohort1) # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsLastEntry.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort to last entry per person — requireIsLastEntry","title":"Restrict cohort to last entry per person — requireIsLastEntry","text":"requireIsLastEntry() filters cohort records, keeping last cohort entry per person.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsLastEntry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort to last entry per person — requireIsLastEntry","text":"","code":"requireIsLastEntry(cohort, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsLastEntry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort to last entry per person — requireIsLastEntry","text":"cohort cohort table cdm reference. cohortId IDs cohorts modify. NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort restriction.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsLastEntry.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort to last entry per person — requireIsLastEntry","text":"cohort table cdm reference.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireIsLastEntry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort to last entry per person — requireIsLastEntry","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 <- requireIsLastEntry(cdm$cohort1) # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireMinCohortCount.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","title":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","text":"requireMinCohortCount() filters existing cohort table, keeping records cohorts minimum number individuals","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireMinCohortCount.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","text":"","code":"requireMinCohortCount( cohort, cohortId = NULL, minCohortCount = 5, name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireMinCohortCount.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","text":"cohort cohort table cdm reference. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. minCohortCount minimum count sbjects cohort included. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireMinCohortCount.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","text":"Cohort table","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireMinCohortCount.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Filter cohorts to keep only records for those with a minimum amount of subjects — requireMinCohortCount","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor(nPerson = 100) cdm$cohort1 |> requireMinCohortCount(minCohortCount = 5) #> Warning: There was 1 warning in `dplyr::summarise()`. #> ℹ In argument: `reason_id = max(.data$reason_id)`. #> Caused by warning in `max()`: #> ! no non-missing arguments to max; returning -Inf #> Warning: ! 1 casted column in cohort1 (cohort_attrition) as do not match expected column #> type: #> • `reason_id` from numeric to integer #> # Source: table [?? x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 4 1998-12-14 2002-02-14 #> 2 1 6 2003-04-11 2004-02-23 #> 3 1 7 2004-07-31 2004-11-23 #> 4 1 7 2004-11-24 2005-11-05 #> 5 1 7 2005-11-06 2012-01-12 #> 6 1 8 2009-09-13 2012-04-22 #> 7 1 9 2011-12-20 2011-12-20 #> 8 1 9 2011-12-21 2011-12-29 #> 9 1 9 2011-12-30 2012-04-02 #> 10 1 12 2000-11-15 2013-03-04 #> # ℹ more rows # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requirePriorObservation.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort on prior observation — requirePriorObservation","title":"Restrict cohort on prior observation — requirePriorObservation","text":"requirePriorObservation() filters cohort records, keeping records individuals satisfy specified prior observation criteria.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requirePriorObservation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort on prior observation — requirePriorObservation","text":"","code":"requirePriorObservation( cohort, minPriorObservation, cohortId = NULL, indexDate = \"cohort_start_date\", name = tableName(cohort) )"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requirePriorObservation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort on prior observation — requirePriorObservation","text":"cohort cohort table cdm reference. minPriorObservation minimum number continuous prior observation days database. cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. indexDate Variable cohort contains date compute demographics characteristics restrict . name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requirePriorObservation.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort on prior observation — requirePriorObservation","text":"cohort table records individuals satisfying prior observation requirement","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requirePriorObservation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort on prior observation — requirePriorObservation","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> requirePriorObservation(indexDate = \"cohort_start_date\", minPriorObservation = 365) #> # Source: table [6 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> #> 1 1 2 1964-09-18 1965-08-30 #> 2 1 3 1976-11-28 1977-03-11 #> 3 1 3 1977-03-12 1978-04-03 #> 4 1 3 1978-04-04 1987-02-26 #> 5 1 4 1998-06-22 2001-02-12 #> 6 1 5 2008-11-11 2011-09-12 # }"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireSex.html","id":null,"dir":"Reference","previous_headings":"","what":"Restrict cohort on sex — requireSex","title":"Restrict cohort on sex — requireSex","text":"requireSex() filters cohort records, keeping records individuals satisfy specified sex criteria.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireSex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Restrict cohort on sex — requireSex","text":"","code":"requireSex(cohort, sex, cohortId = NULL, name = tableName(cohort))"},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireSex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Restrict cohort on sex — requireSex","text":"cohort cohort table cdm reference. sex Can \"\", \"Male\" \"Female\". cohortId Vector identifying cohorts modify (cohort_definition_id cohort_name). NULL, cohorts used; otherwise, specified cohorts modified, rest remain unchanged. name Name new cohort table created cdm object.","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireSex.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Restrict cohort on sex — requireSex","text":"cohort table records individuals satisfying sex requirement","code":""},{"path":"https://ohdsi.github.io/CohortConstructor/reference/requireSex.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Restrict cohort on sex — requireSex","text":"","code":"# \\donttest{ library(CohortConstructor) cdm <- mockCohortConstructor() cdm$cohort1 |> requireSex(sex = \"Female\") #> # Source: table [8 x 4] #> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #>
cdm$medications %>% filter(subject_id == 1) #> # Source: SQL [4 x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp7X9hnP/file23597b1a402e.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp63eoUI/file230130379d08.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 1 1976-10-20 1976-11-03 -#> 2 1 1 1971-01-04 1971-01-18 -#> 3 1 1 1982-09-11 1982-10-02 -#> 4 1 1 1980-03-15 1980-03-29 +#> 1 1 1 1971-01-04 1971-01-18 +#> 2 1 1 1982-09-11 1982-10-02 +#> 3 1 1 1980-03-15 1980-03-29 +#> 4 1 1 1976-10-20 1976-11-03 cdm$medications_collapsed %>% filter(subject_id == 1) #> # Source: SQL [3 x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp7X9hnP/file23597b1a402e.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp63eoUI/file230130379d08.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> #> 1 1 1 1976-10-20 1976-11-03 diff --git a/articles/a07_filter_cohorts.html b/articles/a07_filter_cohorts.html index 7f9f800..e8b76c8 100644 --- a/articles/a07_filter_cohorts.html +++ b/articles/a07_filter_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -108,26 +108,26 @@ cdm$medications |> sampleCohorts(cohortId = NULL, n = 100) #> # Source: table<main.my_study_medications> [?? x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp4IP3Tf/file239e6d25bc76.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmpCf9KA8/file23437cc57145.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 887 1974-10-05 1974-10-19 -#> 2 1 5048 1978-01-22 1978-01-29 -#> 3 1 1550 1981-02-07 1981-05-08 -#> 4 1 4490 1956-04-15 1956-04-29 -#> 5 1 3488 1960-04-20 1960-05-04 -#> 6 1 3655 1997-08-04 1997-08-25 -#> 7 2 1227 1980-05-31 1980-05-31 -#> 8 1 4078 1967-09-12 1967-09-19 -#> 9 1 4655 1982-11-20 1982-12-25 -#> 10 1 2228 2001-02-26 2001-03-12 +#> 1 1 1246 1947-11-06 1947-11-20 +#> 2 1 1246 2011-03-12 2011-03-26 +#> 3 1 2576 1993-10-25 1993-11-15 +#> 4 1 4758 1995-10-21 1995-11-04 +#> 5 1 4758 1999-11-11 2000-02-09 +#> 6 1 4364 2005-03-18 2005-04-01 +#> 7 1 1804 1989-07-12 1989-07-19 +#> 8 2 640 1992-11-07 1992-11-07 +#> 9 1 3389 1973-01-15 1973-02-14 +#> 10 1 3389 2005-02-04 2005-02-18 #> # ℹ more rows cohortCount(cdm$medications) #> # A tibble: 2 × 3 #> cohort_definition_id number_records number_subjects #> <int> <int> <int> -#> 1 1 324 100 +#> 1 1 345 100 #> 2 2 100 100 When cohortId = NULL all cohorts in the table are used. Note that this function does not reduced the number of records in each cohort, diff --git a/articles/a08_split_cohorts.html b/articles/a08_split_cohorts.html index 35da880..98ca063 100644 --- a/articles/a08_split_cohorts.html +++ b/articles/a08_split_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a09_combine_cohorts.html b/articles/a09_combine_cohorts.html index 755bd59..fb55323 100644 --- a/articles/a09_combine_cohorts.html +++ b/articles/a09_combine_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a10_match_cohorts.html b/articles/a10_match_cohorts.html index c5d767c..9be8219 100644 --- a/articles/a10_match_cohorts.html +++ b/articles/a10_match_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a11_benchmark.html b/articles/a11_benchmark.html index a7138c2..150a003 100644 --- a/articles/a11_benchmark.html +++ b/articles/a11_benchmark.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/index.html b/articles/index.html index 6324593..54ee3a3 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/authors.html b/authors.html index 0b77172..aebdcab 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -90,13 +90,13 @@ Citation Burn E, Catala M, Mercade-Besora N, Alcalde-Herraiz M, Du M, Guo Y, Chen X, Lopez-Guell K, Rowlands E (2024). CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model. -R package version 0.3.1, https://ohdsi.github.io/CohortConstructor/. +R package version 0.3.1.900, https://ohdsi.github.io/CohortConstructor/. @Manual{, title = {CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model}, author = {Edward Burn and Marti Catala and Nuria Mercade-Besora and Marta Alcalde-Herraiz and Mike Du and Yuchen Guo and Xihang Chen and Kim Lopez-Guell and Elin Rowlands}, year = {2024}, - note = {R package version 0.3.1}, + note = {R package version 0.3.1.900}, url = {https://ohdsi.github.io/CohortConstructor/}, } diff --git a/index.html b/index.html index 9385ede..3373601 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/pkgdown.yml b/pkgdown.yml index dad9b05..46fc45a 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -14,7 +14,7 @@ articles: a09_combine_cohorts: a09_combine_cohorts.html a10_match_cohorts: a10_match_cohorts.html a11_benchmark: a11_benchmark.html -last_built: 2024-10-11T14:52Z +last_built: 2024-10-11T15:31Z urls: reference: https://ohdsi.github.io/CohortConstructor/reference article: https://ohdsi.github.io/CohortConstructor/articles diff --git a/reference/CohortConstructor-package.html b/reference/CohortConstructor-package.html index 0fc0c10..096463e 100644 --- a/reference/CohortConstructor-package.html +++ b/reference/CohortConstructor-package.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/benchmarkData.html b/reference/benchmarkData.html index 097fc19..06e197d 100644 --- a/reference/benchmarkData.html +++ b/reference/benchmarkData.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cdmDoc.html b/reference/cdmDoc.html index 2134bf9..771e974 100644 --- a/reference/cdmDoc.html +++ b/reference/cdmDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortDoc.html b/reference/cohortDoc.html index c8ab3cf..8364922 100644 --- a/reference/cohortDoc.html +++ b/reference/cohortDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdModifyDoc.html b/reference/cohortIdModifyDoc.html index 1ac353a..951e840 100644 --- a/reference/cohortIdModifyDoc.html +++ b/reference/cohortIdModifyDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdSubsetDoc.html b/reference/cohortIdSubsetDoc.html index 9327a0f..b7319b7 100644 --- a/reference/cohortIdSubsetDoc.html +++ b/reference/cohortIdSubsetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/collapseCohorts.html b/reference/collapseCohorts.html index 1e48519..4a8210e 100644 --- a/reference/collapseCohorts.html +++ b/reference/collapseCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/columnDateDoc.html b/reference/columnDateDoc.html index 331c1e3..31842d5 100644 --- a/reference/columnDateDoc.html +++ b/reference/columnDateDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptCohort.html b/reference/conceptCohort.html index 7cc2b20..54155db 100644 --- a/reference/conceptCohort.html +++ b/reference/conceptCohort.html @@ -53,7 +53,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptSetDoc.html b/reference/conceptSetDoc.html index 3f205c7..934e317 100644 --- a/reference/conceptSetDoc.html +++ b/reference/conceptSetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/demographicsCohort.html b/reference/demographicsCohort.html index 4a27b6c..c1df445 100644 --- a/reference/demographicsCohort.html +++ b/reference/demographicsCohort.html @@ -13,7 +13,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/entryAtFirstDate.html b/reference/entryAtFirstDate.html index 75ce1d9..4ca43a6 100644 --- a/reference/entryAtFirstDate.html +++ b/reference/entryAtFirstDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -181,10 +181,10 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> <dbl> <dbl> <date> <date> <chr> -#> 1 1 1 2001-08-01 2001-09-01 date_2; dat… +#> 1 1 2 2001-01-01 2001-01-12 date_1 #> 2 1 3 2015-02-14 2015-02-15 date_2 -#> 3 1 4 2002-12-09 2002-12-09 date_2; dat… -#> 4 1 2 2001-01-01 2001-01-12 date_1 +#> 3 1 1 2001-08-01 2001-09-01 date_1; dat… +#> 4 1 4 2002-12-09 2002-12-09 date_1; dat… # }
cdm$medications |> sampleCohorts(cohortId = NULL, n = 100) #> # Source: table<main.my_study_medications> [?? x 4] -#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/Rtmp4IP3Tf/file239e6d25bc76.duckdb] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1//tmp/RtmpCf9KA8/file23437cc57145.duckdb] #> cohort_definition_id subject_id cohort_start_date cohort_end_date #> <int> <int> <date> <date> -#> 1 1 887 1974-10-05 1974-10-19 -#> 2 1 5048 1978-01-22 1978-01-29 -#> 3 1 1550 1981-02-07 1981-05-08 -#> 4 1 4490 1956-04-15 1956-04-29 -#> 5 1 3488 1960-04-20 1960-05-04 -#> 6 1 3655 1997-08-04 1997-08-25 -#> 7 2 1227 1980-05-31 1980-05-31 -#> 8 1 4078 1967-09-12 1967-09-19 -#> 9 1 4655 1982-11-20 1982-12-25 -#> 10 1 2228 2001-02-26 2001-03-12 +#> 1 1 1246 1947-11-06 1947-11-20 +#> 2 1 1246 2011-03-12 2011-03-26 +#> 3 1 2576 1993-10-25 1993-11-15 +#> 4 1 4758 1995-10-21 1995-11-04 +#> 5 1 4758 1999-11-11 2000-02-09 +#> 6 1 4364 2005-03-18 2005-04-01 +#> 7 1 1804 1989-07-12 1989-07-19 +#> 8 2 640 1992-11-07 1992-11-07 +#> 9 1 3389 1973-01-15 1973-02-14 +#> 10 1 3389 2005-02-04 2005-02-18 #> # ℹ more rows cohortCount(cdm$medications) #> # A tibble: 2 × 3 #> cohort_definition_id number_records number_subjects #> <int> <int> <int> -#> 1 1 324 100 +#> 1 1 345 100 #> 2 2 100 100
When cohortId = NULL all cohorts in the table are used. Note that this function does not reduced the number of records in each cohort, diff --git a/articles/a08_split_cohorts.html b/articles/a08_split_cohorts.html index 35da880..98ca063 100644 --- a/articles/a08_split_cohorts.html +++ b/articles/a08_split_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a09_combine_cohorts.html b/articles/a09_combine_cohorts.html index 755bd59..fb55323 100644 --- a/articles/a09_combine_cohorts.html +++ b/articles/a09_combine_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a10_match_cohorts.html b/articles/a10_match_cohorts.html index c5d767c..9be8219 100644 --- a/articles/a10_match_cohorts.html +++ b/articles/a10_match_cohorts.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/a11_benchmark.html b/articles/a11_benchmark.html index a7138c2..150a003 100644 --- a/articles/a11_benchmark.html +++ b/articles/a11_benchmark.html @@ -26,7 +26,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/articles/index.html b/articles/index.html index 6324593..54ee3a3 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/authors.html b/authors.html index 0b77172..aebdcab 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -90,13 +90,13 @@ Citation Burn E, Catala M, Mercade-Besora N, Alcalde-Herraiz M, Du M, Guo Y, Chen X, Lopez-Guell K, Rowlands E (2024). CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model. -R package version 0.3.1, https://ohdsi.github.io/CohortConstructor/. +R package version 0.3.1.900, https://ohdsi.github.io/CohortConstructor/. @Manual{, title = {CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model}, author = {Edward Burn and Marti Catala and Nuria Mercade-Besora and Marta Alcalde-Herraiz and Mike Du and Yuchen Guo and Xihang Chen and Kim Lopez-Guell and Elin Rowlands}, year = {2024}, - note = {R package version 0.3.1}, + note = {R package version 0.3.1.900}, url = {https://ohdsi.github.io/CohortConstructor/}, } diff --git a/index.html b/index.html index 9385ede..3373601 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/pkgdown.yml b/pkgdown.yml index dad9b05..46fc45a 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -14,7 +14,7 @@ articles: a09_combine_cohorts: a09_combine_cohorts.html a10_match_cohorts: a10_match_cohorts.html a11_benchmark: a11_benchmark.html -last_built: 2024-10-11T14:52Z +last_built: 2024-10-11T15:31Z urls: reference: https://ohdsi.github.io/CohortConstructor/reference article: https://ohdsi.github.io/CohortConstructor/articles diff --git a/reference/CohortConstructor-package.html b/reference/CohortConstructor-package.html index 0fc0c10..096463e 100644 --- a/reference/CohortConstructor-package.html +++ b/reference/CohortConstructor-package.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/benchmarkData.html b/reference/benchmarkData.html index 097fc19..06e197d 100644 --- a/reference/benchmarkData.html +++ b/reference/benchmarkData.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cdmDoc.html b/reference/cdmDoc.html index 2134bf9..771e974 100644 --- a/reference/cdmDoc.html +++ b/reference/cdmDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortDoc.html b/reference/cohortDoc.html index c8ab3cf..8364922 100644 --- a/reference/cohortDoc.html +++ b/reference/cohortDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdModifyDoc.html b/reference/cohortIdModifyDoc.html index 1ac353a..951e840 100644 --- a/reference/cohortIdModifyDoc.html +++ b/reference/cohortIdModifyDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/cohortIdSubsetDoc.html b/reference/cohortIdSubsetDoc.html index 9327a0f..b7319b7 100644 --- a/reference/cohortIdSubsetDoc.html +++ b/reference/cohortIdSubsetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/collapseCohorts.html b/reference/collapseCohorts.html index 1e48519..4a8210e 100644 --- a/reference/collapseCohorts.html +++ b/reference/collapseCohorts.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/columnDateDoc.html b/reference/columnDateDoc.html index 331c1e3..31842d5 100644 --- a/reference/columnDateDoc.html +++ b/reference/columnDateDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptCohort.html b/reference/conceptCohort.html index 7cc2b20..54155db 100644 --- a/reference/conceptCohort.html +++ b/reference/conceptCohort.html @@ -53,7 +53,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/conceptSetDoc.html b/reference/conceptSetDoc.html index 3f205c7..934e317 100644 --- a/reference/conceptSetDoc.html +++ b/reference/conceptSetDoc.html @@ -7,7 +7,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/demographicsCohort.html b/reference/demographicsCohort.html index 4a27b6c..c1df445 100644 --- a/reference/demographicsCohort.html +++ b/reference/demographicsCohort.html @@ -13,7 +13,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 diff --git a/reference/entryAtFirstDate.html b/reference/entryAtFirstDate.html index 75ce1d9..4ca43a6 100644 --- a/reference/entryAtFirstDate.html +++ b/reference/entryAtFirstDate.html @@ -9,7 +9,7 @@ CohortConstructor - 0.3.1 + 0.3.1.900 @@ -181,10 +181,10 @@ Examples#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] #> cohort_definition_id subject_id cohort_start_date cohort_end_date entry_reason #> <dbl> <dbl> <date> <date> <chr> -#> 1 1 1 2001-08-01 2001-09-01 date_2; dat… +#> 1 1 2 2001-01-01 2001-01-12 date_1 #> 2 1 3 2015-02-14 2015-02-15 date_2 -#> 3 1 4 2002-12-09 2002-12-09 date_2; dat… -#> 4 1 2 2001-01-01 2001-01-12 date_1 +#> 3 1 1 2001-08-01 2001-09-01 date_1; dat… +#> 4 1 4 2002-12-09 2002-12-09 date_1; dat… # }
Burn E, Catala M, Mercade-Besora N, Alcalde-Herraiz M, Du M, Guo Y, Chen X, Lopez-Guell K, Rowlands E (2024). CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model. -R package version 0.3.1, https://ohdsi.github.io/CohortConstructor/. +R package version 0.3.1.900, https://ohdsi.github.io/CohortConstructor/.
@Manual{, title = {CohortConstructor: Build and Manipulate Study Cohorts Using a Common Data Model}, author = {Edward Burn and Marti Catala and Nuria Mercade-Besora and Marta Alcalde-Herraiz and Mike Du and Yuchen Guo and Xihang Chen and Kim Lopez-Guell and Elin Rowlands}, year = {2024}, - note = {R package version 0.3.1}, + note = {R package version 0.3.1.900}, url = {https://ohdsi.github.io/CohortConstructor/}, }
padCohortEnd()
padCohortStart()
padCohortEnd.Rd
padCohortStart() Adds (or subtracts) a certain number of days to the cohort +end date. Note:
If the days added means that cohort end would be after observation +period end date, then observation period end date will be used for cohort +exit.
If the days added means that cohort exit would be after the next cohort +start then these overlapping cohort entries will be collapsed.
If days subtracted means that cohort end would be before cohort start then +the cohort entry will be dropped.
padCohortEnd(cohort, days, cohortId = NULL, name = tableName(cohort))
A cohort table in a cdm reference.
Number of day to add to the cohort end date.
Vector identifying which cohorts to modify +(cohort_definition_id or cohort_name). If NULL, all cohorts will be +used; otherwise, only the specified cohorts will be modified, and the +rest will remain unchanged.
Name of the new cohort table created in the cdm object.
Cohort table
# \donttest{ +library(CohortConstructor) +cdm <- mockCohortConstructor() +# add 10 days to each cohort exit +cdm$cohort1 |> + padCohortEnd(days = 10) +#> # Source: table<main.cohort1> [6 x 4] +#> # Database: DuckDB v1.1.0 [unknown@Linux 6.8.0-1015-azure:R 4.4.1/:memory:] +#> cohort_definition_id subject_id cohort_start_date cohort_end_date +#> <int> <int> <date> <date> +#> 1 1 2 1964-09-18 1965-09-09 +#> 2 1 6 2003-10-31 2004-04-20 +#> 3 1 9 2012-01-18 2012-03-18 +#> 4 1 4 1998-06-22 2001-02-22 +#> 5 1 5 2007-10-19 2011-09-22 +#> 6 1 3 1976-11-28 1987-03-08 +# } +