-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.R
More file actions
123 lines (93 loc) · 4.52 KB
/
server.R
File metadata and controls
123 lines (93 loc) · 4.52 KB
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
##--------------------------------------------------------------------------
## server.R --
##--------------------------------------------------------------------------
function(input, output, session) {
##-------------------------------------------------------
## THEME SELECTION --
##-------------------------------------------------------
# Instantiates an overlay UI for previewing bootswatch themes
# bslib::bs_themer()
# Switching between dark and light theme based on user-input
shiny::observe(session$setCurrentTheme(
if (isTRUE(input$dark_mode)) {theme_dark} else {theme_light}
))
##-------------------------------------------------------
## SHARED VALUES --
##-------------------------------------------------------
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
## Global >>
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Instantiates a global reactive values object to share amongst modules;
# is is passed as an argument to the moduleServer functions
grv <- shiny::reactiveValues()
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
## Scatter plot options >>
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
grv$scatter_opts <- shiny::reactiveValues()
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
## Scatter plot filters >>
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
grv$scatter_filters <- shiny::reactiveValues()
# I'm not sure this is needed..
# the filters are different than the plot options,
# and don't need to be accessed individually.
# I think the best route will be to just take data in,
# apply filters to transform or do nothing in initial state,
# and return the data back out to replace the global reactive used for plots.
##-------------------------------------------------------
## TESTING --
##-------------------------------------------------------
# Performance profiler
# callModule(profvis::profvis_server, "profiler")
# Navigate directly to plots when in testing mode
shiny::observe({
if (use_testing_mode) {
grv$data <- shiny::reactive({test_data})
updateNavbarPage(inputId = "dashboard_navbar", selected = "tab_scatter")
}
})
##-------------------------------------------------------
## POSTGRES DATABASE --
##-------------------------------------------------------
##////////////////////////////////////////
## Query module //
##////////////////////////////////////////
dbQueryServer("db_query", grv, db_pool_obj)
##////////////////////////////////////////
## Print module //
##////////////////////////////////////////
dbViewServer("db_view", grv)
##////////////////////////////////////////
## Diagnostics module //
##////////////////////////////////////////
dbDiagServer("db_diag", db_pool_obj)
##-------------------------------------------------------
## VISUALIZATION --
##-------------------------------------------------------
##////////////////////////////////////////
## Scatter options module //
##////////////////////////////////////////
plotOptsServer("opts_scatter", grv$scatter_opts)
##////////////////////////////////////////
## Scatter filters module //
##////////////////////////////////////////
dataFiltersServer("filters", grv)
##////////////////////////////////////////
## Scatter plots module //
##////////////////////////////////////////
scatterPlotsServer("scatter", grv)
##////////////////////////////////////////
## Plate inspector module //
##////////////////////////////////////////
plateInspectorServer("inspector", grv)
##-------------------------------------------------------
## ABOUT --
##-------------------------------------------------------
##////////////////////////////////////////
## About module //
##////////////////////////////////////////
aboutServer("about")
}
##--------------------------------------------------------------------------
## end server.R --
##--------------------------------------------------------------------------