Skip to content

Commit

Permalink
shiny updates
Browse files Browse the repository at this point in the history
- supporting new ShinyAppBuilder version (but keeping backwards compatible for older version)
- updating reticulate minimum package version
  • Loading branch information
jreps committed Jul 21, 2023
1 parent b2ac1cd commit 662222c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Imports:
polspline,
pROC,
PRROC,
reticulate (> 1.16),
reticulate (>= 1.30),
rlang,
SqlRender (>= 1.1.3),
survival,
Expand Down
44 changes: 37 additions & 7 deletions R/ViewShinyPlp.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,45 @@ viewPlps <- function(databaseSettings){
connection <- ResultModelManager::ConnectionHandler$new(connectionDetails)
databaseSettings$connectionDetailSettings <- NULL

# set database settings into system variables
shinyAppVersion <- strsplit(x = as.character(utils::packageVersion('ShinyAppBuilder')), split = '\\.')[[1]]

if((shinyAppVersion[1] <= 1 & shinyAppVersion[2] < 2)){
# Old code to be backwards compatable
config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfig.json',
package = "PatientLevelPrediction"
)
)
# set database settings into system variables
Sys.setenv("resultDatabaseDetails_prediction" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings)))

config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfig.json',
package = "PatientLevelPrediction"
ShinyAppBuilder::viewShiny(
config = config,
connection = connection
)
} else{
ohdsiModulesVersion <- strsplit(x = as.character(utils::packageVersion('OhdsiShinyModules')), split = '\\.')[[1]]
if(ohdsiModulesVersion[1]>=1 & ohdsiModulesVersion[2]>= 2){
config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfigUpdate.json',
package = "PatientLevelPrediction"
)
)
databaseSettings$plpTablePrefix = databaseSettings$tablePrefix
databaseSettings$cgTablePrefix = databaseSettings$tablePrefix
databaseSettings$databaseTable = 'database_meta_table'
databaseSettings$databaseTablePrefix = databaseSettings$tablePrefix
ShinyAppBuilder::viewShiny(
config = config,
connection = connection,
resultDatabaseSettings = databaseSettings
)
} else{
ParallelLogger::logWarn('Need to update package OhdsiShinyModules')
}

}


ShinyAppBuilder::viewShiny(config = config, connection = connection)
}
26 changes: 26 additions & 0 deletions inst/shinyConfigUpdate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"shinyModules": [
{
"id": "about",
"tabName": "About",
"tabText": "About",
"shinyModulePackage": "OhdsiShinyModules",
"uiFunction": "aboutViewer",
"serverFunction": "aboutServer",
"infoBoxFile": "aboutHelperFile()",
"icon": "info",
"order": 1
},
{
"id": "prediction",
"tabName": "Prediction",
"tabText": "Prediction",
"shinyModulePackage": "OhdsiShinyModules",
"uiFunction": "patientLevelPredictionViewer",
"serverFunction": "patientLevelPredictionServer",
"infoBoxFile": "patientLevelPredictionHelperFile()",
"icon": "chart-line",
"order": 2
}
]
}

0 comments on commit 662222c

Please sign in to comment.