Skip to content

Commit

Permalink
v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
edward-burn committed Nov 12, 2024
1 parent 26484ba commit ea30962
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: CohortConstructor
Title: Build and Manipulate Study Cohorts Using a Common Data Model
Version: 0.3.1.900
Version: 0.3.2
Authors@R: c(
person("Edward", "Burn", , "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9286-1128")),
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## R CMD check results

This is a patch releasing, fixing a small issue from the previous release.
This is a new release.
2 changes: 2 additions & 0 deletions tests/testthat/test-collapseCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ test_that("out of observation", {
})

test_that("infitine", {
skip_on_cran()

cdm <- omock::mockCdmFromTables()
cdm$person <- dplyr::tibble(
Expand Down Expand Up @@ -249,6 +250,7 @@ test_that("infitine", {

test_that("multiple observation periods", {
# collapse should respect observation end dates
skip_on_cran()

cdm <- omock::mockCdmReference() |>
omock::mockCdmFromTables(tables = list("cohort" = dplyr::tibble(
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-conceptCohort.R
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ test_that("table not present in the cdm", {
})

test_that("cohort exit as event start date", {
cdm <- omock::mockCdmReference() |>
skip_on_cran()
cdm <- omock::mockCdmReference() |>
omock::mockCdmFromTables(tables = list("cohort" = dplyr::tibble(
"cohort_definition_id" = 1L,
"subject_id" = c(1L, 2L, 3L),
Expand Down Expand Up @@ -625,7 +626,8 @@ test_that("cohort exit as event start date", {
})

test_that("use source field concepts", {
cdm <- omock::mockCdmReference() |>
skip_on_cran()
cdm <- omock::mockCdmReference() |>
omock::mockCdmFromTables(tables = list("cohort" = dplyr::tibble(
"cohort_definition_id" = 1L,
"subject_id" = c(1L, 2L, 3L),
Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/test-intersectCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ test_that("intersect example - two cohorts", {
})

test_that("intersect example - three cohorts", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -95,6 +97,8 @@ test_that("intersect example - three cohorts", {
})

test_that("intersect example - nobody with intersection", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -140,6 +144,8 @@ test_that("intersect example - nobody with intersection", {
})

test_that("intersect with gap", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 1)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -195,6 +201,8 @@ test_that("intersect with gap", {
})

test_that("keepOriginalCohorts", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -274,6 +282,8 @@ test_that("keepOriginalCohorts", {
})

test_that("returnNonOverlappingCohorts - two cohorts", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -323,6 +333,8 @@ test_that("returnNonOverlappingCohorts - two cohorts", {
})

test_that("returnNonOverlappingCohorts - three cohorts", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -532,6 +544,8 @@ test_that("codelist", {
})

test_that("records combined for gap must be in the same observation period", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 2)
cdm_local <- omopgenerics::insertTable(
Expand Down Expand Up @@ -586,6 +600,8 @@ test_that("records combined for gap must be in the same observation period", {
})

test_that("multiple observation periods", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 4, seed = 1)
cdm_local$observation_period <- dplyr::tibble(
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-matchCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ test_that("matchCohorts runs without errors", {
})

test_that("matchCohorts, no duplicated people within a cohort", {
skip_on_cran()

cdm <- mockCohortConstructor(nPerson = 1000)
cdm$cohort1 <- cdm$cohort1 |>
dplyr::group_by(subject_id) |>
Expand Down Expand Up @@ -120,6 +122,7 @@ test_that("matchCohorts, no duplicated people within a cohort", {
})

test_that("check that we obtain expected result when ratio is 1", {
skip_on_cran()

cdm <- mockCohortConstructor(nPerson = 1000)

Expand Down Expand Up @@ -179,6 +182,7 @@ test_that("check that we obtain expected result when ratio is 1", {
})

test_that("test exactMatchingCohort with a ratio bigger than 1", {
skip_on_cran()

cdm <- omock::emptyCdmReference(cdmName = "mock")
cdm$person <- cdm$person |>
Expand Down Expand Up @@ -278,6 +282,8 @@ test_that("test exactMatchingCohort with a ratio bigger than 1", {
})

test_that("keepOriginalCohorts works" , {
skip_on_cran()

cdm <- mockCohortConstructor()
cohort <- cdm$cohort2 |> matchCohorts(cohortId = 1, keepOriginalCohorts = TRUE, name = "new_cohort")
expect_identical(settings(cohort), dplyr::tibble(
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-measurementCohort.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("mearurementCohorts works", {
skip_on_cran()

cdm <- mockCohortConstructor(con = NULL, seed = 1)
cdm$concept <- cdm$concept |>
dplyr::union_all(
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-padCohortDate.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("simple example", {
skip_on_cran()

cdm <- omock::mockCdmFromTables(tables = list(
cohort =
Expand Down Expand Up @@ -53,6 +54,7 @@ test_that("simple example", {
})

test_that("overlapping entries", {
skip_on_cran()

cdm <- omock::mockCdmFromTables(tables = list(
cohort =
Expand Down Expand Up @@ -162,6 +164,8 @@ test_that("test indexes - postgres", {
})

test_that("adding days to cohort start", {
skip_on_cran()

cdm <- omock::mockCdmFromTables(tables = list(
cohort =
data.frame(
Expand Down Expand Up @@ -348,6 +352,8 @@ test_that("test indexes - postgres", {
})

test_that("test padCohortDate", {
skip_on_cran()

cdm <- omock::mockCdmFromTables(tables = list(
cohort = dplyr::tibble(
cohort_definition_id = 1L,
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-unionCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ test_that("unionCohorts works", {
})

test_that("gap and name works", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 4, seed = 1) |>
omock::mockObservationPeriod(seed = 1) |>
Expand Down Expand Up @@ -277,6 +279,8 @@ test_that("test codelist", {
})

test_that("keep original cohorts", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 4, seed = 1) |>
omock::mockObservationPeriod(seed = 1) |>
Expand All @@ -299,6 +303,8 @@ test_that("keep original cohorts", {
})

test_that("multiple observation periods", {
skip_on_cran()

cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(n = 4, seed = 1)
cdm_local$observation_period <- dplyr::tibble(
Expand Down

0 comments on commit ea30962

Please sign in to comment.