Skip to content

Commit

Permalink
Add incremental setting for CDM execution
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonysena committed Aug 28, 2024
1 parent 8e261b3 commit 2dcba52
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion R/Module-Characterization.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CharacterizationModule <- R6::R6Class(
csvFilePrefix = self$tablePrefix,
minCellCount = jobContext$moduleExecutionSettings$minCellCount,
minCharacterizationMean = jobContext$moduleExecutionSettings$minCharacterizationMean,
incremental = T, # any Strartegus param for this?
incremental = jobContext$moduleExecutionSettings$incremental,
threads = as.double(ifelse(Sys.getenv('CharacterizationThreads') == "", 1,Sys.getenv('CharacterizationThreads') ))
)

Expand Down
4 changes: 1 addition & 3 deletions R/Module-CohortDiagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ CohortDiagnosticsModule <- R6::R6Class(
#' will help reduce the file size of the characterization output, but will remove information
#' on covariates that have very low values. The default is 0.001 (i.e. 0.1 percent)
#' @param irWashoutPeriod Number of days washout to include in calculation of incidence rates - default is 0
#' @param incremental Create only cohort diagnostics that haven't been created before?
createModuleSpecifications = function(cohortIds = NULL,
runInclusionStatistics = TRUE,
runIncludedSourceConcepts = TRUE,
Expand All @@ -146,8 +145,7 @@ CohortDiagnosticsModule <- R6::R6Class(
runTemporalCohortCharacterization = TRUE,
temporalCovariateSettings = private$.getDefaultCovariateSettings(),
minCharacterizationMean = 0.01,
irWashoutPeriod = 0,
incremental = FALSE) {
irWashoutPeriod = 0) {
analysis <- list()
for (name in names(formals(self$createModuleSpecifications))) {
analysis[[name]] <- get(name)
Expand Down
8 changes: 2 additions & 6 deletions R/Module-CohortGenerator.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CohortGeneratorModule <- R6::R6Class(
detectOnDescendants = negativeControlOutcomeSettings$detectOnDescendants,
outputFolder = resultsFolder,
databaseId = jobContext$moduleExecutionSettings$cdmDatabaseMetaData$databaseId,
incremental = jobContext$settings$incremental,
incremental = jobContext$moduleExecutionSettings$incremental,
incrementalFolder = jobContext$moduleExecutionSettings$workSubFolder
)

Expand Down Expand Up @@ -79,13 +79,9 @@ CohortGeneratorModule <- R6::R6Class(
)
},
#' @description Creates the CohortGenerator Module Specifications
#' @param incremental When TRUE, the module will keep track of the cohorts
#' generated so that subsequent runs will skip any previously generated
#' cohorts.
#' @param generateStats When TRUE, the Circe cohort definition SQL will
#' include steps to compute inclusion rule statistics.
createModuleSpecifications = function(incremental = TRUE,
generateStats = TRUE) {
createModuleSpecifications = function(generateStats = TRUE) {
analysis <- list()
for (name in names(formals(self$createModuleSpecifications))) {
analysis[[name]] <- get(name)
Expand Down
7 changes: 6 additions & 1 deletion R/Settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ createEmptyAnalysisSpecificiations <- function() {
#' @param logFileName Logging information from Strategus and all modules will be located in this file. Individual modules will continue to have their own module-specific logs. By default this will be written to the root of the `resultsFolder`
#' @param minCellCount The minimum number of subjects contributing to a count before it can be included
#' in results.
#' @param incremental This value will be passed to each module that supports execution in an incremental manner. Modules
#' and their underlying packages may use the `workFolder` contents to determine their state of execution
#' and attempt to pick up where they left off when this value is set to TRUE.
#'
#' @return
#' An object of type `ExecutionSettings`.
Expand All @@ -265,7 +268,8 @@ createCdmExecutionSettings <- function(workDatabaseSchema,
workFolder,
resultsFolder,
logFileName = file.path(resultsFolder, "strategus-log.txt"),
minCellCount = 5) {
minCellCount = 5,
incremental = TRUE) {
errorMessages <- checkmate::makeAssertCollection()
checkmate::assertCharacter(workDatabaseSchema, len = 1, add = errorMessages)
checkmate::assertCharacter(cdmDatabaseSchema, len = 1, add = errorMessages)
Expand All @@ -274,6 +278,7 @@ createCdmExecutionSettings <- function(workDatabaseSchema,
checkmate::assertCharacter(resultsFolder, len = 1, add = errorMessages)
checkmate::assertCharacter(logFileName, len = 1, add = errorMessages)
checkmate::assertInt(minCellCount, add = errorMessages)
checkmate::assertLogical(incremental, add = errorMessages)
checkmate::reportAssertions(collection = errorMessages)

# Normalize paths to convert relative paths to absolute paths
Expand Down
2 changes: 1 addition & 1 deletion man/CharacterizationModule.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions man/CohortDiagnosticsModule.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions man/CohortGeneratorModule.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/createCdmExecutionSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2dcba52

Please sign in to comment.