diff --git a/DESCRIPTION b/DESCRIPTION index 0147d065..1fa7e091 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: Strategus Type: Package Title: Coordinating and Executing Analytics Using HADES Modules -Version: 0.2.1 -Date: 2023-01-29 +Version: 0.3.0 +Date: 2023-06-04 Authors@R: c( person("Martijn", "Schuemie", email = "schuemie@ohdsi.org", role = c("aut")), person("Anthony", "Sena", email = "sena@ohdsi.org", role = c("aut", "cre")), @@ -33,7 +33,9 @@ Imports: tibble, ResultModelManager (>= 0.3.0), SqlRender (>= 1.11.0), - semver + semver, + httr2, + jsonlite Suggests: testthat (>= 3.0.0), fs, diff --git a/NAMESPACE b/NAMESPACE index dd45e9e0..373b0586 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,12 +10,14 @@ export(createResultsExecutionSettings) export(ensureAllModulesInstantiated) export(execute) export(getModuleList) +export(installLatestModule) export(retrieveConnectionDetails) export(storeConnectionDetails) export(syncLockFile) export(unlockKeyring) export(validateLockFile) export(verifyModuleInstallation) +export(zipResults) import(CohortGenerator) import(DatabaseConnector) import(dplyr) diff --git a/NEWS.md b/NEWS.md index 28d06f42..44956b2f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +Strategus 0.3.0 +=============== +- Provide option to skip modules (#87) +- Central log file for execution (#132) +- Create function to collect all results into a single ZIP file for sharing (#46) +- Install latest modules (#125) + Strategus 0.2.1 =============== - Update SelfControlledCaseSeries Module to v0.4.1 diff --git a/R/Execution.R b/R/Execution.R index 2b073f3a..100d11b4 100644 --- a/R/Execution.R +++ b/R/Execution.R @@ -31,6 +31,9 @@ #' @template keyringName #' @param restart Restart run? Requires `executionScriptFolder` to be specified, and be #' the same as the `executionScriptFolder` used in the run to restart. +#' +#' @template enforceModuleDependencies +#' #' @return #' Does not return anything. Is called for the side-effect of executing the specified #' analyses. @@ -40,7 +43,8 @@ execute <- function(analysisSpecifications, executionSettings, executionScriptFolder = NULL, keyringName = NULL, - restart = FALSE) { + restart = FALSE, + enforceModuleDependencies = TRUE) { errorMessages <- checkmate::makeAssertCollection() keyringList <- keyring::keyring_list() checkmate::assertClass(analysisSpecifications, "AnalysisSpecifications", add = errorMessages) @@ -98,7 +102,10 @@ execute <- function(analysisSpecifications, } # Validate the modules - modules <- ensureAllModulesInstantiated(analysisSpecifications) + modules <- ensureAllModulesInstantiated( + analysisSpecifications = analysisSpecifications, + enforceModuleDependencies = enforceModuleDependencies + ) if (isFALSE(modules$allModulesInstalled)) { stop("Stopping execution due to module issues") } diff --git a/R/ModuleEnv.R b/R/ModuleEnv.R index 87bb8b27..03139f36 100644 --- a/R/ModuleEnv.R +++ b/R/ModuleEnv.R @@ -36,7 +36,7 @@ #' Load module execution space inside and renv #' inspired by targets::tar_script but allowing custom variable execution #' -#' Designed to allow more human readable code that is executed inside a module as well as simple variable substituion +#' Designed to allow more human readable code that is executed inside a module as well as simple variable substitution #' for injecting constants (e.g. simple parameters or file paths used inside and outside of modules) #' #' This pattern also allows dependency injection which could be used if you don't want to use and renv and (instead) diff --git a/R/ModuleInstantiation.R b/R/ModuleInstantiation.R index 82ef3407..6aa6403d 100644 --- a/R/ModuleInstantiation.R +++ b/R/ModuleInstantiation.R @@ -31,13 +31,15 @@ #' #' @template forceVerification #' +#' @template enforceModuleDependencies +#' #' @return #' A list containing the install status of all modules #' (TRUE if all are installed properly) and a tibble listing #' the instantiated modules. #' #' @export -ensureAllModulesInstantiated <- function(analysisSpecifications, forceVerification = FALSE) { +ensureAllModulesInstantiated <- function(analysisSpecifications, forceVerification = FALSE, enforceModuleDependencies = TRUE) { modules <- getModuleTable(analysisSpecifications, distinct = TRUE) # Verify only one version per module: @@ -62,20 +64,12 @@ ensureAllModulesInstantiated <- function(analysisSpecifications, forceVerificati ) } - # Check required dependencies have been installed: - dependencies <- extractDependencies(modules) - missingDependencies <- dependencies %>% - filter(!dependsOn %in% modules$module) - if (nrow(missingDependencies) > 0) { - message <- paste( - c( - "Detected missing dependencies:", - sprintf("- Missing module '%s' required by module '%s'", missingDependencies$dependsOn, missingDependencies$module) - ), - collapse = "\n" - ) - stop(message) - } + # Check required dependencies have been declare in the specification + # unless the user has set enforceModuleDependencies == FALSE + checkModuleDependencies( + modules = modules, + enforceModuleDependencies = enforceModuleDependencies + ) # Verify all modules are properly installed moduleInstallStatus <- list() @@ -300,6 +294,88 @@ verifyModuleInstallation <- function(module, version, silent = FALSE, forceVerif ) } + +#' Install the latest release of a module +#' +#' @description +#' This function will call out to the OHDSI GitHub repo to find the latest +#' version of the module and attempt to install it. Only modules that are listed +#' in the `getModuleList()` function are allowed since it will have a known +#' GitHub location. +#' +#' @param moduleName The name of the module to install (i.e. "CohortGeneratorModule"). +#' This parameter must match a value found in the `module` column of `getModuleList()` +#' +#' @return +#' None - this function is called for its side effects +#' +#' @export +installLatestModule <- function(moduleName) { + assertModulesFolderSetting(x = Sys.getenv("INSTANTIATED_MODULES_FOLDER")) + instantiatedModulesFolder <- Sys.getenv("INSTANTIATED_MODULES_FOLDER") + # Verify that the user's GITHUB_PAT is set properly + # otherwise we may hit a rate limit + if (Sys.getenv("GITHUB_PAT") == "") { + stop("You must set your GITHUB_PAT to use this function. Please use the function `usethis::create_github_token()` and try again after restarting your R session.") + } + moduleList <- getModuleList() + if (isFALSE(moduleName %in% moduleList$module)) { + stop("Module: ", module, " not found in the list from Strategus::getModuleList().") + } + moduleDetails <- moduleList %>% + dplyr::filter(module == moduleName) + urlTemplate <- "https://api.%s/repos/%s/%s/releases/latest" + baseUrl <- sprintf(urlTemplate, moduleDetails$remoteRepo, moduleDetails$remoteUsername, moduleDetails$module) + req <- httr2::request(base_url = baseUrl) |> + httr2::req_headers( + "Authorization" = paste0("Bearer ", Sys.getenv("GITHUB_PAT")), + "X-GitHub-Api-Version" = "2022-11-28" + ) + response <- httr2::req_perform(req) + release <- jsonlite::fromJSON(httr2::resp_body_string(response)) + version <- gsub("v", "", release$tag_name, ignore.case = TRUE) + moduleFolder <- ensureModuleInstantiated( + module = moduleDetails$module, + version = version, + remoteRepo = moduleDetails$remoteRepo, + remoteUsername = moduleDetails$remoteUsername + ) + rlang::inform(paste0("Installed ", moduleName, " to ", moduleFolder)) +} + +extractDependencies <- function(modules) { + extractDependenciesSingleModule <- function(module) { + moduleFolder <- getModuleFolder(module$module, module$version) + metaData <- getModuleMetaData(moduleFolder) + dependencies <- tibble( + module = module$module, + dependsOn = as.character(metaData$Dependencies) + ) + return(dependencies) + } + dependencies <- lapply(split(modules, 1:nrow(modules)), extractDependenciesSingleModule) %>% + bind_rows() + return(dependencies) +} + +checkModuleDependencies <- function(modules, enforceModuleDependencies) { + # Check required dependencies have been declare in the specification + # unless the user has set enforceModuleDependencies == FALSE + dependencies <- extractDependencies(modules) + missingDependencies <- dependencies %>% + filter(!dependsOn %in% modules$module) + if (nrow(missingDependencies) > 0 && enforceModuleDependencies) { + message <- paste( + c( + "Detected missing dependencies:", + sprintf("- Missing module '%s' required by module '%s'", missingDependencies$dependsOn, missingDependencies$module) + ), + collapse = "\n" + ) + stop(message) + } +} + getModuleTable <- function(analysisSpecifications, distinct = FALSE) { modules <- lapply( analysisSpecifications$moduleSpecifications, @@ -320,21 +396,6 @@ getModuleTable <- function(analysisSpecifications, distinct = FALSE) { return(modules) } -extractDependencies <- function(modules) { - extractDependenciesSingleModule <- function(module) { - moduleFolder <- getModuleFolder(module$module, module$version) - metaData <- getModuleMetaData(moduleFolder) - dependencies <- tibble( - module = module$module, - dependsOn = as.character(metaData$Dependencies) - ) - return(dependencies) - } - dependencies <- lapply(split(modules, 1:nrow(modules)), extractDependenciesSingleModule) %>% - bind_rows() - return(dependencies) -} - getModuleMetaData <- function(moduleFolder) { jsonFileName <- file.path(moduleFolder, "MetaData.json") if (!file.exists(jsonFileName)) { diff --git a/R/ResultModelCreation.R b/R/ResultModelCreation.R index 8ff0f4fb..5c13455a 100644 --- a/R/ResultModelCreation.R +++ b/R/ResultModelCreation.R @@ -27,7 +27,8 @@ createResultDataModels <- function(analysisSpecifications, executionSettings, executionScriptFolder = NULL, keyringName = NULL, - restart = FALSE) { + restart = FALSE, + enforceModuleDependencies = TRUE) { errorMessages <- checkmate::makeAssertCollection() keyringList <- keyring::keyring_list() checkmate::assertClass(analysisSpecifications, "AnalysisSpecifications", add = errorMessages) @@ -35,7 +36,11 @@ createResultDataModels <- function(analysisSpecifications, checkmate::assertChoice(x = keyringName, choices = keyringList$keyring, null.ok = TRUE, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) - modules <- ensureAllModulesInstantiated(analysisSpecifications) + modules <- ensureAllModulesInstantiated( + analysisSpecifications = analysisSpecifications, + enforceModuleDependencies = enforceModuleDependencies + ) + if (isFALSE(modules$allModulesInstalled)) { stop("Stopping execution due to module issues") } @@ -203,8 +208,11 @@ runSchemaCreation <- function(analysisSpecifications, keyringSettings, moduleInd renv::use(lockfile = "renv.lock") } + ParallelLogger::addDefaultFileLogger(jobContext$moduleExecutionSettings$logFileName) ParallelLogger::addDefaultFileLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "log.txt")) ParallelLogger::addDefaultErrorReportLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "errorReportR.txt")) + + message("START SCHEMA CREATION: ", moduleName) # Main.R can override default behaviour by implementing this function if (is.function(createDataModelSchema)) { # If the keyring is locked, unlock it, set the value and then re-lock it @@ -239,6 +247,7 @@ runSchemaCreation <- function(analysisSpecifications, keyringSettings, moduleInd ) writeLines("specifications.not.written", doneFile) } + message("FINISH SCHEMA CREATION: ", moduleName) ParallelLogger::unregisterLogger("DEFAULT_FILE_LOGGER", silent = TRUE) ParallelLogger::unregisterLogger("DEFAULT_ERRORREPORT_LOGGER", silent = TRUE) @@ -248,6 +257,7 @@ runSchemaCreation <- function(analysisSpecifications, keyringSettings, moduleInd injectVars = list( jobContextFileName = jobContextFileName, dataModelExportPath = dataModelExportPath, + moduleName = module, doneFile = doneFile ) ) diff --git a/R/ResultsUpload.R b/R/ResultsUpload.R index 9bd5f8de..ece4ec07 100644 --- a/R/ResultsUpload.R +++ b/R/ResultsUpload.R @@ -58,6 +58,8 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde } tempScriptFile <- file.path(moduleExecutionSettings$workSubFolder, "UploadScript.R") + ParallelLogger::addDefaultFileLogger(jobContext$moduleExecutionSettings$logFileName) + on.exit(ParallelLogger::unregisterLogger("DEFAULT_FILE_LOGGER", silent = TRUE)) ## # Module space executed code @@ -68,9 +70,10 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde getDataModelSpecifications <- function(...) { ParallelLogger::logInfo("Getting result model specification") - if (file.exists("resultsDataModelSpecification.csv")) { + rdmsFilePath <- file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "resultsDataModelSpecification.csv") + if (file.exists(rdmsFilePath)) { res <- CohortGenerator::readCsv( - file = "resultsDataModelSpecification.csv" + file = rdmsFilePath ) return(res) } @@ -81,6 +84,8 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde moduleInfo <- ParallelLogger::loadSettingsFromJson("MetaData.json") jobContext <- readRDS(jobContextFileName) specifications <- getDataModelSpecifications(jobContext) + + ParallelLogger::addDefaultFileLogger(jobContext$moduleExecutionSettings$logFileName) ParallelLogger::addDefaultFileLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "log.txt")) ParallelLogger::addDefaultErrorReportLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "errorReportR.txt")) @@ -88,6 +93,7 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde renv::use(lockfile = "renv.lock") } + message("START MODULE RESULTS UPLOAD: ", moduleName) # Override default behaviour and do module specific upload inside module context? if (is.function(uploadResultsCallback)) { ParallelLogger::logInfo("Calling module result upload functionality") @@ -122,6 +128,7 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde writeLines("specifications.written", doneFile) } + message("FINISH MODULE RESULTS UPLOAD: ", moduleName) ParallelLogger::unregisterLogger("DEFAULT_FILE_LOGGER", silent = TRUE) ParallelLogger::unregisterLogger("DEFAULT_ERRORREPORT_LOGGER", silent = TRUE) }, @@ -130,6 +137,7 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde injectVars = list( jobContextFileName = jobContextFileName, dataModelExportPath = dataModelExportPath, + moduleName = module, doneFile = doneFile ) ) @@ -149,34 +157,32 @@ runResultsUpload <- function(analysisSpecifications, keyringSettings, moduleInde workStatus <- readLines(doneFile) if (workStatus == "specifications.written") { - ParallelLogger::logInfo("Uploading results according to module specification") + message("Uploading results according to module specification") specifications <- CohortGenerator::readCsv(dataModelExportPath) - moduleInfo <- ParallelLogger::loadSettingsFromJson(file.path(moduleFolder, "MetaData.json")) keyringName <- jobContext$keyringSettings$keyringName keyringLocked <- Strategus::unlockKeyring(keyringName = keyringName) - ParallelLogger::logInfo("Getting result database credentials") + message("Getting result database credentials") resultsConnectionDetails <- keyring::key_get(jobContext$moduleExecutionSettings$resultsConnectionDetailsReference, keyring = keyringName) resultsConnectionDetails <- ParallelLogger::convertJsonToSettings(resultsConnectionDetails) resultsConnectionDetails <- do.call(DatabaseConnector::createConnectionDetails, resultsConnectionDetails) jobContext$moduleExecutionSettings$resultsConnectionDetails <- resultsConnectionDetails - ParallelLogger::logInfo("Calling RMM for upload") + message("Calling RMM for upload") ResultModelManager::uploadResults( connectionDetails = jobContext$moduleExecutionSettings$resultsConnectionDetails, schema = jobContext$moduleExecutionSettings$resultsDatabaseSchema, resultsFolder = jobContext$moduleExecutionSettings$resultsSubFolder, - tablePrefix = moduleInfo$TablePrefix, forceOverWriteOfSpecifications = FALSE, purgeSiteDataBeforeUploading = FALSE, - databaseIdentifierFile = "database_meta_data.csv", + databaseIdentifierFile = file.path(executionSettings$resultsFolder, "DatabaseMetaData", "database_meta_data.csv"), runCheckAndFixCommands = FALSE, warnOnMissingTable = TRUE, specifications = specifications ) - ParallelLogger::logInfo("Upload completed") + message("Upload completed") if (keyringLocked) { keyring::keyring_lock(keyring = keyringName) } diff --git a/R/RunModule.R b/R/RunModule.R index 7485efc3..5aebcfa1 100644 --- a/R/RunModule.R +++ b/R/RunModule.R @@ -79,6 +79,7 @@ runModule <- function(analysisSpecifications, keyringSettings, moduleIndex, exec # unlockKeyring will be injected automatically keyringLocked <- unlockKeyring(keyringName = keyringName) + ParallelLogger::addDefaultFileLogger(jobContext$moduleExecutionSettings$logFileName) ParallelLogger::addDefaultFileLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "log.txt")) ParallelLogger::addDefaultErrorReportLogger(file.path(jobContext$moduleExecutionSettings$resultsSubFolder, "errorReport.R")) @@ -109,7 +110,9 @@ runModule <- function(analysisSpecifications, keyringSettings, moduleIndex, exec if (keyringLocked) { keyring::keyring_lock(keyring = keyringName) } + message("START MODULE RUN: ", moduleName) execute(jobContext) + message("FINISH MODULE RUN: ", moduleName) ParallelLogger::unregisterLogger("DEFAULT_FILE_LOGGER", silent = TRUE) ParallelLogger::unregisterLogger("DEFAULT_ERRORREPORT_LOGGER", silent = TRUE) @@ -120,7 +123,8 @@ runModule <- function(analysisSpecifications, keyringSettings, moduleIndex, exec injectVars = list( doneFile = doneFile, isCdmExecution = isCdmExecution, - jobContextFileName = jobContextFileName + jobContextFileName = jobContextFileName, + moduleName = module ) ) diff --git a/R/Settings.R b/R/Settings.R index e3463f36..5503d098 100644 --- a/R/Settings.R +++ b/R/Settings.R @@ -90,6 +90,7 @@ addModuleSpecifications <- function(analysisSpecifications, moduleSpecifications #' @param tempEmulationSchema Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created. #' @param workFolder A folder in the local file system where intermediate results can be written. #' @param resultsFolder A folder in the local file system where the module output will be written. +#' @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 integerAsNumeric Logical: should 32-bit integers be converted to numeric (double) values? If FALSE 32-bit integers will be represented using R's native `Integer` class. Default is TRUE @@ -109,6 +110,7 @@ createCdmExecutionSettings <- function(connectionDetailsReference, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE), @@ -121,6 +123,7 @@ createCdmExecutionSettings <- function(connectionDetailsReference, checkmate::assertList(cohortTableNames, add = errorMessages) checkmate::assertCharacter(workFolder, len = 1, add = errorMessages) checkmate::assertCharacter(resultsFolder, len = 1, add = errorMessages) + checkmate::assertCharacter(logFileName, len = 1, add = errorMessages) checkmate::assertInt(minCellCount, add = errorMessages) checkmate::assertLogical(integerAsNumeric, max.len = 1, add = errorMessages) checkmate::assertLogical(integer64AsNumeric, max.len = 1, add = errorMessages) @@ -131,6 +134,7 @@ createCdmExecutionSettings <- function(connectionDetailsReference, # Normalize paths to convert relative paths to absolute paths workFolder <- normalizePath(workFolder, mustWork = F) resultsFolder <- normalizePath(resultsFolder, mustWork = F) + logFileName <- normalizePath(logFileName, mustWork = F) executionSettings <- list( connectionDetailsReference = connectionDetailsReference, @@ -140,6 +144,7 @@ createCdmExecutionSettings <- function(connectionDetailsReference, tempEmulationSchema = tempEmulationSchema, workFolder = workFolder, resultsFolder = resultsFolder, + logFileName = logFileName, minCellCount = minCellCount, integerAsNumeric = integerAsNumeric, integer64AsNumeric = integer64AsNumeric, @@ -157,6 +162,7 @@ createCdmExecutionSettings <- function(connectionDetailsReference, #' @param resultsDatabaseSchema A schema where the results tables are stored #' @param workFolder A folder in the local file system where intermediate results can be written. #' @param resultsFolder A folder in the local file system where the module output will be written. +#' @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 integerAsNumeric Logical: should 32-bit integers be converted to numeric (double) values? If FALSE 32-bit integers will be represented using R's native `Integer` class. Default is TRUE @@ -170,6 +176,7 @@ createResultsExecutionSettings <- function(resultsConnectionDetailsReference, resultsDatabaseSchema, workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE)) { @@ -178,6 +185,7 @@ createResultsExecutionSettings <- function(resultsConnectionDetailsReference, checkmate::assertCharacter(resultsDatabaseSchema, len = 1, add = errorMessages) checkmate::assertCharacter(workFolder, len = 1, add = errorMessages) checkmate::assertCharacter(resultsFolder, len = 1, add = errorMessages) + checkmate::assertCharacter(logFileName, len = 1, add = errorMessages) checkmate::assertInt(minCellCount, add = errorMessages) checkmate::assertLogical(integerAsNumeric, max.len = 1, add = errorMessages) checkmate::assertLogical(integer64AsNumeric, max.len = 1, add = errorMessages) @@ -186,12 +194,14 @@ createResultsExecutionSettings <- function(resultsConnectionDetailsReference, # Normalize paths to convert relative paths to absolute paths workFolder <- normalizePath(workFolder, mustWork = F) resultsFolder <- normalizePath(resultsFolder, mustWork = F) + logFileName <- normalizePath(logFileName, mustWork = F) executionSettings <- list( resultsConnectionDetailsReference = resultsConnectionDetailsReference, resultsDatabaseSchema = resultsDatabaseSchema, workFolder = workFolder, resultsFolder = resultsFolder, + logFileName = logFileName, minCellCount = minCellCount, integerAsNumeric = integerAsNumeric, integer64AsNumeric = integer64AsNumeric diff --git a/R/ShareResults.R b/R/ShareResults.R new file mode 100644 index 00000000..d6f1da9a --- /dev/null +++ b/R/ShareResults.R @@ -0,0 +1,32 @@ +#' Create a zip file with all study results for sharing with study coordinator +#' +#' @details +#' Creates a `.zip` file of the `.csv` files found in the +#' `resultsFolder`. The resulting `.zip` file will have +#' relative paths to the root of the `resultsFolder` +#' which is generally found in `executionSettings$resultsFolder`. +#' +#' @param resultsFolder The folder holding the study results. This is found in +#' `executionSettings$resultsFolder`. +#' +#' @param zipFile The path to the zip file to be created. +#' +#' @return +#' Does not return anything. Is called for the side-effect of creating the +#' zip file with results. +#' +#' @export +zipResults <- function(resultsFolder, zipFile) { + files <- list.files( + path = resultsFolder, + pattern = "\\.csv$", + recursive = TRUE, + full.names = TRUE + ) + DatabaseConnector::createZipFile( + zipFile = zipFile, + files = files, + rootFolder = resultsFolder + ) + message(zipFile, " created.") +} diff --git a/docs/404.html b/docs/404.html index 428362fd..a68b54eb 100644 --- a/docs/404.html +++ b/docs/404.html @@ -6,7 +6,7 @@ Page not found (404) • Strategus - + @@ -32,7 +32,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -112,7 +112,7 @@

Page not found (404)

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/articles/CreatingAnalysisSpecification.html b/docs/articles/CreatingAnalysisSpecification.html index cab08ea9..e2cef9fa 100644 --- a/docs/articles/CreatingAnalysisSpecification.html +++ b/docs/articles/CreatingAnalysisSpecification.html @@ -6,7 +6,7 @@ Creating Analysis Specification • Strategus - + @@ -33,7 +33,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -94,7 +94,7 @@

Creating Analysis Specification

Anthony G. Sena

-

2024-01-29

+

2024-06-04

Source: vignettes/CreatingAnalysisSpecification.Rmd @@ -120,12 +120,12 @@

Setting up your R environment
 # Install correct versions of HADES packages
-remotes::install_github("ohdsi/CohortGenerator", ref = "v0.8.1")
+remotes::install_github("ohdsi/CohortGenerator", ref = "v0.9.0")
 remotes::install_github("ohdsi/CohortDiagnostics", ref = "v3.2.5")
-remotes::install_github("ohdsi/Characterization", ref = "v0.1.3")
+remotes::install_github("ohdsi/Characterization", ref = "v0.2.0")
 remotes::install_github("ohdsi/CohortIncidence", ref = "v3.3.0")
-remotes::install_github("ohdsi/CohortMethod", ref = "v5.2.0")
-remotes::install_github("ohdsi/SelfControlledCaseSeries", ref = "v5.1.1")
+remotes::install_github("ohdsi/CohortMethod", ref = "v5.3.0")
+remotes::install_github("ohdsi/SelfControlledCaseSeries", ref = "v5.2.0")
 remotes::install_github("ohdsi/PatientLevelPrediction", ref = "v6.3.6")
@@ -190,7 +190,7 @@

CohortGenerator Module SettingscohortGeneratorModuleSpecifications function to specify the cohort generation settings.

-source("https://raw.githubusercontent.com/OHDSI/CohortGeneratorModule/v0.3.0/SettingsFunctions.R")
+source("https://raw.githubusercontent.com/OHDSI/CohortGeneratorModule/v0.4.1/SettingsFunctions.R")
 
 # Create the cohort definition shared resource element for the analysis specification
 cohortDefinitionSharedResource <- createCohortSharedResourceSpecifications(
@@ -238,7 +238,7 @@ 

CohortIncidence Module SettingscohortIncidenceModuleSpecifications to perform an incidence rate analysis for the target cohorts and outcome in this study.

-source("https://raw.githubusercontent.com/OHDSI/CohortIncidenceModule/v0.4.0/SettingsFunctions.R")
+source("https://raw.githubusercontent.com/OHDSI/CohortIncidenceModule/v0.4.1/SettingsFunctions.R")
 library(CohortIncidence)
 targets <- list(
   createCohortRef(id = 1, name = "Celecoxib"),
@@ -281,7 +281,7 @@ 

Characterization Module Settings
-source("https://raw.githubusercontent.com/OHDSI/CharacterizationModule/v0.5.0/SettingsFunctions.R")
+source("https://raw.githubusercontent.com/OHDSI/CharacterizationModule/v0.6.0/SettingsFunctions.R")
 characterizationModuleSpecifications <- createCharacterizationModuleSpecifications(
   targetIds = c(1, 2),
   outcomeIds = 3,
@@ -304,7 +304,7 @@ 

CohortMethod Module Settings
 library(CohortMethod)
-source("https://raw.githubusercontent.com/OHDSI/CohortMethodModule/v0.3.0/SettingsFunctions.R")
+source("https://raw.githubusercontent.com/OHDSI/CohortMethodModule/v0.3.1/SettingsFunctions.R")
 negativeControlOutcomes <- lapply(
   X = ncoCohortSet$cohortId,
   FUN = createOutcome,
@@ -407,7 +407,7 @@ 

SelfControlledCaseSeries Modul cohort analysis for this study.

 library(SelfControlledCaseSeries)
-source("https://raw.githubusercontent.com/OHDSI/SelfControlledCaseSeriesModule/v0.4.1/SettingsFunctions.R")
+source("https://raw.githubusercontent.com/OHDSI/SelfControlledCaseSeriesModule/v0.5.0/SettingsFunctions.R")
 
 # Exposures-outcomes -----------------------------------------------------------
 negativeControlOutcomeIds <- ncoCohortSet$cohortId
@@ -602,7 +602,7 @@ 

Strategus Analysis Specifications

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/articles/CreatingModules.html b/docs/articles/CreatingModules.html index 2c30932e..6aa95ae1 100644 --- a/docs/articles/CreatingModules.html +++ b/docs/articles/CreatingModules.html @@ -6,7 +6,7 @@ Creating Strategus Modules • Strategus - + @@ -33,7 +33,7 @@ Strategus - 0.2.1 + 0.3.0

@@ -94,7 +94,7 @@

Creating Strategus Modules

Anthony G. Sena

-

2024-01-29

+

2024-06-04

Source: vignettes/CreatingModules.Rmd @@ -419,7 +419,7 @@

Test Files

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/articles/ExecuteStrategus.html b/docs/articles/ExecuteStrategus.html index db42432b..0907a48f 100644 --- a/docs/articles/ExecuteStrategus.html +++ b/docs/articles/ExecuteStrategus.html @@ -6,7 +6,7 @@ Execute Strategus • Strategus - + @@ -33,7 +33,7 @@ Strategus - 0.2.1 + 0.3.0

@@ -94,7 +94,7 @@

Execute Strategus

Anthony G. Sena

-

2024-01-29

+

2024-06-04

Source: vignettes/ExecuteStrategus.Rmd @@ -142,10 +142,12 @@

Storing the connection detailsconnectionDetails <- Eunomia::getEunomiaConnectionDetails( databaseFile = file.path(outputFolder, "cdm.sqlite") )

+
## attempting to download GiBleed
+
## attempting to extract and load: D:/eunomiaData/GiBleed_5.3.zip to: D:/eunomiaData/GiBleed_5.3.sqlite

Next we will use Strategus to store the connection details and provide a connectionDetailsReference that Strategus will use to look up the connection details.

-
+
 storeConnectionDetails(
   connectionDetails = connectionDetails,
   connectionDetailsReference = "eunomia"
@@ -159,7 +161,7 @@ 

Creating an execution settings ob

Next, we will use Strategus to create the CDM execution settings. The connectionDetailsReference refers to the connection details we stored earlier:

-
+
 executionSettings <- createCdmExecutionSettings(
   connectionDetailsReference = "eunomia",
   workDatabaseSchema = "main",
@@ -171,7 +173,7 @@ 

Creating an execution settings ob )

Finally, we can write out the execution settings to the file system to capture this information.

-
+
 ParallelLogger::saveSettingsToJson(
   object = executionSettings,
   file.path(outputFolder, "eunomiaExecutionSettings.json")
@@ -191,7 +193,7 @@ 

Specifying the instantiated time-consuming task. We must specify a global location where these modules will be instantiated so that, once a module is instantiated, it can be used in all future studies:

-
+
 Sys.setenv("INSTANTIATED_MODULES_FOLDER" = "c:/strategus/modules")

We recommend adding this environmental variable to your .renviron file, so it is always set.

@@ -201,7 +203,7 @@

Running the study
+
 analysisSpecifications <- ParallelLogger::loadSettingsFromJson(
   fileName = system.file("testdata/analysisSpecification.json",
     package = "Strategus"
@@ -212,7 +214,7 @@ 

Running the study= file.path(outputFolder, "eunomiaExecutionSettings.json") )

And finally we execute the study:

-
+
 execute(
   analysisSpecifications = analysisSpecifications,
   executionSettings = executionSettings,
@@ -244,7 +246,7 @@ 

Running the study

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/articles/IntroductionToStrategus.html b/docs/articles/IntroductionToStrategus.html index 4ae1a497..03e69b9f 100644 --- a/docs/articles/IntroductionToStrategus.html +++ b/docs/articles/IntroductionToStrategus.html @@ -6,7 +6,7 @@ Introduction to Strategus • Strategus - + @@ -33,7 +33,7 @@ Strategus - 0.2.1 + 0.3.0
@@ -94,7 +94,7 @@

Introduction to Strategus

Anthony G. Sena

-

2024-01-29

+

2024-06-04

Source: vignettes/IntroductionToStrategus.Rmd @@ -173,7 +173,7 @@

What is a HADES module?

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/articles/index.html b/docs/articles/index.html index fa6455b2..c537728a 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,5 +1,5 @@ -Articles • StrategusArticles • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0

@@ -90,7 +90,7 @@

All vignettes

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/authors.html b/docs/authors.html index 424de98e..95108baa 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,5 +1,5 @@ -Authors and Citation • StrategusAuthors and Citation • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0

@@ -66,7 +66,7 @@
@@ -117,7 +117,7 @@

Citation

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/index.html b/docs/index.html index 1f07ab80..1d214a67 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ Coordinating and Executing Analytics Using HADES Modules • Strategus - + @@ -33,7 +33,7 @@ Strategus - 0.2.1 + 0.3.0
@@ -224,7 +224,7 @@

Developers

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/news/index.html b/docs/news/index.html index edefda43..6d16928e 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -1,5 +1,5 @@ -Changelog • StrategusChangelog • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -69,6 +69,13 @@

Changelog

Source: NEWS.md +
+ +
  • Provide option to skip modules (#87)
  • +
  • Central log file for execution (#132)
  • +
  • Create function to collect all results into a single ZIP file for sharing (#46)
  • +
  • Install latest modules (#125)
  • +
  • Update SelfControlledCaseSeries Module to v0.4.1
  • @@ -150,7 +157,7 @@
-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index d66c1d42..2b21a248 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,10 +1,10 @@ -pandoc: 3.1.1 -pkgdown: 2.0.7 +pandoc: 3.1.11 +pkgdown: 2.0.9 pkgdown_sha: ~ articles: CreatingAnalysisSpecification: CreatingAnalysisSpecification.html CreatingModules: CreatingModules.html ExecuteStrategus: ExecuteStrategus.html IntroductionToStrategus: IntroductionToStrategus.html -last_built: 2024-01-29T15:41Z +last_built: 2024-06-04T21:18Z diff --git a/docs/reference/Strategus-package.html b/docs/reference/Strategus-package.html index f355a44b..9197d743 100644 --- a/docs/reference/Strategus-package.html +++ b/docs/reference/Strategus-package.html @@ -1,5 +1,5 @@ -Strategus: Coordinating and Executing Analytics Using HADES Modules — Strategus-package • StrategusStrategus: Coordinating and Executing Analytics Using HADES Modules — Strategus-package • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -102,7 +102,7 @@

Author

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/addModuleSpecifications.html b/docs/reference/addModuleSpecifications.html index 9427df29..27bf3b31 100644 --- a/docs/reference/addModuleSpecifications.html +++ b/docs/reference/addModuleSpecifications.html @@ -1,5 +1,5 @@ -Add module specifications to analysis specifications — addModuleSpecifications • StrategusAdd module specifications to analysis specifications — addModuleSpecifications • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -108,7 +108,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/addSharedResources.html b/docs/reference/addSharedResources.html index 31dc58c4..14c5998c 100644 --- a/docs/reference/addSharedResources.html +++ b/docs/reference/addSharedResources.html @@ -1,5 +1,5 @@ -Add shared resources to analysis specifications — addSharedResources • StrategusAdd shared resources to analysis specifications — addSharedResources • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -108,7 +108,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/compareLockFiles.html b/docs/reference/compareLockFiles.html index 75a281f1..ecb363ca 100644 --- a/docs/reference/compareLockFiles.html +++ b/docs/reference/compareLockFiles.html @@ -1,5 +1,5 @@ -Compare two renv.lock files — compareLockFiles • StrategusCreate CDM execution settings — createCdmExecutionSettings • StrategusCreate CDM execution settings — createCdmExecutionSettings • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -83,6 +83,7 @@

Create CDM execution settings

tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE), @@ -126,6 +127,10 @@

Arguments

A folder in the local file system where the module output will be written.

+
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

+ +
minCellCount

The minimum number of subjects contributing to a count before it can be included in results.

@@ -167,7 +172,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/createEmptyAnalysisSpecificiations.html b/docs/reference/createEmptyAnalysisSpecificiations.html index fe812331..10fbe085 100644 --- a/docs/reference/createEmptyAnalysisSpecificiations.html +++ b/docs/reference/createEmptyAnalysisSpecificiations.html @@ -1,5 +1,5 @@ -Create an empty analysis specifications object. — createEmptyAnalysisSpecificiations • StrategusCreate an empty analysis specifications object. — createEmptyAnalysisSpecificiations • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -97,7 +97,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/createResultDataModels.html b/docs/reference/createResultDataModels.html index 8e129216..a2563a20 100644 --- a/docs/reference/createResultDataModels.html +++ b/docs/reference/createResultDataModels.html @@ -1,5 +1,5 @@ -Create Result Data Models — createResultDataModels • StrategusCreate Result Data Models — createResultDataModels • StrategusCreate Results execution settings — createResultsExecutionSettings • StrategusCreate Results execution settings — createResultsExecutionSettings • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -80,6 +80,7 @@

Create Results execution settings

resultsDatabaseSchema, workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE) @@ -105,6 +106,10 @@

Arguments

A folder in the local file system where the module output will be written.

+
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

+ +
minCellCount

The minimum number of subjects contributing to a count before it can be included in results.

@@ -137,7 +142,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/dot-nullList.html b/docs/reference/dot-nullList.html index a3723d15..4aa0444f 100644 --- a/docs/reference/dot-nullList.html +++ b/docs/reference/dot-nullList.html @@ -1,5 +1,5 @@ -Used when serializing connection details to retain NULL values — .nullList • StrategusUsed when serializing connection details to retain NULL values — .nullList • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -91,7 +91,7 @@

Used when serializing connection details to retain NULL values

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/ensureAllModulesInstantiated.html b/docs/reference/ensureAllModulesInstantiated.html index 2357de98..1002ff06 100644 --- a/docs/reference/ensureAllModulesInstantiated.html +++ b/docs/reference/ensureAllModulesInstantiated.html @@ -1,5 +1,5 @@ -Ensure all modules are instantiated — ensureAllModulesInstantiated • StrategusEnsure all modules are instantiated — ensureAllModulesInstantiated • Strategus Strategus - 0.2.1 + 0.3.0 @@ -87,7 +87,11 @@

Ensure all modules are instantiated

-
ensureAllModulesInstantiated(analysisSpecifications, forceVerification = FALSE)
+
ensureAllModulesInstantiated(
+  analysisSpecifications,
+  forceVerification = FALSE,
+  enforceModuleDependencies = TRUE
+)
@@ -104,6 +108,17 @@

Arguments

the hash value of the module's renv.lock file in the file system so it can by-pass running this check every time.

+ +
enforceModuleDependencies
+

When set to TRUE, Strategus will enforce +module dependencies that are declared by each module. For example, the +CohortDiagnostics module declares a dependency on the CohortGenerator module +and Strategus will require that an analysis specification declare that both +modules must exist in order to execute the analysis. When set to FALSE, +Strategus will not enforce these module dependencies which assumes you have +properly run all module dependencies yourself. Setting this to FALSE is not +recommended since it is potentially unsafe.

+

Value

@@ -126,7 +141,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/execute.html b/docs/reference/execute.html index 1c52a8d2..add3fed6 100644 --- a/docs/reference/execute.html +++ b/docs/reference/execute.html @@ -1,5 +1,5 @@ -Execute analysis specifications. — execute • StrategusExecute analysis specifications. — execute • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -80,7 +80,8 @@

Execute analysis specifications.

executionSettings, executionScriptFolder = NULL, keyringName = NULL, - restart = FALSE + restart = FALSE, + enforceModuleDependencies = TRUE )
@@ -115,6 +116,17 @@

Arguments

Restart run? Requires executionScriptFolder to be specified, and be the same as the executionScriptFolder used in the run to restart.

+ +
enforceModuleDependencies
+

When set to TRUE, Strategus will enforce +module dependencies that are declared by each module. For example, the +CohortDiagnostics module declares a dependency on the CohortGenerator module +and Strategus will require that an analysis specification declare that both +modules must exist in order to execute the analysis. When set to FALSE, +Strategus will not enforce these module dependencies which assumes you have +properly run all module dependencies yourself. Setting this to FALSE is not +recommended since it is potentially unsafe.

+

Value

@@ -136,7 +148,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/getModuleList.html b/docs/reference/getModuleList.html index 06108bae..85ac4375 100644 --- a/docs/reference/getModuleList.html +++ b/docs/reference/getModuleList.html @@ -1,5 +1,5 @@ -Provides a list of HADES modules to run through Strategus — getModuleList • StrategusProvides a list of HADES modules to run through Strategus — getModuleList • StrategusFunction reference • StrategusFunction reference • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -112,6 +112,10 @@

All functions getModuleList()

Provides a list of HADES modules to run through Strategus

+ +

installLatestModule()

+ +

Install the latest release of a module

retrieveConnectionDetails()

@@ -127,8 +131,7 @@

All functions

syncLockFile()

-

Synchronize renv.lock files and overwrite the target file -(read the description)

+

Synchronize renv.lock files and overwrite the target file (read the description)

unlockKeyring()

@@ -144,8 +147,11 @@

All functions

withModuleRenv()

-

Load module execution space inside and renv -inspired by targets::tar_script but allowing custom variable execution

+

Load module execution space inside and renv inspired by targets::tar_script but allowing custom variable execution

+ +

zipResults()

+ +

Create a zip file with all study results for sharing with study coordinator

diff --git a/docs/reference/installLatestModule.html b/docs/reference/installLatestModule.html new file mode 100644 index 00000000..7d1634fe --- /dev/null +++ b/docs/reference/installLatestModule.html @@ -0,0 +1,124 @@ + +Install the latest release of a module — installLatestModule • Strategus + + +
+
+ + + +
+
+ + +
+

This function will call out to the OHDSI GitHub repo to find the latest +version of the module and attempt to install it. Only modules that are listed +in the getModuleList() function are allowed since it will have a known +GitHub location.

+
+ +
+
installLatestModule(moduleName)
+
+ +
+

Arguments

+
moduleName
+

The name of the module to install (i.e. "CohortGeneratorModule"). +This parameter must match a value found in the module column of getModuleList()

+ +
+
+

Value

+ + +

None - this function is called for its side effects

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.9.

+
+ +
+ + + + + + + + diff --git a/docs/reference/lockFileToDataFrame.html b/docs/reference/lockFileToDataFrame.html index ac0bd68c..e77aaffa 100644 --- a/docs/reference/lockFileToDataFrame.html +++ b/docs/reference/lockFileToDataFrame.html @@ -1,5 +1,5 @@ -Convert a lock file to a data.frame — lockFileToDataFrame • StrategusConvert a lock file to a data.frame — lockFileToDataFrame • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -91,7 +91,7 @@

Convert a lock file to a data.frame

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/mandatoryPackages.html b/docs/reference/mandatoryPackages.html index 1e1b96d5..c3a909c8 100644 --- a/docs/reference/mandatoryPackages.html +++ b/docs/reference/mandatoryPackages.html @@ -1,5 +1,5 @@ -List of mandatory packages for a Strategus module — mandatoryPackages • StrategusList of mandatory packages for a Strategus module — mandatoryPackages • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -91,7 +91,7 @@

List of mandatory packages for a Strategus module

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/retrieveConnectionDetails.html b/docs/reference/retrieveConnectionDetails.html index fabb17c4..56432e61 100644 --- a/docs/reference/retrieveConnectionDetails.html +++ b/docs/reference/retrieveConnectionDetails.html @@ -1,5 +1,5 @@ -Retrieve connection details from the secure location — retrieveConnectionDetails • StrategusRetrieve connection details from the secure location — retrieveConnectionDetails • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -117,7 +117,7 @@

See also

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/runSchemaCreation.html b/docs/reference/runSchemaCreation.html index 9c8ff327..46d5973d 100644 --- a/docs/reference/runSchemaCreation.html +++ b/docs/reference/runSchemaCreation.html @@ -1,5 +1,5 @@ -Create module(s) result data model — runSchemaCreation • StrategusCreate module(s) result data model — runSchemaCreation • Strategus Strategus - 0.2.1 + 0.3.0 @@ -131,7 +131,7 @@

Arguments

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/storeConnectionDetails.html b/docs/reference/storeConnectionDetails.html index 2d99b7ab..1ae81fc6 100644 --- a/docs/reference/storeConnectionDetails.html +++ b/docs/reference/storeConnectionDetails.html @@ -1,5 +1,5 @@ -Store connection details in a secure location — storeConnectionDetails • StrategusStore connection details in a secure location — storeConnectionDetails • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -127,7 +127,7 @@

See also

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/suggestedPacakges.html b/docs/reference/suggestedPacakges.html index c8bc036a..7168ba3e 100644 --- a/docs/reference/suggestedPacakges.html +++ b/docs/reference/suggestedPacakges.html @@ -1,5 +1,5 @@ -List of suggested packages for a Strategus module — suggestedPacakges • StrategusList of suggested packages for a Strategus module — suggestedPacakges • Strategus @@ -17,7 +17,7 @@ Strategus - 0.2.1 + 0.3.0 @@ -91,7 +91,7 @@

List of suggested packages for a Strategus module

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/syncLockFile.html b/docs/reference/syncLockFile.html index 215adc23..bf88a5fe 100644 --- a/docs/reference/syncLockFile.html +++ b/docs/reference/syncLockFile.html @@ -1,7 +1,5 @@ -Synchronize renv.lock files and overwrite the target file -(read the description) — syncLockFile • Strategus Strategus - 0.2.1 + 0.3.0 @@ -74,8 +72,7 @@
@@ -127,7 +124,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/unlockKeyring.html b/docs/reference/unlockKeyring.html index 53d8d979..ac620664 100644 --- a/docs/reference/unlockKeyring.html +++ b/docs/reference/unlockKeyring.html @@ -1,5 +1,5 @@ -Helper function to unlock a keyring — unlockKeyring • StrategusValidate an renv.lock file to ensure it is ready for use by Strategus — validateLockFile • StrategusValidate an renv.lock file to ensure it is ready for use by Strategus — validateLockFile • StrategusVerify a module is properly installed — verifyModuleInstallation • StrategusVerify a module is properly installed — verifyModuleInstallation • Strategus Strategus - 0.2.1 + 0.3.0 @@ -148,7 +148,7 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.

diff --git a/docs/reference/withModuleRenv.html b/docs/reference/withModuleRenv.html index af426614..ef2dd7a6 100644 --- a/docs/reference/withModuleRenv.html +++ b/docs/reference/withModuleRenv.html @@ -1,7 +1,5 @@ -Load module execution space inside and renv -inspired by targets::tar_script but allowing custom variable execution — withModuleRenv • StrategusLoad module execution space inside and renv inspired by targets::tar_script but allowing custom variable execution — withModuleRenv • StrategusCreate a zip file with all study results for sharing with study coordinator — zipResults • Strategus + + +
+
+ + + +
+
+ + +
+

Create a zip file with all study results for sharing with study coordinator

+
+ +
+
zipResults(resultsFolder, zipFile)
+
+ +
+

Arguments

+
resultsFolder
+

The folder holding the study results. This is found in +executionSettings$resultsFolder.

+ + +
zipFile
+

The path to the zip file to be created.

+ +
+
+

Value

+ + +

Does not return anything. Is called for the side-effect of creating the +zip file with results.

+
+
+

Details

+

Creates a .zip file of the .csv files found in the +resultsFolder. The resulting .zip file will have +relative paths to the root of the resultsFolder +which is generally found in executionSettings$resultsFolder.

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.9.

+
+ +
+ + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index b7a53311..1ccb0285 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -69,6 +69,9 @@ /reference/index.html + + /reference/installLatestModule.html + /reference/lockFileToDataFrame.html @@ -105,4 +108,7 @@ /reference/withModuleRenv.html + + /reference/zipResults.html + diff --git a/extras/PackageMaintenance.R b/extras/PackageMaintenance.R index 60ebf2ca..0e911d14 100644 --- a/extras/PackageMaintenance.R +++ b/extras/PackageMaintenance.R @@ -39,7 +39,11 @@ updateModuleVersionInfo <- function() { # Get latest module versions --------------------------------------------------- getLatestModuleVersion <- function(remoteRepo, remoteUsername, module) { urlTemplate <- "https://api.%s/repos/%s/%s/releases/latest" - release <- jsonlite::fromJSON(sprintf(urlTemplate, remoteRepo, remoteUsername, module)) + req <- httr2::request(base_url = sprintf(urlTemplate, remoteRepo, remoteUsername, module)) |> + httr2::req_headers("Authorization" = paste0("Bearer ", Sys.getenv("GITHUB_PAT")), + "X-GitHub-Api-Version" = "2022-11-28") + response <- httr2::req_perform(req) + release <- jsonlite::fromJSON(httr2::resp_body_string(response)) return(release$tag_name) } versions <- tibble::tibble( diff --git a/extras/Strategus.pdf b/extras/Strategus.pdf index 6fd84273..577e1b96 100644 Binary files a/extras/Strategus.pdf and b/extras/Strategus.pdf differ diff --git a/inst/csv/modules.csv b/inst/csv/modules.csv index 3324247a..7b43cd44 100644 --- a/inst/csv/modules.csv +++ b/inst/csv/modules.csv @@ -1,9 +1,9 @@ module,version,remote_repo,remote_username,module_type,main_package,main_package_tag -CharacterizationModule,v0.5.0,github.com,OHDSI,cdm,Characterization,v0.1.3 +CharacterizationModule,v0.6.0,github.com,OHDSI,cdm,Characterization,v0.2.0 CohortDiagnosticsModule,v0.2.0,github.com,OHDSI,cdm,CohortDiagnostics,v3.2.5 -CohortGeneratorModule,v0.3.0,github.com,OHDSI,cdm,CohortGenerator,v0.8.1 -CohortIncidenceModule,v0.4.0,github.com,OHDSI,cdm,CohortIncidence,v3.3.0 -CohortMethodModule,v0.3.0,github.com,OHDSI,cdm,CohortMethod,v5.2.0 +CohortGeneratorModule,v0.4.1,github.com,OHDSI,cdm,CohortGenerator,v0.9.0 +CohortIncidenceModule,v0.4.1,github.com,OHDSI,cdm,CohortIncidence,v3.3.0 +CohortMethodModule,v0.3.1,github.com,OHDSI,cdm,CohortMethod,v5.3.0 PatientLevelPredictionModule,v0.3.0,github.com,OHDSI,cdm,PatientLevelPrediction,v6.3.6 -SelfControlledCaseSeriesModule,v0.4.1,github.com,OHDSI,cdm,SelfControlledCaseSeries,v5.1.1 -EvidenceSynthesisModule,v0.6.0,github.com,OHDSI,results,EvidenceSynthesis,v0.5.0 +SelfControlledCaseSeriesModule,v0.5.0,github.com,OHDSI,cdm,SelfControlledCaseSeries,v5.2.0 +EvidenceSynthesisModule,v0.6.1,github.com,OHDSI,results,EvidenceSynthesis,v0.5.0 diff --git a/inst/doc/CreatingAnalysisSpecification.pdf b/inst/doc/CreatingAnalysisSpecification.pdf index 9ed3007f..e3d7dd2a 100644 Binary files a/inst/doc/CreatingAnalysisSpecification.pdf and b/inst/doc/CreatingAnalysisSpecification.pdf differ diff --git a/inst/doc/CreatingModules.pdf b/inst/doc/CreatingModules.pdf index 2df5c663..edeb8a32 100644 Binary files a/inst/doc/CreatingModules.pdf and b/inst/doc/CreatingModules.pdf differ diff --git a/inst/doc/ExecuteStrategus.pdf b/inst/doc/ExecuteStrategus.pdf index 1f70e6bb..666c055a 100644 Binary files a/inst/doc/ExecuteStrategus.pdf and b/inst/doc/ExecuteStrategus.pdf differ diff --git a/inst/doc/IntroductionToStrategus.pdf b/inst/doc/IntroductionToStrategus.pdf index 65bcb9fa..3ecbd02d 100644 Binary files a/inst/doc/IntroductionToStrategus.pdf and b/inst/doc/IntroductionToStrategus.pdf differ diff --git a/man-roxygen/enforceModuleDependencies.R b/man-roxygen/enforceModuleDependencies.R new file mode 100644 index 00000000..92393bc8 --- /dev/null +++ b/man-roxygen/enforceModuleDependencies.R @@ -0,0 +1,8 @@ +#' @param enforceModuleDependencies When set to TRUE, Strategus will enforce +#' module dependencies that are declared by each module. For example, the +#' CohortDiagnostics module declares a dependency on the CohortGenerator module +#' and Strategus will require that an analysis specification declare that both +#' modules must exist in order to execute the analysis. When set to FALSE, +#' Strategus will not enforce these module dependencies which assumes you have +#' properly run all module dependencies yourself. Setting this to FALSE is not +#' recommended since it is potentially unsafe. diff --git a/man/createCdmExecutionSettings.Rd b/man/createCdmExecutionSettings.Rd index d4a84cf1..96768f97 100644 --- a/man/createCdmExecutionSettings.Rd +++ b/man/createCdmExecutionSettings.Rd @@ -12,6 +12,7 @@ createCdmExecutionSettings( tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE), @@ -39,6 +40,8 @@ connection details) will need to have read access to this database schema.} \item{resultsFolder}{A folder in the local file system where the module output will be written.} +\item{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 \code{resultsFolder}} + \item{minCellCount}{The minimum number of subjects contributing to a count before it can be included in results.} diff --git a/man/createResultDataModels.Rd b/man/createResultDataModels.Rd index fe3d16df..69975988 100644 --- a/man/createResultDataModels.Rd +++ b/man/createResultDataModels.Rd @@ -9,7 +9,8 @@ createResultDataModels( executionSettings, executionScriptFolder = NULL, keyringName = NULL, - restart = FALSE + restart = FALSE, + enforceModuleDependencies = TRUE ) } \arguments{ @@ -32,6 +33,15 @@ Sys.getenv("STRATEGUS_KEYRING_PASSWORD")} \item{restart}{Restart run? Requires \code{executionScriptFolder} to be specified, and be the same as the \code{executionScriptFolder} used in the run to restart.} + +\item{enforceModuleDependencies}{When set to TRUE, Strategus will enforce +module dependencies that are declared by each module. For example, the +CohortDiagnostics module declares a dependency on the CohortGenerator module +and Strategus will require that an analysis specification declare that both +modules must exist in order to execute the analysis. When set to FALSE, +Strategus will not enforce these module dependencies which assumes you have +properly run all module dependencies yourself. Setting this to FALSE is not +recommended since it is potentially unsafe.} } \description{ Use this at the study design stage to create data models for modules diff --git a/man/createResultsExecutionSettings.Rd b/man/createResultsExecutionSettings.Rd index d4ea9657..2c088e1a 100644 --- a/man/createResultsExecutionSettings.Rd +++ b/man/createResultsExecutionSettings.Rd @@ -9,6 +9,7 @@ createResultsExecutionSettings( resultsDatabaseSchema, workFolder, resultsFolder, + logFileName = file.path(resultsFolder, "strategus-log.txt"), minCellCount = 5, integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE), integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE) @@ -24,6 +25,8 @@ details from a secure local store.} \item{resultsFolder}{A folder in the local file system where the module output will be written.} +\item{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 \code{resultsFolder}} + \item{minCellCount}{The minimum number of subjects contributing to a count before it can be included in results.} diff --git a/man/ensureAllModulesInstantiated.Rd b/man/ensureAllModulesInstantiated.Rd index 7d9e2ff9..0fc9ed20 100644 --- a/man/ensureAllModulesInstantiated.Rd +++ b/man/ensureAllModulesInstantiated.Rd @@ -4,7 +4,11 @@ \alias{ensureAllModulesInstantiated} \title{Ensure all modules are instantiated} \usage{ -ensureAllModulesInstantiated(analysisSpecifications, forceVerification = FALSE) +ensureAllModulesInstantiated( + analysisSpecifications, + forceVerification = FALSE, + enforceModuleDependencies = TRUE +) } \arguments{ \item{analysisSpecifications}{An object of type \code{AnalysisSpecifications} as created @@ -15,6 +19,15 @@ to re-evaluate if a module is properly installed. The default is FALSE since if a module is successfully validated, the module will contain the hash value of the module's renv.lock file in the file system so it can by-pass running this check every time.} + +\item{enforceModuleDependencies}{When set to TRUE, Strategus will enforce +module dependencies that are declared by each module. For example, the +CohortDiagnostics module declares a dependency on the CohortGenerator module +and Strategus will require that an analysis specification declare that both +modules must exist in order to execute the analysis. When set to FALSE, +Strategus will not enforce these module dependencies which assumes you have +properly run all module dependencies yourself. Setting this to FALSE is not +recommended since it is potentially unsafe.} } \value{ A list containing the install status of all modules diff --git a/man/execute.Rd b/man/execute.Rd index 0b3de7cd..40f20941 100644 --- a/man/execute.Rd +++ b/man/execute.Rd @@ -9,7 +9,8 @@ execute( executionSettings, executionScriptFolder = NULL, keyringName = NULL, - restart = FALSE + restart = FALSE, + enforceModuleDependencies = TRUE ) } \arguments{ @@ -32,6 +33,15 @@ Sys.getenv("STRATEGUS_KEYRING_PASSWORD")} \item{restart}{Restart run? Requires \code{executionScriptFolder} to be specified, and be the same as the \code{executionScriptFolder} used in the run to restart.} + +\item{enforceModuleDependencies}{When set to TRUE, Strategus will enforce +module dependencies that are declared by each module. For example, the +CohortDiagnostics module declares a dependency on the CohortGenerator module +and Strategus will require that an analysis specification declare that both +modules must exist in order to execute the analysis. When set to FALSE, +Strategus will not enforce these module dependencies which assumes you have +properly run all module dependencies yourself. Setting this to FALSE is not +recommended since it is potentially unsafe.} } \value{ Does not return anything. Is called for the side-effect of executing the specified diff --git a/man/installLatestModule.Rd b/man/installLatestModule.Rd new file mode 100644 index 00000000..ffe9432e --- /dev/null +++ b/man/installLatestModule.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ModuleInstantiation.R +\name{installLatestModule} +\alias{installLatestModule} +\title{Install the latest release of a module} +\usage{ +installLatestModule(moduleName) +} +\arguments{ +\item{moduleName}{The name of the module to install (i.e. "CohortGeneratorModule"). +This parameter must match a value found in the \code{module} column of \code{getModuleList()}} +} +\value{ +None - this function is called for its side effects +} +\description{ +This function will call out to the OHDSI GitHub repo to find the latest +version of the module and attempt to install it. Only modules that are listed +in the \code{getModuleList()} function are allowed since it will have a known +GitHub location. +} diff --git a/man/zipResults.Rd b/man/zipResults.Rd new file mode 100644 index 00000000..4e673245 --- /dev/null +++ b/man/zipResults.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ShareResults.R +\name{zipResults} +\alias{zipResults} +\title{Create a zip file with all study results for sharing with study coordinator} +\usage{ +zipResults(resultsFolder, zipFile) +} +\arguments{ +\item{resultsFolder}{The folder holding the study results. This is found in +\code{executionSettings$resultsFolder}.} + +\item{zipFile}{The path to the zip file to be created.} +} +\value{ +Does not return anything. Is called for the side-effect of creating the +zip file with results. +} +\description{ +Create a zip file with all study results for sharing with study coordinator +} +\details{ +Creates a \code{.zip} file of the \code{.csv} files found in the +\code{resultsFolder}. The resulting \code{.zip} file will have +relative paths to the root of the \code{resultsFolder} +which is generally found in \code{executionSettings$resultsFolder}. +} diff --git a/tests/testthat/test-ModuleInstantiation.R b/tests/testthat/test-ModuleInstantiation.R new file mode 100644 index 00000000..bee17942 --- /dev/null +++ b/tests/testthat/test-ModuleInstantiation.R @@ -0,0 +1,58 @@ +test_that("Prevent multiple modules with different versions in analysis specification", { + analysisSpecifications <- ParallelLogger::loadSettingsFromJson( + fileName = system.file("testdata/unitTestAnalysisSpecification.json", + package = "Strategus" + ) + ) + + # Duplicate the module + analysisSpecifications$moduleSpecifications[[2]] <- analysisSpecifications$moduleSpecifications[[1]] + analysisSpecifications$moduleSpecifications[[2]]$version <- "x" + + expect_error( + ensureAllModulesInstantiated( + analysisSpecifications = analysisSpecifications + ) + ) +}) + +# TODO: We'd like to test this functionality but both methods require that +# the module is instantiated which is very time consuming. Instead these +# tests should mock the MetaData.json that exists in the instantiated +# modules so that these methods work faster. +# test_that("Enforce module dependencies", { +# analysisSpecifications <- ParallelLogger::loadSettingsFromJson( +# fileName = system.file("testdata/analysisSpecification.json", +# package = "Strategus" +# ) +# ) +# +# # Remove the cohort generator module which is a dependency for all +# # the other modules +# analysisSpecifications$moduleSpecifications <- analysisSpecifications$moduleSpecifications[-1] +# modules <- getModuleTable(analysisSpecifications, distinct = TRUE) +# +# expect_error( +# checkModuleDependencies( +# modules = modules, +# enforceModuleDependencies = TRUE +# ) +# ) +# }) +# +# test_that("Do not enforce module dependencies", { +# analysisSpecifications <- ParallelLogger::loadSettingsFromJson( +# fileName = system.file("testdata/unitTestAnalysisSpecification.json", +# package = "Strategus" +# ) +# ) +# +# modules <- getModuleTable(analysisSpecifications, distinct = TRUE) +# +# expect_silent( +# checkModuleDependencies( +# modules = modules, +# enforceModuleDependencies = FALSE +# ) +# ) +# }) diff --git a/tests/testthat/test-ShareResults.R b/tests/testthat/test-ShareResults.R new file mode 100644 index 00000000..07493f6e --- /dev/null +++ b/tests/testthat/test-ShareResults.R @@ -0,0 +1,30 @@ +library(testthat) +test_that("Test zip file for sharing results", { + testDir <- tempfile() + dir.create(testDir) + on.exit(unlink(testDir)) + writeLines( + text = "test 1 2 3", + file.path(testDir, "log.txt") + ) + dir.create(file.path(testDir, "test")) + writeLines( + text = "csv", + file.path(testDir, "test", "test.csv") + ) + + zipResults( + resultsFolder = testDir, + zipFile = file.path(testDir, "test.zip") + ) + + expect_true(file.exists(file.path(testDir, "test.zip"))) + + # Verify that only the csv was zipped + zipFiles <- utils::unzip( + zipfile = file.path(testDir, "test.zip"), + list = TRUE + ) + expect_equal(length(zipFiles$Name), expected = 1) + expect_equal(zipFiles$Name[1], file.path("test", "test.csv")) +}) diff --git a/vignettes/CreatingAnalysisSpecification.Rmd b/vignettes/CreatingAnalysisSpecification.Rmd index 503a3311..5ad08532 100644 --- a/vignettes/CreatingAnalysisSpecification.Rmd +++ b/vignettes/CreatingAnalysisSpecification.Rmd @@ -42,12 +42,12 @@ To start, we must install the [HADES](https://ohdsi.github.io/Hades/) libraries ```{r, eval=FALSE} # Install correct versions of HADES packages -remotes::install_github("ohdsi/CohortGenerator", ref = "v0.8.1") +remotes::install_github("ohdsi/CohortGenerator", ref = "v0.9.0") remotes::install_github("ohdsi/CohortDiagnostics", ref = "v3.2.5") -remotes::install_github("ohdsi/Characterization", ref = "v0.1.3") +remotes::install_github("ohdsi/Characterization", ref = "v0.2.0") remotes::install_github("ohdsi/CohortIncidence", ref = "v3.3.0") -remotes::install_github("ohdsi/CohortMethod", ref = "v5.2.0") -remotes::install_github("ohdsi/SelfControlledCaseSeries", ref = "v5.1.1") +remotes::install_github("ohdsi/CohortMethod", ref = "v5.3.0") +remotes::install_github("ohdsi/SelfControlledCaseSeries", ref = "v5.2.0") remotes::install_github("ohdsi/PatientLevelPrediction", ref = "v6.3.6") ``` @@ -96,7 +96,7 @@ The building blocks of the `Strategus` analysis specification are HADES modules. The following code downloads the settings functions from the `CohortGeneratorModule` which then activates some additional functions we can use for creating the analysis specification. In the analysis specification, we will add the cohort definitions and negative control outcomes to the `sharedResources` section since these elements may be used by any of the HADES modules. To do this, we will use the `createCohortSharedResourceSpecifications` and `createNegativeControlOutcomeCohortSharedResourceSpecifications` functions respectively. In addition, we will use the `cohortGeneratorModuleSpecifications` function to specify the cohort generation settings. ```{r eval=FALSE} -source("https://raw.githubusercontent.com/OHDSI/CohortGeneratorModule/v0.3.0/SettingsFunctions.R") +source("https://raw.githubusercontent.com/OHDSI/CohortGeneratorModule/v0.4.1/SettingsFunctions.R") # Create the cohort definition shared resource element for the analysis specification cohortDefinitionSharedResource <- createCohortSharedResourceSpecifications( @@ -142,7 +142,7 @@ cohortDiagnosticsModuleSpecifications <- createCohortDiagnosticsModuleSpecificat The following code creates the `cohortIncidenceModuleSpecifications` to perform an incidence rate analysis for the target cohorts and outcome in this study. ```{r eval=FALSE} -source("https://raw.githubusercontent.com/OHDSI/CohortIncidenceModule/v0.4.0/SettingsFunctions.R") +source("https://raw.githubusercontent.com/OHDSI/CohortIncidenceModule/v0.4.1/SettingsFunctions.R") library(CohortIncidence) targets <- list( createCohortRef(id = 1, name = "Celecoxib"), @@ -184,7 +184,7 @@ The following code creates the `characterizationModuleSpecifications` to perform ```{r eval=FALSE} -source("https://raw.githubusercontent.com/OHDSI/CharacterizationModule/v0.5.0/SettingsFunctions.R") +source("https://raw.githubusercontent.com/OHDSI/CharacterizationModule/v0.6.0/SettingsFunctions.R") characterizationModuleSpecifications <- createCharacterizationModuleSpecifications( targetIds = c(1, 2), outcomeIds = 3, @@ -207,7 +207,7 @@ The following code creates the `cohortMethodModuleSpecifications` to perform a c ```{r eval=FALSE} library(CohortMethod) -source("https://raw.githubusercontent.com/OHDSI/CohortMethodModule/v0.3.0/SettingsFunctions.R") +source("https://raw.githubusercontent.com/OHDSI/CohortMethodModule/v0.3.1/SettingsFunctions.R") negativeControlOutcomes <- lapply( X = ncoCohortSet$cohortId, FUN = createOutcome, @@ -310,7 +310,7 @@ The following code creates the `cohortMethodModuleSpecifications` to perform a c ```{r eval=FALSE} library(SelfControlledCaseSeries) -source("https://raw.githubusercontent.com/OHDSI/SelfControlledCaseSeriesModule/v0.4.1/SettingsFunctions.R") +source("https://raw.githubusercontent.com/OHDSI/SelfControlledCaseSeriesModule/v0.5.0/SettingsFunctions.R") # Exposures-outcomes ----------------------------------------------------------- negativeControlOutcomeIds <- ncoCohortSet$cohortId