Skip to content

Commit

Permalink
Merge pull request #416 from OHDSI/cohortvalidation
Browse files Browse the repository at this point in the history
Validate cohorts in functions that modify dates
  • Loading branch information
edward-burn authored Dec 19, 2024
2 parents 7502eca + 85aff2e commit 21088e6
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/collapseCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/exitAtColumnDate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions R/exitAtDate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion R/matchCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ matchCohorts <- function(cohort,
"match_status" = "target"
)
,
.softValidation = TRUE
.softValidation = FALSE
)

# Bind both cohorts
Expand Down
1 change: 1 addition & 0 deletions R/padCohortDate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/requireDateRange.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion R/trimDemographics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion R/unionCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ unionCohorts <- function(cohort,
cohortSetRef = cohSet,
cohortAttritionRef = NULL,
cohortCodelistRef = cohCodelist,
.softValidation = TRUE
.softValidation = FALSE
)

if (isFALSE(keepOriginalCohorts)) {
Expand Down
2 changes: 1 addition & 1 deletion R/yearCohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 21088e6

Please sign in to comment.