From 85aff2e67858d6695cfd2641b55ee9fceb7606b2 Mon Sep 17 00:00:00 2001 From: nmercadeb Date: Thu, 19 Dec 2024 14:05:56 +0100 Subject: [PATCH] validate cohorts --- R/collapseCohorts.R | 2 +- R/exitAtColumnDate.R | 2 +- R/exitAtDate.R | 4 ++-- R/matchCohorts.R | 2 +- R/padCohortDate.R | 1 + R/requireDateRange.R | 2 +- R/trimDemographics.R | 2 +- R/unionCohorts.R | 2 +- R/yearCohorts.R | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/R/collapseCohorts.R b/R/collapseCohorts.R index adc8592..43a3c4e 100644 --- a/R/collapseCohorts.R +++ b/R/collapseCohorts.R @@ -73,7 +73,7 @@ collapseCohorts <- function(cohort, dplyr::compute(name = name, temporary = FALSE) } newCohort <- newCohort |> - omopgenerics::newCohortTable(.softValidation = TRUE) |> + omopgenerics::newCohortTable(.softValidation = FALSE) |> omopgenerics::recordCohortAttrition( reason = "Collapse cohort with a gap of {gap} days.", cohortId = cohortId) diff --git a/R/exitAtColumnDate.R b/R/exitAtColumnDate.R index 62b4014..741a883 100644 --- a/R/exitAtColumnDate.R +++ b/R/exitAtColumnDate.R @@ -216,7 +216,7 @@ exitAtColumnDate <- function(cohort, newCohort <- newCohort |> dplyr::relocate(dplyr::all_of(omopgenerics::cohortColumns("cohort"))) |> dplyr::compute(name = name, temporary = FALSE) |> - omopgenerics::newCohortTable(.softValidation = TRUE) + omopgenerics::newCohortTable(.softValidation = FALSE) cdm <- omopgenerics::dropTable(cdm, name = dplyr::starts_with(tmpPrefix)) diff --git a/R/exitAtDate.R b/R/exitAtDate.R index 04dd3b7..a248547 100644 --- a/R/exitAtDate.R +++ b/R/exitAtDate.R @@ -105,7 +105,7 @@ exitAtObservationEnd <- function(cohort, newCohort <- newCohort |> dplyr::compute(name = name, temporary = FALSE) |> - omopgenerics::newCohortTable(.softValidation = TRUE) |> + omopgenerics::newCohortTable(.softValidation = FALSE) |> omopgenerics::recordCohortAttrition(reason = reason, cohortId = cohortId) omopgenerics::dropTable(cdm = cdm, name = tmpTable) @@ -186,7 +186,7 @@ exitAtDeath <- function(cohort, # no overlapping periods joinOverlap(name = name) |> dplyr::compute(name = name, temporary = FALSE) |> - omopgenerics::newCohortTable(.softValidation = TRUE) |> + omopgenerics::newCohortTable(.softValidation = FALSE) |> omopgenerics::recordCohortAttrition(reason = "Exit at death", cohortId = cohortId) useIndexes <- getOption("CohortConstructor.use_indexes") diff --git a/R/matchCohorts.R b/R/matchCohorts.R index 1028162..fcead17 100644 --- a/R/matchCohorts.R +++ b/R/matchCohorts.R @@ -164,7 +164,7 @@ matchCohorts <- function(cohort, "match_status" = "target" ) , - .softValidation = TRUE + .softValidation = FALSE ) # Bind both cohorts diff --git a/R/padCohortDate.R b/R/padCohortDate.R index 53e511f..b4a3560 100644 --- a/R/padCohortDate.R +++ b/R/padCohortDate.R @@ -213,6 +213,7 @@ padCohortStart <- function(cohort, ) |> dplyr::union_all(subCohort) |> dplyr::compute(name = name, temporary = FALSE) |> + omopgenerics::newCohortTable(.softValidation = FALSE) |> omopgenerics::recordCohortAttrition(cohortId = cohortId, reason = reason) # drop temp table diff --git a/R/requireDateRange.R b/R/requireDateRange.R index ce11e2d..79c4c9f 100644 --- a/R/requireDateRange.R +++ b/R/requireDateRange.R @@ -149,7 +149,7 @@ trimToDateRange <- function(cohort, cohort <- cohort |> dplyr::compute(name = name, temporary = FALSE) |> - omopgenerics::newCohortTable(.softValidation = TRUE) + omopgenerics::newCohortTable(.softValidation = FALSE) useIndexes <- getOption("CohortConstructor.use_indexes") if (!isFALSE(useIndexes)) { diff --git a/R/trimDemographics.R b/R/trimDemographics.R index e0b41f8..f35f18d 100644 --- a/R/trimDemographics.R +++ b/R/trimDemographics.R @@ -320,7 +320,7 @@ trimDemographics <- function(cohort, cohortSetRef = newSet, cohortAttritionRef = attrition(newCohort), cohortCodelistRef = newCod, - .softValidation = TRUE + .softValidation = FALSE ) omopgenerics::dropTable(cdm = cdm, name = dplyr::starts_with(tablePrefix)) diff --git a/R/unionCohorts.R b/R/unionCohorts.R index 7bcf44a..c4f55a9 100644 --- a/R/unionCohorts.R +++ b/R/unionCohorts.R @@ -80,7 +80,7 @@ unionCohorts <- function(cohort, cohortSetRef = cohSet, cohortAttritionRef = NULL, cohortCodelistRef = cohCodelist, - .softValidation = TRUE + .softValidation = FALSE ) if (isFALSE(keepOriginalCohorts)) { diff --git a/R/yearCohorts.R b/R/yearCohorts.R index 658116a..e538226 100644 --- a/R/yearCohorts.R +++ b/R/yearCohorts.R @@ -178,7 +178,7 @@ yearCohorts <- function(cohort, cohortSetRef = newSet, cohortAttritionRef = newAttrition |> dplyr::bind_rows(), cohortCodelistRef = newCodelist, - .softValidation = TRUE + .softValidation = FALSE ) omopgenerics::dropTable(cdm = cdm, name = dplyr::starts_with(tablePrefix))