-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.R
304 lines (274 loc) · 15.4 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
library(shiny)
library(leaflet)
library(plotly)
library(visNetwork)
library(networkD3)
library(shinydashboard)
library(shinyjs)
library(shinyWidgets)
# Choices for drop-downs
vars <- c(
'Collision Vehicle 1' = 'VEHICLE.TYPE.CODE.1',
'Collision Vehicle 2' = 'VEHICLE.TYPE.CODE.2',
"Injuries" = "NUMBER.OF.PERSONS.INJURED",
"Deaths" = "NUMBER.OF.PERSONS.KILLED"
)
vars2 <- c(
"Injuries" = "NUMBER.OF.PERSONS.INJURED",
"Deaths" = "NUMBER.OF.PERSONS.KILLED"
)
vars3 <- c(
"All Vehicles" = "",
"Ambulance" = "AMBULANCE",
"Bicycle" = "BICYCLE",
"Bus" = "BUS",
"Fire Truck" = "FIRE TRUCK",
"Large Commercial Vehicle(6 or more tires)" = "LARGE COM VEH(6 OR MORE TIRES)",
"Motorcycle" = "MOTORCYCLE",
"Passenger" = "PASSENGER VEHICLE",
"Pick-up Truck" = "PICK-UP TRUCK",
"Small Commercial Vehicle(4 tires)" = "SMALL COM VEH(4 TIRES)",
"Taxi" = "TAXI"
)
vars4 <- c("All boroughs"="",
'Manhattan'='MANHATTAN',
'Brooklyn'='BROOKLYN',
'Queens'='QUEENS','Bronx'='BRONX')
shinyUI(dashboardPage(
dashboardHeader(title = "DM-MCDA",
tags$li(class = "dropdown", tags$a(icon("github"), href = "https://github.com/",title = "See the code on github"))
),
dashboardSidebar(sidebarMenu(
menuItem("Data Sources", tabName = "ds", icon = icon("database")),
menuItem("ARM", tabName = "arm", icon = icon("random")),
menuItem("MCDA", tabName = "mcda", icon = icon("users")),
menuItem("MAP", tabName = "map", icon = icon("map")),
menuItem("TMS", tabName = "tms", icon = icon("line-chart")),
menuItem("About", tabName = "about", icon = icon("info-circle"))
)),
dashboardBody(
# ensure links to sidebar menus
tags$script(HTML("
var openTab = function(tabName){
$('a', $('.sidebar')).each(function() {
if(this.getAttribute('data-value') == tabName) {
this.click()
};
});
}
")),
#to use mini sidebar
useShinyjs(),
# Include styling for the app
includeCSS("www/app.css"),
tabItems(
# Meta data section
tabItem(tabName = "ds",
# Boxes need to be put in a row (or column)
fluidRow(
column(width = 12,
tabBox(
side = "left",width = 12,
tabPanel("Meta Data Structure",
box(width = NULL, title = "Dataset:", status = "primary", DT::dataTableOutput("dataset_ds"),collapsible = TRUE),
box(width = NULL, title = "Decision Matrix:", status = "primary", DT::dataTableOutput("descion_matrix_ds"),collapsible = TRUE)
)
)
)
)
),
# First tab content
tabItem(tabName = "arm",
# Boxes need to be put in a row (or column)
fluidRow(
column(width = 3,
box(width = NULL, status = "info",
fileInput("file", "File")
),
box(width = NULL, status = "info", collapsible = T, title = "Parameters",
conditionalPanel(
condition = "input.samp=='Sample'",
numericInput("nrule", 'Number of Rules', 5)
),
conditionalPanel(
condition = "input.mytab=='graph'",
radioButtons('graphType', label='Graph Type', choices=c('itemsets','items'), inline=T)
),
conditionalPanel(
condition = "input.lhsv=='Subset'",
uiOutput("choose_lhs")
),
conditionalPanel(
condition = "input.rhsv=='Subset'",
uiOutput("choose_rhs")
),
conditionalPanel(
condition = "input.mytab=='grouped'",
sliderInput('k', label='Choose # of rule clusters', min=1, max=150, step=1, value=15)
),
conditionalPanel(
condition = "input.mytab %in%' c('grouped', 'graph', 'table', 'datatable', 'scatter', 'paracoord', 'matrix', 'itemFreq')",
radioButtons('samp', label='Sample', choices=c('All Rules', 'Sample'), inline=T),
uiOutput("choose_columns"),
sliderInput("supp", "Support:", min = 0, max = 1, value = 0.1 , step = 1/10000),
sliderInput("conf", "Confidence:", min = 0, max = 1, value = 0.5 , step = 1/10000),
selectInput('sort', label='Sorting Criteria:', choices = c('lift', 'confidence', 'support')),
numericInput("minL", "Min. items per set:", 2),
numericInput("maxL", "Max. items per set::", 3),
downloadButton('downloadData', 'Download Rules as CSV')
#radioButtons('lhsv', label='LHS variables', choices=c('All', 'Subset')), br(),
#radioButtons('rhsv', label='RHS variables', choices=c('All', 'Subset')), br()
)
)
),
column(width = 9,
tabBox(
side = "left",width = 12,
tabPanel('Summary', value='table', verbatimTextOutput("statistics")),
tabPanel('ScatterPlot', plotlyOutput("scatterPlot")),
tabPanel('FrequentItemset', value='itemFreq', plotOutput("itemFreqPlot", width='100%', height='100%')),
tabPanel('Grouped', value='grouped', plotOutput("groupedPlot", width='100%', height='100%')),
tabPanel('RulesGraph', visNetworkOutput("graphPlot", width='100%', height='800px')),
tabPanel('Parallel Coordinates', value='paracoord', plotOutput("paracoordPlot", width='100%', height='100%')),
tabPanel('Rules Table', value='datatable', DT::dataTableOutput("rulesDataTable"))
)
)
)),
tabItem(tabName = "mcda",
fluidRow(
column(width = 3,
box(width = NULL, status = "info",
fileInput("datafile", "File input:")
),
box(width = NULL, status = "info",
selectInput("txt", "Method:", choices = c('Electre Tri',
'Electre', 'Promethee'), selected = "Electre Tri")
),
box(width = NULL, status = "info",
sliderInput("slider", "Slider input:", 1, 100, 30),
actionButton("action2", "Compute!", class = "btn-primary")
)
),
column(width = 9,
tabBox(side = "left",width = 12,
tabPanel("Decision Matrix",dataTableOutput("filetable_DM1")),
tabPanel("Partial Concordance", dataTableOutput("partialConcordance_al_pr_gj")),
tabPanel("Global Concordance",dataTableOutput("globalconcordance")),
#tabPanel("PartialC_pr_al_gj", dataTableOutput("partialConcordance_pr_al_gj")),
tabPanel("Partial Discordance",dataTableOutput("partialDiscordance_al_pr_gj")),
#tabPanel("PartialD_pr_al_gj",dataTableOutput("partialDiscordance_pr_al_gj")),
tabPanel("Credibility",dataTableOutput("credibility")),
tabPanel("Relations",dataTableOutput("relations")),
tabPanel("Assignments",dataTableOutput("assignment"))
)
)
)
),
tabItem(tabName = "map",
tabPanel("Interactive Map",
div(class="outer",
tags$head(
# Include our custom CSS
includeCSS("styles.css"),
includeScript("gomap.js")
),
leafletOutput("map", width="100%", height="100%"),
# Shiny versions prior to 0.11 should use class="modal" instead.
absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
width = 330, height = "auto",
h2("Vehicle Collisions"),
selectInput("color", "Color", vars),
selectInput("size", "Size", vars2, selected = "NUMBER.OF.PERSONS.INJURED"),
checkboxInput("cluster", "Add Cluster"),
helpText("Cluster numbers show total accidents for each area",
"(applies to all vehicles only)"),
radioButtons("vehicle", "Show Just One Vehicle", vars3, selected = '')
),
tags$div(id="cite",
'Data from: ', tags$em('Data Details of Vehicle Collisions'), ' | CNPAC Data.
Details of Vehicle Collisions in Marrakech City provided by the
Ministry of Equipment, Transport and Logistics of Morocco.'
)
)
)
),
tabItem(tabName = "tms",
fluidRow(
column(width = 3,
box(width = NULL, status = "info",
numericInput("months", label = "Months to Predict",
value = 12, min = 12, max = 144, step = 12)
),
box(width = NULL, status = "info",
selectInput("interval", label = "Prediction Interval",
choices = c("0.80", "0.90", "0.95", "0.99"),
selected = "0.95")
),
box(width = NULL, status = "info",
checkboxInput("showgrid", label = "Show Grid", value = TRUE),
actionButton("action2", "Search", class = "btn-primary")
)
),
column(width = 9,
tabBox(width = NULL,
tabPanel("Predicting The Injury", dygraphOutput("dygraph1")),
tabPanel("Predicting The Deaths", dygraphOutput("dygraph2"))
)
))
),
tabItem(tabName = "about",
fluidRow(
column(width = 3,
box(width = NULL, status = "info",
h4("Data model for ARM"),
p("For general use of this app, you need to prepare your data with according to your needs,
the data model look like this csv file"),
br(),
downloadButton("dataset_model", label = "Dataset model"),
br(),
br(),
h4("Data model for MCDA"),
p("For general use of this app, you need to prepare your data according to your needs,
the data model look like this csv file"),
br(),
downloadButton("decision_matrix_model", label = "Decision matrix model"),
br(),
br()
)
),
column(width = 9,
box(width = NULL, status = "info",
h4("Abstract"),
p("Today’s ultra-connected world is generating massive volumes of data stored in database and cloud
environment especially in logistics and transportation, these large data need to be analyzed in order
to extract useful knowledge, and present it as a valid element for logistics managers for further use
such as road safety, shipping delays and shipping optimization. The potential of data mining algorithms
is largely untapped, this paper shows large-scale techniques such as associations rule analysis and time
series to improve road safety by identifying hot-spots in advance and giving chance to drivers to avoid
the dangers. Indeed, we proposed a framework based on association rules technique as a preliminary task
to analyze and extract relationships between variables related to road accident, and then use multiple
criteria analysis to select relevant associations rules. The developed system is flexible and allows
intuitive creation and execution of different algorithms for an extensive range of road traffic topics.
DM-MCDA can be expanded with new topics on demand, rendering knowledge extraction more robust and provide
meaningful information that could help in developing suitable policies for decision makers. "),
br(),
h4("Data Source"),
p("Description: ","Data Details of road accident in Morocco provided by CNPAC: National Committee
for the Prevention of Traffic Accidents (Morocco)."),
p("Source: ",a("Data Details of rainfall | CNPAC",href="http://www.equipement.gov.ma")),
br(),
h4("Authors Information"),
p("¹Addi Ait-Mlouk, ²Tarik Agouti"),
p("¹Department of computing Science, Umeå University, Umeå, Sweden "),
p("²Cadi Ayyad University, Faculty of science semlalia, Marrakech, Morocco "),
br(),
h4("Aknowledgement"),
p("The authors would like to thank Jihane Mounji Manji for her support"),
h4("Maintainer"),
p("Email: aitmlouk@gmail.com")
)
)
))
))
))