-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
109 lines (102 loc) · 4.48 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
## ---------------------------
##
## Script name: ui.R
##
## Purpose of script: Specifies user interface for coronaRisk app
##
## Author: Ben Phillips
##
## Date Created: 2020-03-12
##
## Email: [email protected]
##
## ---------------------------
##
## Notes:
##
##
## --------------------------
## load up the packages we will need
library(shiny)
## ---------------------------
## load up our functions into memory
## source files
source("getData.R")
## ---------------------------
## ---------------------------
options(scipen=9)
# Define UI
shinyUI(fluidPage(
# Application title
titlePanel("Coronavirus 10-day forecast -- Australia"),
navbarPage(p("As of", format(dates[length(dates)], "%d %b")),
##### 10-day forecast #####
tabPanel("10-day forecast",
# Sidebar
sidebarLayout(
sidebarPanel(
titlePanel("Location"),
selectInput(inputId = "stateFinder",
label = "Select State:",
choices = ddReg,
selected = ddNames[1]),
h5("Raw case numbers:"),
tableOutput(outputId = "rawStats"),
h5("Active cases:"),
tableOutput(outputId = "tablePredConf"),
h5("Doubling time (days):"),
textOutput(outputId = "doubTime"),
hr(),
sliderInput(inputId = "fitWinSlider", min = 3, max = 10, value = 7, label = "Fit window:", post = "days"),
p("When growth rates are changing fast, reduce the fit window to average growth over more recent history."),
titlePanel("Detection"),
h5("Estimated proportion of cases detected:"),
textOutput(outputId = "detRate"),
h5("Possible true number of cases now given imperfect detection:"),
textOutput(outputId = "tablePredTrue"),
hr(),
p("Take this last number with a grain of salt; it is rough. But low detection indicates that there are many more deaths in the country than there should be given reported case numbers (so there must be more cases than are reported)."),
p("Active cases are total number of infections minus deaths and recoveries."),
p("For more information, see the 'About' tab.")
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("rawPlot"),
plotOutput("logPlot")
)
)
),
# ##### Growth Rate #####
tabPanel("Growth rate and curve flattening",
# Sidebar
sidebarLayout(
sidebarPanel(
titlePanel("Location selector"),
selectInput(inputId = "stateGrowthRate",
label = "Select State:",
choices = ddReg,
selected = ddNames[c(1, 3, 8, 9)],
multiple = TRUE)
),
mainPanel(
h5("Growth rate"),
p("This is the growth rate of the number of active cases for the last 10 days. It can be thought of as the interest rate, compounded daily."),
p("Positive is bad, negative is good. Progress in control would be indicated by steady decline in growth rate over time, and holding in negative territory."),
p("Note, days with low or zero growth followed by large spikes are reporting issues: countries miss a day (or several) of reporting and then aggregate cases into the following day."),
plotOutput("growthRate"),
hr(),
h5("Curve flattening index"),
p("This is a measure of how well a country is flattening the epidemic curve at any point in time. Positive values mean growth rates are declining at that point in time."),
p("Note, this last plot covers the entire time period of the pandemic, not just the last ten days."),
plotOutput("cfi"),
p("For more information, see the 'About' tab.")
)
)
),
tabPanel("About", br(),
fluidRow(column(12,
withMathJax(),
includeMarkdown("doc/about.Rmd")
)))
)
))