Expected `resAll <- summariseObservationPeriod(cdm$observation_period)` to run without any errors.
i Actually got a <simpleError> with text:
  unused argument (minFutureObservation = NULL)

con = connection(), cdm = cdm, schema = schema())
resAllD <- summariseObservationPeriod(cdm$observation_period, estimates = "density"))
dplyr::mutate(estimate_value = as.numeric(estimate_value)) |> removeSettings(),
dplyr::mutate(estimate_value = as.numeric(estimate_value)) |> removeSettings()
dplyr::filter(!.data$variable_name %in% c("number records", "number subjects")) |>
expect_identical(resAll$estimate_value[resAll$variable_name == "number records"], "8")
group_level = c("overall", "1st", "2nd", "3rd"),
expect_identical(nrow(x), resAll |> dplyr::inner_join(x, by = colnames(x)) |> nrow())
variable_name == "records per person", estimate_name == "mean") |>
dplyr::filter(variable_name == "duration in days", estimate_name == "mean") |>
dplyr::filter(variable_name == "days to next observation period", estimate_name == "mean") |>
dplyr::filter(variable_name == "duration in days", !is.na(variable_level)) |>
area = sum(as.numeric(estimate_value[estimate_name == "density_y"])) * (
expect_identical(xx$n |> unique() |> sort(decreasing = TRUE), c(as.integer(nPoints*2L),6L))
expect_identical(xx$area |> round(2) |> unique() |> sort(decreasing = TRUE), c(1,0))
# days to next observation period - density
dplyr::filter(variable_name == "days to next observation period",
expect_identical(xx$n |> unique() |> sort(decreasing = TRUE) , c(as.integer(nPoints*2L),6L))
expect_identical(xx$area[xx$group_level != "2nd"] |> round(2) |> unique(), 1)
dplyr::filter(observation_period_id == min(observation_period_id, na.rm = TRUE)) |>
dplyr::compute(name = "observation_period", temporary = FALSE)
expect_identical(resOne$estimate_value[resOne$variable_name == "number records"], "4")
expect_identical(nrow(x), resOne |> dplyr::inner_join(x, by = colnames(x)) |> nrow())
# expect_warning(plotObservationPeriod(resEmpty)) THIS TEST NEEDS DISCUSSION
variableName = "number subjects", plotType = "barplot")
variableName = "number subjects", plotType = "boxplot")
variableName = "number subjects", plotType = "densityplot")
variableName = "number subjects", plotType = "random")
variableName = "duration in days", plotType = "barplot")
variableName = "duration in days", plotType = "boxplot")
variableName = "duration in days", plotType = "densityplot")
variableName = "duration in days", plotType = "random")
variableName = "records per person", plotType = "barplot")
variableName = "records per person", plotType = "boxplot")
variableName = "records per person", plotType = "densityplot")
variableName = "records per person", plotType = "random")
variableName = "days to next observation period", plotType = "barplot")
variableName = "days to next observation period", plotType = "boxplot")
variableName = "days to next observation period", plotType = "densityplot")
variableName = "days to next observation period", plotType = "random")
test_that("check it works with mockOmopSketch", {
cdm <- mockOmopSketch(numberIndividuals = 5, seed = 1)
expect_identical(sop$estimate_value[sop$variable_name == "number records"], "5")
expect_identical(nrow(x), sop |> dplyr::inner_join(x, by = colnames(x)) |> nrow())
variable_name == "records per person", estimate_name != "sd", !grepl("density", estimate_name)) |>
dplyr::filter(variable_name == "duration in days", estimate_name %in% c("min","q25","median","q75","max")) |>
dplyr::mutate(duration = observation_period_end_date - observation_period_start_date + 1) |>
test_that("check summariseObservationPeriod strata works", {
estimates = c("mean", "sd", "min", "max", "median", "density")))
estimates = c("mean", "sd", "min", "max", "median", "density"),
dplyr::filter(strata_name == "overall", strata_level == "overall") |>
# check strata groups have the expected value
dplyr::filter(variable_name == "duration in days", estimate_name == "mean", strata_level == ">=10") |>
dplyr::filter(variable_name == "duration in days", estimate_name == "mean", strata_level == "<10") |>
dplyr::filter(variable_name == "days to next observation period", estimate_name == "mean",
strata_level == "<10 &&& Female", group_level == "1st") |>