-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStrategusCodeToRun.R
More file actions
60 lines (52 loc) · 2.31 KB
/
Copy pathStrategusCodeToRun.R
File metadata and controls
60 lines (52 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -------------------------------------------------------
# PLEASE READ
# -------------------------------------------------------
#
# You must call "renv::restore()" and follow the prompts
# to install all of the necessary R libraries to run this
# project. This is a one-time operation that you must do
# before running any code.
#
# !!! PLEASE RESTART R AFTER RUNNING renv::restore() !!!
#
# -------------------------------------------------------
#renv::restore()
# ENVIRONMENT SETTINGS NEEDED FOR RUNNING Strategus ------------
Sys.setenv("_JAVA_OPTIONS"="-Xmx4g") # Sets the Java maximum heap space to 4GB
Sys.setenv("VROOM_THREADS"=1) # Sets the number of threads to 1 to avoid deadlocks on file system
##=========== START OF INPUTS ==========
cdmDatabaseSchema <- ""
workDatabaseSchema <- ""
outputLocation <- file.path(getwd(), "results")
databaseName <- "CUMC_2024" # Only used as a folder name for results from the study
minCellCount <- 5
cohortTableName <- "arpah_obesity_cohort"
# Create the connection details for your CDM
# More details on how to do this are found here:
# https://ohdsi.github.io/DatabaseConnector/reference/createConnectionDetails.html
connectionDetails <- createConnectionDetails()
##=========== END OF INPUTS ==========
analysisSpecifications <- ParallelLogger::loadSettingsFromJson(
fileName = "inst/cuimc_rev/Obesity_Cohort_Analysis_Specification_V2.json" ###this is the study specs in JSON form
)
executionSettings <- Strategus::createCdmExecutionSettings(
workDatabaseSchema = workDatabaseSchema,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortTableNames = CohortGenerator::getCohortTableNames(cohortTable = cohortTableName),
workFolder = file.path(outputLocation, databaseName, "strategusWork"),
resultsFolder = file.path(outputLocation, databaseName, "strategusOutput"),
minCellCount = minCellCount #,
# modulesToExecute = c("characterizationModule")
)
if (!dir.exists(file.path(outputLocation, databaseName))) {
dir.create(file.path(outputLocation, databaseName), recursive = T)
}
ParallelLogger::saveSettingsToJson(
object = executionSettings,
fileName = file.path(outputLocation, databaseName, "executionSettings.json")
)
Strategus::execute(
analysisSpecifications = analysisSpecifications,
executionSettings = executionSettings,
connectionDetails = connectionDetails
)