-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
179 lines (146 loc) · 6.46 KB
/
ui.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Define UI for prediction model
library(shiny)
library(shinydashboard)
ui <- shinyUI(dashboardPage(
dashboardHeader(title = "Case Predictor", titleWidth = "230px"),
dashboardSidebar(
sidebarMenu(
# Sidebar menu header
menuItem("Predict COVID-19 Cases!", tabName = "model", icon = icon("bar-chart-o"), startExpanded = TRUE,
# Sidebar menu inputs
numericInput(inputId = "input1",
label = "7 Day COVID-19 Case Moving Average",
value = 20,
min = 0,
max = 500),
numericInput(inputId = "input2",
label = "14 Day COVID-19 Case Moving Average",
value = 20,
min = 0,
max = 500),
numericInput(inputId = "input3",
label = "7 Day COVID-19 Test Moving Average",
value = 20,
min = 0,
max = 10000),
numericInput(inputId = "input4",
label = "Cases Today",
value = 20,
min = 0,
max = 500),
# Predict action button
div(style="display: inline-block; vertical-align:top; width: 100px;",
actionButton("Run_model", "Predict!")),
# Author details and social links
div(style="display: block; vertical-align:top; width:0px; margin-left: -10px;",
fluidRow(
column(width = 1,
box('A Shiny web application by Justin', br(), 'Ferguson', br(), br(),
tags$a(href="https://www.justinferguson.me/", icon("globe", "fa-3x")),
tags$a(href="https://www.linkedin.com/in/j-b-ferguson/", icon("linkedin", "fa-3x")),
tags$a(href="https://github.com/j-b-ferguson/", icon("github", "fa-3x"))))))
))),
dashboardBody(
# Custom styles CSS3 and HTML5
tags$head(tags$style(
"@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300&display=swap');
* {font-family: 'Source Sans Pro', 'sans-serif';
font-weight: 300;}
h1 {font-family: 'Source Sans Pro', 'sans-serif';
font-weight: 200;}"
)),
tags$head(tags$style(
type="text/css",
"#image1 img {height: auto;
width: 200px;
margin-left: auto;
margin-right: auto;}"
)),
tags$head(tags$style("@import url('https://fonts.googleapis.com/css2?family=Caveat&display=swap');
.box-body {color: black;
font-size: 16px;
font-weight: 600;
font-family: 'Caveat', 'sans-serif';
color: white;}"
)),
tags$head(tags$style(
type="text/css",
".fa-globe {padding-right: 30px;
padding-top: -50px;
font-size: 40px;}
.fab {padding-right: 30px;
font-size: 40px;}"
)),
tags$head(tags$style("#text1{color: black;
font-size: 32px;
font-family: Source Sans Pro;}"
)),
tags$head(tags$style(
type="text/css",
".box-header h3 {font-weight: bold;}"
)),
tags$style(HTML(
".info-box {background:#00000000;}"
)),
# Set main border
div(style="box-shadow: 2px 2px 5px grey;
margin-top: 29px;",
# Set prediction output
div(style="display: flex;
margin-left: 85px;
margin-bottom: 20px;
padding-top: 43px;",
h2("The predicted COVID-19 cases tomorrow is:",HTML(' ')),
h2(textOutput("text1"))
),
# Image and floating text
fluidRow(
div(style="display: flex;
margin-left: 100px;
margin-bottom: 73px;
float: left;",
imageOutput(outputId = "image1"),
),
column(width = 3,
div(style="display: flex;
position: fixed;
margin-left: 20px;
margin-right: 100px;
margin-top: -10px;
padding-top: 0px;
float: left;",
h3(textOutput("text2"))
))),
# Inline info boxes
div(style = "display: inline-block;
position: fixed;
margin-left: 80px;
margin-top: -200px;",
infoBox(
"What", "is this model for?", icon = icon("line-chart"),
subtitle = 'This model has been fitted from Victorian (Australia) COVID-19 data in order to predict tomorrow\'s cases.',
width = 3,
href = 'https://www.justinferguson.me/pages/COVID-19_Aus_cleaned.html'
),
infoBox(
"How", "do I use this model?", icon = icon("question"),
subtitle = 'Use 7 and 14 day COVID-19 case and test averages to make a prediction. The prediction is then compared with today\'s cases.',
width = 3,
href = 'https://www.covid19data.com.au/'
),
infoBox(
"Where", "can I find out more?", icon = icon("book-open"),
subtitle = 'See how the model was fitted and tested at this link. For active COVID-19 data, please visit covid19data.com.au or the WHO\'s website.',
width = 3,
href = 'https://www.justinferguson.me/pages/covid-19-regression-analysis.html'
),
infoBox(
"Who", "is this model for?", icon = icon("user-friends"),
subtitle = 'Everyone! Please use this app and share with other people. If you have any questions or suggestions, please get in touch.',
width = 3,
href = 'mailto:justin.benjamin.ferguson@gmail.com?subject=COVID-19%20Model%20Enquiry'
))
)
)
)
)