-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.R
103 lines (91 loc) · 2.04 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
# Load global settings
source("global.R")
# Load required packages
library(shiny)
library(shinyjs)
library(shinydashboard)
library(shinyFeedback)
library(shinyhelper)
library(markdown)
# Define dashboard header
header <- dashboardHeader(title = "BNR")
# Define dashboard sidebar
sidebar <- dashboardSidebar(sidebarMenu(
menuItem(
"Home",
tabName = "home",
icon = icon("home")
),
menuItem(
"Data Import",
tabName = "data_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")
)
))
# 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 = "data_import", dataImportUI()),
tabItem(tabName = "graph_builder", graphDesignUI()),
tabItem(tabName = "parameter_learning", parameterLearningUI()),
tabItem(tabName = "query_estimation", queryEstimationUI())
)
)
# 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")
dataset <- dataImportServer()
graph <- graphDesignServer(dataset = dataset)
model <- parameterLearningServer(dataset = dataset, graph = graph)
queryEstimationServer(model = model)
}
# 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
)
)