-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.R
89 lines (79 loc) · 3.15 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
# Rely on the 'WorldPhones' dataset in the datasets
# package (which generally comes preloaded).
library(rCharts)
library(shiny)
library(datasets)
library(magrittr)
library(XML)
library(reshape)
library(gsheet)
library(ggplot2)
library(plotly)
library(scales)
library(zoo)
library(pracma)
library(psych)
jetson <- "https://docs.google.com/spreadsheets/d/1oPTPmoJ9phtMOkp-nMB7WHnPESomLzqUj9t0gcE9bYA"
conflicts <- gsheet2text(jetson, sheetid = 819472314)
conflicts.long <- read.csv(text=conflicts)
Dates <- sapply(conflicts.long[,1],as.character.Date)
conflicts.long$Date <- as.Date(conflicts.long$Date, format="%m/%d/%Y")
odd_indexes<-seq(2,19,1)
regions <- colnames(conflicts.long[odd_indexes])
list_regs <- rep(NA,18)
# for (i in 1:18){
# list_regs[i] <- strsplit(regions[i], "_(?=[^_]+$)",perl=TRUE)[[1]][1]
# }
list_regs <- c("Awdal","Bay","Bakool","Banadir","Gedo", "Middle Juba", "Lower Juba",
"Middle Shabelle", "Lower Shabelle", "Hiiraan", "Galgaduud",
"Mudug","Nugaal", "Bari", "Sanaag", "Sool", "Togdheer", "Woqooyi Galbeed")
list_camps <- c("Dollo Ado")
shinyUI(
# Use a fluid Bootstrap layout
fixedPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "style.css"),
tags$script(src="main.js")
),
# Give the page a title
titlePanel("Predictive Engine: Project JETSON"),
p("Jetson is a project aimed at providing better data
analytics to make better decisions to adequately prepare
for contingencies in forced displacement situations.
The Predictive Analytics Engine (Jetson) is an applied
predictive analytics experiment taking concrete steps
to provide insights on the future of displacement.",tags$br(),
"The data behind the engine is anonymized, aggregated
per month and per region. Project Jetson uses machine-learning
for building a nonparametric algorithm (model) for each region.
The models used for each region represent the best 'fit' that
can explains the behaviour of seven years of historical data."),
# Generate a row with a sidebar
tabsetPanel(
tabPanel("Internally Displaced Persons", fluid = TRUE,
sidebarLayout(
sidebarPanel(
radioButtons("region", "Choose region", list_regs, selected = NULL, inline = FALSE),
downloadButton("downloadData", "Generate report"),
downloadButton("downloadCsv", "Generate csv")
),
mainPanel(
plotlyOutput("graph1"),
p("Click on the arrivals/algorithm name, to select or unselect the data on the graph",align="center")
)
)
),
tabPanel("Refugees", fluid = TRUE,
sidebarLayout(
sidebarPanel(
radioButtons("camp", "Choose camp", list_camps, selected = NULL, inline = FALSE)
),
mainPanel(
plotlyOutput("graph2"),
p("Click on the arrivals/algorithm name, to select or unselect the data on the graph",align="center")
)
)
)
)
)
)