forked from Pandora-IsoMemo/BNR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.R
116 lines (103 loc) · 2.38 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
# Load global configuration
source("config.R")
# Load required packages
library(shiny)
library(shinyjs)
library(shinydashboard)
library(shinyFeedback)
library(shinyhelper)
library(markdown)
# Add development packages
library(languageserver)
# Define dashboard header
header <- dashboardHeader(title = "BNR")
# Define dashboard sidebar
sidebar <- dashboardSidebar(sidebarMenu(
menuItem(
"Home",
tabName = "home",
icon = icon("home")
),
menuItem(
"Dataset Import",
tabName = "dataset_import",
icon = icon("database")
),
menuItem(
"Graph Design",
tabName = "graph_builder",
icon = icon("project-diagram")
),
menuItem(
"Parameter Learning",
tabName = "parameter_learning",
icon = icon("calculator")
),
menuItem(
"Query Estimation",
tabName = "query_estimation",
icon = icon("cogs")
),
menuItem(
"Validation",
tabName = "validation",
icon = icon("check")
)
))
# Define the home page
home <- tagList(
fluidRow(
box(
status = "primary",
solidHeader = TRUE,
width = 12,
includeMarkdown("README.md")
)
)
)
# Define dashboard body
body <- dashboardBody(
useShinyjs(),
useShinyFeedback(),
tabItems(
tabItem(tabName = "home", home),
tabItem(tabName = "dataset_import", datasetImportUI()),
tabItem(tabName = "graph_builder", graphDesignUI()),
tabItem(tabName = "parameter_learning", parameterLearningUI()),
tabItem(tabName = "query_estimation", queryEstimationUI()),
tabItem(tabName = "validation", validationUI())
)
)
# Define UI for the application
ui <- dashboardPage(header, sidebar, body)
# Define on start setup
onStart <- function() {
}
# Define server logic required
server <- function(input, output, session) {
# Define observer for helpers.
observe_helpers(session, help_dir = "help")
# Define the list of models
models <- reactiveVal(list())
# Load modules
dataset <- datasetImportServer()
graph <- graphDesignServer(dataset = dataset)
models <- parameterLearningServer(dataset = dataset, graph = graph, models = models)
queryEstimationServer(models = models)
validationServer(models = models)
}
# Get default port
port <- strtoi(Sys.getenv("R_SHINY_PORT"))
if (is.na(port)) {
port <- 8080
}
# Run the application
shinyApp(
ui = ui,
server = server,
onStart = onStart,
options = list(
"host" = "0.0.0.0",
"port" = port
)
)