-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.R
133 lines (120 loc) · 4.3 KB
/
app.R
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# View Strategus results in the results database
# remotes::install_github("ohdsi/ShinyAppBuilder", ref = "develop")
# remotes::install_github("ohdsi/OhdsiShinyModules", ref = "develop")
# remotes::install_github("ohdsi/ResultModelManager")
library(dplyr)
library(ShinyAppBuilder)
library(markdown)
##=========== START OF INPUTS ==========
connectionDetailsReference <- "Jmdc"
outputLocation <- '~/output'
##=========== END OF INPUTS ==========
##################################
# DO NOT MODIFY BELOW THIS POINT
##################################
# specify the connection to the results database
sqliteDbPath <- file.path(outputLocation, connectionDetailsReference, "results.sqlite")
resultsDatabaseSchema <- "main"
resultsDatabaseConnectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "sqlite",
server = sqliteDbPath
)
# Specify about module ---------------------------------------------------------
aboutModule <- createDefaultAboutConfig(
resultDatabaseDetails = NULL,
useKeyring = FALSE
)
# Specify cohort generator module ----------------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'cg_',
cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA'
)
cohortGeneratorModule <- createDefaultCohortGeneratorConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Specify cohort diagnostics module --------------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'cd_',
# cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA'
)
cohortDiagnosticsModule <- createDefaultCohortDiagnosticsConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Specify characterization module ----------------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'c_',
cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA',
incidenceTablePrefix = "ci_"
)
characterizationModule <- createDefaultCharacterizationConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Specify cohort method module -------------------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'cm_',
cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA'
)
cohortMethodModule <- createDefaultEstimationConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Specify cohort method module -------------------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'sccs_',
cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA'
)
sccsModule <- createDefaultSCCSConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Specify patient-level prediction module --------------------------------------
resultDatabaseDetails <- list(
dbms = resultsDatabaseConnectionDetails$dbms,
tablePrefix = 'plp_',
cohortTablePrefix = 'cg_',
databaseTablePrefix = '',
schema = resultsDatabaseSchema,
databaseTable = 'DATABASE_META_DATA'
)
predictionModule <- createDefaultPredictionConfig(
resultDatabaseDetails = resultDatabaseDetails,
useKeyring = FALSE
)
# Combine module specifications ------------------------------------------------
shinyAppConfig <- initializeModuleConfig() %>%
addModuleConfig(aboutModule) %>%
addModuleConfig(cohortGeneratorModule) %>%
addModuleConfig(cohortDiagnosticsModule) %>%
addModuleConfig(characterizationModule) %>%
addModuleConfig(cohortMethodModule) %>%
addModuleConfig(sccsModule) %>%
addModuleConfig(predictionModule)
# Launch shiny app -----------------------------------------------------
connectionHandler <- ResultModelManager::ConnectionHandler$new(resultsDatabaseConnectionDetails)
ShinyAppBuilder::createShinyApp(
config = shinyAppConfig,
connection = connectionHandler
)