-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
279 lines (272 loc) · 15.1 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
library(shiny)
library(bs4Dash)
library(readxl)
library(dplyr)
library(tidygeocoder)
library(janitor)
library(leaflet)
library(plotly)
library(DT)
library(leafpop)
library(factoextra)
library(rtweet)
library(tidytext)
library(ggwordcloud)
library(tidyquant)
library(tidyverse)
library(waiter)
library(shinycssloaders)
dashboardPage(
preloader = list(html = tagList(spin_1(), "Loading ..."), color = "#18191A"),
fullscreen = TRUE,
help = TRUE,
dashboardHeader(
title = dashboardBrand(
title = "Policy Amendments",
color = "warning",
href = "https://en.wikipedia.org/wiki/Northern_Cape",
image = "nc_logo.jpg"
),
skin = "light",
status = "white"), # end of header
dashboardSidebar(
skin = "light",
status = "warning",
sidebarUserPanel(
image = "data_analysis.jpg",
name = " Analysis"
),
sidebarMenu(
menuItem("NR & HDI Amount", tabName = "nha", icon = icon("map-marked")),
menuItem("Natural Resource", tabName = "nr", icon = icon("globe-africa")),
menuItem("Human Development Index", tabName = "hdi", icon = icon("people-carry")),
menuItem("Policy Intelligence", tabName = "pi", icon = icon("twitter")),
menuItem("Dashboard Info", tabName = "di", icon = icon("info"))
)
), # end of sidebar
dashboardBody(
tabItems(
tabItem("nha",
fluidPage(
fluidRow(
column(9,
box(title = "Indicator Mapping", status = "white",
width = 12, icon = icon("map-marked-alt"),
solidHeader = TRUE, maximizable = TRUE, elevation = 3,
withSpinner(leafletOutput("tab1_map"))
)),
column(3,
box(title = "View Card", status = "lightblue",
icon = icon("filter"),
width = 12, solidHeader = TRUE,
uiOutput("attr_sel1"),
strong("Cities not recognised by OpenStreetMap"),
p(" "),
withSpinner(dataTableOutput("tab1_tbl", height = 2))))
)
)), # end of nha tab
tabItem("nr",
fluidPage(
fluidRow(
column(3,
box(title = "View Card", status = "warning",
icon = icon("filter"),
width = 12, solidHeader = FALSE, elevation = 5,
uiOutput("dist1"),
numericInput("clustnum1", "Enter Number of Groups",
value = 2,
min = 2, max = 8,
width = "auto"))),
column(4,
box(title = "Indicator Distribution", status = "lightblue",
icon = icon("chart-area"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotlyOutput("distplt1")))),
column(5,
box(title = "Natural Resource City Groups", status = "lightblue",
icon = icon("object-group"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotlyOutput("clustplt1"))))
),
fluidRow(
column(6,
box(title = "City Group Mapping", status = "lightblue",
icon = icon("map-marked-alt"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(leafletOutput("clust_nr")))),
column(6,
tabBox(maximizable = TRUE, width = 12,
solidHeader = FALSE, status = "lightblue",
tabPanel("Group Table", icon = icon("table"),
withSpinner(dataTableOutput("clustTbl1"))),
tabPanel("NR Group Count", icon = icon("chart-bar"),
withSpinner(plotlyOutput("clustbar1")))))
)
)), # end of nr tab
tabItem("hdi",
fluidPage(
fluidRow(
column(3,
box(title = "View Card", status = "warning",
icon = icon("filter"),
width = 12, solidHeader = FALSE, elevation = 5,
uiOutput("dist2"),
numericInput("clustnum2", "Enter Number of Groups",
value = 2,
min = 2, max = 8,
width = "auto"))),
column(4,
box(title = "Indicator Distribution", status = "lightblue",
icon = icon("chart-area"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotlyOutput("distplt2")))),
column(5,
box(title = "Human Development City Groups", status = "lightblue",
icon = icon("object-group"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotlyOutput("clustplt2"))))
),
fluidRow(
column(6,
box(title = "City Group Mapping", status = "lightblue",
icon = icon("map-marked-alt"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(leafletOutput("clust_hdi")))),
column(6,
tabBox(maximizable = TRUE, width = 12,
solidHeader = FALSE, status = "lightblue",
tabPanel("Group Table", icon = icon("table"),
withSpinner(dataTableOutput("clustTbl2"))),
tabPanel("HDI Group Count", icon = icon("chart-bar"),
withSpinner(plotlyOutput("clustbar2")))))
)
)
), # end of hdi tab
tabItem("pi",
fluidPage(
fluidRow(
column(5,
box(title = "Query Box", status = "white",
icon = icon("search"), elevation = 5,
width = 12, solidHeader = TRUE, maximizable = TRUE,
textInput(inputId = "query", label = "Topic/ Hashtag", value = "#water",
placeholder = "Type any NR or HDI indicator, e.g, #water
"),
sliderInput(
inputId = "n_tweets",
label = "Number of tweets:",
min = 1,
max = 2000,
value = 50),
textInput(inputId = "location", label = "Location", value = "South Africa"),
sliderInput(
inputId = "n_miles",
label = "Twitter Search Radius (miles)",
min = 1,
max = 2000,
value = 500),
actionButton(inputId = "submit", "Submit Query", status = "warning"))),
column(7,
box(title = "Tweet Proximity: Search Radius", status = "white",
icon = icon("map-marked-alt"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(leafletOutput("tweet_prox"))))),
fluidRow(
column(6,
box(title = "Sentiment Polarity", status = "white",
icon = icon("users"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotlyOutput("sent_plt")))),
column(6,
box(title = "Feedback: Sentiment Word Cloud", status = "white",
icon = icon("comments"),
width = 12, solidHeader = TRUE, maximizable = TRUE,
withSpinner(plotOutput("word_plt"))))
)
)
), # end of pi tab
tabItem("di",
fluidPage(
titlePanel("Policy Amendments"),
h2("Introduction"),
p("During the past decade, advances in information technology have ignited a revolution
in decision-making, from business to sports to policing. Previously,
decisions in these areas had been heavily influenced by factors other than empirical
evidence, including personal experience or observation, instinct, hype, and dogma
or belief. The ability to collect and analyse large amounts of data, however,
has allowed decision-makers to cut through these potential distortions to discover
what really works."),
p(strong("Policy - "), "A course or principle of action adopted or proposed by an
organization or individual. Policy is a deliberate system of guidelines
to guide decisions and achieve rational outcomes."),
p("The purpose of this dashboard is to understand how the percentage of",
strong("Natural Resources (NR) and Human Development Index (HDI) "), "varies in",
strong("Northern Cape (NC)"), ". This is for the purpose of providing data-driven
policy recommendations. Policy recommendations that considers",
strong("geographic mapping "), "of cities or towns and what",
strong("citizens complain about "), "(policy intelligence)"),
h2("Natural Resources"),
p(strong("Natural Resources - "), "Natural resources are materials from the Earth
that are used to support life and meet people’s needs"),
p(strong("Natural Resource Policy - "), " A program that prepares individuals to
plan, develop, manage, and evaluate programs to protect and regulate
natural habitats and renewable natural resources"),
h4("Natural Resource Indicators used in Dashboard"),
tags$ul(
tags$li(strong("Availability of water: "), "Rainfall, Dams, Perennial rivers,
Ground water potential, Boreholes"),
tags$li(strong("Agricultural Potential: "), "Crop production / Irrigated land, Grazing Capacity,
Agro-processing facilities, Land capability, Aridity zones"),
tags$li(strong("Mining Potential: "), "Active mines, Mineral deposits, Mining applications"),
tags$li(strong("Tourism Potential: "), "Terrain index, Cultural and heritage sites"),
tags$li(strong("Environment Sensitivity: "), "Protected and Conservation Areas, Biodiversity and
Geohazards, NFEPA rivers and wetlands.")),
p(strong("Course of action/Recommendation example - "), "Improve the look
of the cities for more tourism attraction, supply more water to cities
that need it. Identify possible short routes between Cities and Towns
with similar natural resources and aid where needed."),
strong("Course of Action or Recommendation Example:"),
img(src = "nr_policy.jpg", height = 550, width = 980),
br(),
br(),
h2("Human Development Index"),
p(strong("Human Development - "), "Human development is defined as the process of
enlarging people’s freedoms and opportunities and improving their well-being"),
p(strong("Human Development Index - "), "The HDI is a summary measure of human
development. The HDI is a summary composite measure of a country’s average
achievements in three basic aspects of human development:
health, knowledge and standard of living. It is a measure of
a country’s average achievements in three dimensions of human development"),
h4("Human Development Index Indicators used in Dashboard"),
tags$ul(
tags$li(strong("Education: "), "Primary education ( % > 20 years old with primary education only),
Matric pass rate (% Matric pass rate 2017)"),
tags$li(strong("Income: "), "Average per capita income (personal income),
Population living below breadline
(% population living below national mean level of living in 2011),
Social grant dependency (% population receiving social grants)"),
tags$li(strong("Occupation: "), "Unskilled workers (% of unskilled workers)"),
tags$li(strong("Health Status: "), "HIV/AIDS status (% Population with HIV/AIDS)"),
tags$li(strong("Housing: "), "Informal housing (% population living in informal housing units)")),
p(strong("Course of action/Recommendation example - "), "More educators,
Jobs and medical specialists to improve HDI"),
strong("Course of Action or Recommendation Example:"),
img(src = "hd_policy.jpg", height = 550, width = 980),
br(),
br(),
h2("Policy Intelligence"),
p(strong("Twitter For Analysis - "), "Twitter can provide key insights into
what citizens are saying about Natural Resources and the Human Development
Index. This is a great way to find out about what is happening or trending."),
p(strong("Sentiment - "), "A sentiment is a view or opinon that is
held or expressed. Similar to: View, point of view, feeling, attitude,
thought. Positive and negative sentiments can be extratced from the tweets
posted on twitter."),
p(strong("Positive Sentiment - "), "This can highlight where citizens are
positively responding to NR and HDI delivery."),
p(strong("Negative Sentiment - "), "This can highlight key issues citizens
care about.")
)) # end di tab
) # end of tabItems
) # end of body
) # end of Page