Skip to content

Commit

Permalink
Lockfile updates & upload code (#9)
Browse files Browse the repository at this point in the history
* adding upload code

adding upload code

* Rename function to match Strategus expectation

* Update renv.lock

---------

Co-authored-by: jreps <jreps@its.jnj.com>
  • Loading branch information
anthonysena and jreps authored Aug 24, 2023
1 parent 67101d3 commit 1e2344c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
47 changes: 47 additions & 0 deletions Main.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,50 @@ execute <- function(jobContext) {


}


uploadResultsCallback <- function(jobContext) {
connectionDetails <- jobContext$moduleExecutionSettings$resultsConnectionDetails
moduleInfo <- ParallelLogger::loadSettingsFromJson("MetaData.json")
tablePrefix <- moduleInfo$TablePrefix
schema <- jobContext$moduleExecutionSettings$resultsDatabaseSchema

resultsFolder <- jobContext$moduleExecutionSettings$resultsSubFolder

conn <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(conn))

databaseSchemaSettings <- PatientLevelPrediction::createDatabaseSchemaSettings(
resultSchema = schema,
tablePrefix = tablePrefix,
targetDialect = connectionDetails$dbms
)

PatientLevelPrediction::insertCsvToDatabase(
csvFolder = resultsFolder,
conn = conn,
databaseSchemaSettings = databaseSchemaSettings,
modelSaveLocation = file.path(resultsFolder, 'dbmodels'),
csvTableAppend = ''
)

}

createDataModelSchema <- function(jobContext) {
connectionDetails <- jobContext$moduleExecutionSettings$resultsConnectionDetails
moduleInfo <- ParallelLogger::loadSettingsFromJson("MetaData.json")
tablePrefix <- moduleInfo$TablePrefix
schema <- jobContext$moduleExecutionSettings$resultsDatabaseSchema

conn <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(conn))

PatientLevelPrediction::createPlpResultTables(
conn = conn,
targetDialect = connectionDetails$dbms,
resultSchema = schema,
deleteTables = F,
createTables = T,
tablePrefix = tablePrefix
)
}
10 changes: 5 additions & 5 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@
},
"renv" : {
"Package" : "renv",
"Version" : "1.0.0",
"Version" : "1.0.2",
"Source" : "Repository",
"Repository" : "CRAN"
},
Expand Down Expand Up @@ -1245,23 +1245,23 @@
},
"PatientLevelPrediction" : {
"Package" : "PatientLevelPrediction",
"Version" : "6.3.3",
"Version" : "6.3.4",
"Source" : "GitHub",
"RemoteType" : "github",
"RemoteHost" : "api.github.com",
"RemoteRepo" : "PatientLevelPrediction",
"RemoteUsername" : "ohdsi",
"RemoteRef" : "v6.3.3"
"RemoteRef" : "v6.3.4"
},
"ResultModelManager" : {
"Package" : "ResultModelManager",
"Version" : "0.3.0",
"Version" : "0.4.0",
"Source" : "GitHub",
"RemoteType" : "github",
"RemoteHost" : "api.github.com",
"RemoteRepo" : "ResultModelManager",
"RemoteUsername" : "ohdsi",
"RemoteRef" : "v0.3.0"
"RemoteRef" : "v0.4.0"
},
"BigKnn" : {
"Package" : "BigKnn",
Expand Down

0 comments on commit 1e2344c

Please sign in to comment.