Skip to content

Commit

Permalink
Merge pull request #274 from OHDSI/issue_156
Browse files Browse the repository at this point in the history
testing strata when density is computed in summariseObservationPeriod
  • Loading branch information
catalamarti authored Dec 17, 2024
2 parents fa78c7c + a516400 commit 28150e8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/testthat/test-summariseObservationPeriod.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,34 @@ test_that("check summariseObservationPeriod strata works", {
dplyr::pull("estimate_value"), "32"
)

expect_no_error(x<-summariseObservationPeriod(cdm$observation_period, estimates = "density", sex = TRUE, ageGroup = list(c(0,9), c(10, Inf))))
expect_no_error(
x |>
plotObservationPeriod(
variableName = "duration in days", plotType = "densityplot", colour = "sex", facet = "age_group")
)

expect_no_error(
x |>
plotObservationPeriod(
variableName = "days to next observation period", plotType = "densityplot", colour = "sex", facet = "age_group")
)
expect_no_error(
x |>
plotObservationPeriod(
variableName = "records per person", plotType = "densityplot", colour = "sex", facet = "age_group")
)

expect_error(x |>
plotObservationPeriod(
variableName = "number records", plotType = "densityplot", colour = "sex", facet = "age_group"))
y<-summariseObservationPeriod(cdm$observation_period, estimates = "mean", sex = TRUE, ageGroup = list(c(0,9), c(10, Inf)))
expect_error(
y |>
plotObservationPeriod(
variableName = "records per person", plotType = "densityplot", colour = "sex", facet = "age_group")
)

PatientProfiles::mockDisconnect(cdm = cdm)
})

Expand Down

0 comments on commit 28150e8

Please sign in to comment.