Skip to content

Commit

Permalink
Use latest modules for test analysisSpecification.json and and add dp…
Browse files Browse the repository at this point in the history
…lyr to base R library list for module execution
  • Loading branch information
anthonysena committed Sep 6, 2023
1 parent 06ca01d commit 4468a9b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
32 changes: 12 additions & 20 deletions R/ModuleEnv.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,14 @@ withModuleRenv <- function(code,

# Enforce attachment of Strategus from calling process - note one inside the renv
if (useLocalStrategusLibrary) {
libPath <- file.path(find.package("Strategus"), "../")
script <- c(sprintf("library(Strategus, lib.loc = '%s')", libPath),
script)
script <- c(.getLocalLibraryScipt("Strategus"), script)
# Adding Strategus dependencies to the script
libPath <- file.path(find.package("R6"), "../")
script <- c(
sprintf("library(R6, lib.loc = '%s')", libPath),
script
)
libPath <- file.path(find.package("CohortGenerator"), "../")
script <- c(sprintf("library(CohortGenerator, lib.loc = '%s')", libPath),
script)
libPath <- file.path(find.package("DatabaseConnector"), "../")
script <- c(sprintf("library(DatabaseConnector, lib.loc = '%s')", libPath),
script)
libPath <- file.path(find.package("keyring"), "../")
script <- c(sprintf("library(keyring, lib.loc = '%s')", libPath),
script)
libPath <- file.path(find.package("openssl"), "../")
script <- c(sprintf("library(openssl, lib.loc = '%s')", libPath),
script)
c(.getLocalLibraryScipt("R6"), script)
c(.getLocalLibraryScipt("CohortGenerator"), script)
c(.getLocalLibraryScipt("DatabaseConnector"), script)
c(.getLocalLibraryScipt("keyring"), script)
c(.getLocalLibraryScipt("openssl"), script)
c(.getLocalLibraryScipt("dplyr"), script)
}

# Write file and execute script inside an renv
Expand All @@ -104,3 +91,8 @@ withModuleRenv <- function(code,
)
return(invisible(NULL))
}

.getLocalLibraryScipt <- function(x) {
libPath <- file.path(find.package(x), "../")
sprintf("library(%s, lib.loc = '%s')", x, libPath)
}
4 changes: 2 additions & 2 deletions inst/csv/modules.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module,version,remote_repo,remote_username,module_type,main_package,main_package_tag
CharacterizationModule,v0.3.1,github.com,OHDSI,cdm,Characterization,v0.1.1
CharacterizationModule,v0.3.2,github.com,OHDSI,cdm,Characterization,v0.1.1
CohortDiagnosticsModule,v0.0.7,github.com,OHDSI,cdm,CohortDiagnostics,v3.1.2
CohortGeneratorModule,v0.1.0,github.com,OHDSI,cdm,CohortGenerator,v0.8.0
CohortIncidenceModule,v0.0.6,github.com,OHDSI,cdm,CohortIncidence,v3.1.2
CohortIncidenceModule,v0.0.9,github.com,OHDSI,cdm,CohortIncidence,v3.1.4
CohortMethodModule,v0.1.0,github.com,OHDSI,cdm,CohortMethod,74f017107e0cc1b740a2badc82879ab6ad291b23
PatientLevelPredictionModule,v0.1.0,github.com,OHDSI,cdm,PatientLevelPrediction,v6.3.1
SelfControlledCaseSeriesModule,v0.1.3,github.com,OHDSI,cdm,SelfControlledCaseSeries,15918616814b88137f82bf2aa9986e1dcdf39e74
Expand Down
14 changes: 7 additions & 7 deletions inst/testdata/analysisSpecification.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"moduleSpecifications": [
{
"module": "CohortGeneratorModule",
"version": "0.2.0-2",
"version": "0.2.0-6",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand All @@ -234,7 +234,7 @@
},
{
"module": "CohortDiagnosticsModule",
"version": "0.1.0-1",
"version": "0.1.0-5",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -292,7 +292,7 @@
},
{
"module": "CohortIncidenceModule",
"version": "0.1.0-2",
"version": "0.1.0-6",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -365,7 +365,7 @@
},
{
"module": "CharacterizationModule",
"version": "0.4.0-1",
"version": "0.4.0-5",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -489,7 +489,7 @@
},
{
"module": "CohortMethodModule",
"version": "0.2.0-1",
"version": "0.2.0-5",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -1341,7 +1341,7 @@
},
{
"module": "SelfControlledCaseSeriesModule",
"version": "0.2.0-1",
"version": "0.2.0-5",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -2360,7 +2360,7 @@
},
{
"module": "PatientLevelPredictionModule",
"version": "0.2.0-1",
"version": "0.2.0-5",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": [
Expand Down

0 comments on commit 4468a9b

Please sign in to comment.