Skip to content

Commit

Permalink
intro text, tooltips, and plot improvements (#46)
Browse files Browse the repository at this point in the history
* can download map as HTML file, tooltips added

* remove easyprint js (old/unneeded)

* table updates

* can download map as png or pdf. does not yet adjust to current view/zoom of user

* per hadley wickhams best practices, make package name all lowercase (EviAtlas --> eviatlas)

* style changes and ui tweaks to accomdate ezgis new heatmap

* heat map truncates long axis text; text size larger on axes/title/legend, visuals improved

* package can be called eviatlas while text can refer to EviAtlas

* removed unused files (get_obs).

* version 0.1

* tooltips on map saves, stronger enforce new tab on links, renaming per neal

* text alteration

* new start text, map links open in new tab, functions in /src

* move start text to tab panel
  • Loading branch information
afeierman committed Mar 21, 2019
1 parent 0580490 commit 6f0b05c
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.Rproj
.Rproj.user
.Rhistory
.RData
Expand Down
1 change: 1 addition & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ library(viridis)
library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(shinyBS)

#for shinyapps.io only
# webshot::install_phantomjs()
3 changes: 3 additions & 0 deletions html/AboutEvi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<meta content="text/html; charset=UTF-8" http-equiv="content-type">

<span class="c12"><h3>About EviAtlas</h3></span><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c6">EviAtlas is an Open Source tool for creating and hosting visualisations from databases of studies created within systematic maps and systematic reviews. The tool was created as part of the ongoing Evidence Synthesis Hackathon series of events (</span><span class="c4"><a class="c7" href="https://www.google.com/url?q=http://www.evidencesynthesishackathon.com&amp;sa=D&amp;ust=1553166383780000">www.evidencesynthesishackathon.com</a></span><span class="c0">) aimed at producing free-to-use tools to support systematic reviews and maps across disciplines.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c0">EviAtlas allows users to create a suite of visualisations from a database of studies, including Evidence Atlases (interactive geographical maps showing studies and their details over space), Heat Maps (cross tabulations of categorical variables that highlight clusters and gaps in the evidence), descriptive plots that help to visualise the evidence base (e.g. the number of publications per year), and human-readable databases that are easily filterable.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c6">EviAtlas is built on coding written in R (</span><span class="c4"><a class="c7" href="https://www.google.com/url?q=https://www.r-project.org/&amp;sa=D&amp;ust=1553166383781000">https://www.r-project.org</a></span><span class="c0">) and uses a Shiny App to provide a web-based user interface. As we develop the app further, we will provide source code to allow R users to further refine their visualisations.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c6">EviAtlas is currently in a testing phase but is fully functional. We intend to add further options and functionality in the near future. If you have any feedback, please contact Neal Haddaway (Research Fellow at the Stockholm Environment Institute): </span><span class="c4"><a class="c7" href="mailto:neal.haddaway@sei.org">neal.haddaway@sei.org</a></span><span class="c6">. </span></p><p class="c1"><span class="c0"></span></p><p class="c1"><span class="c0"></span></p>
2 changes: 2 additions & 0 deletions html/AboutSysMap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Systematic Maps and Systematic Reviews</h3>
<p class="c1"><span class="c0"></span></p><p class="c5"><span class="c6">Systematic maps and reviews are rigorous, comprehensive, transparent and repeatable methods for reviewing research literature on a particular topic. Systematic maps are overviews of nature of an evidence base relevant to a broad (open) question of policy or management relevance. Systematic reviews are detailed analyses of the findings of a group of similar studies, for example examining the effectiveness of an intervention or the impact of a factor. More information about systematic reviews and maps can be found for the following disciplines: </span><span class="c4"><a class="c7" href="https://www.google.com/url?q=http://www.environmentalevidence.org/&amp;sa=D&amp;ust=1553166383782000">environment</a></span><span class="c6">, </span><span class="c4"><a class="c7" href="https://www.google.com/url?q=https://campbellcollaboration.org/&amp;sa=D&amp;ust=1553166383783000">social welfare and international development</a></span><span class="c6">, </span><span class="c4"><a class="c7" href="https://www.google.com/url?q=https://www.cochrane.org/&amp;sa=D&amp;ust=1553166383783000">healthcare</a></span><span class="c0">.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c0">During the process of conducting a systematic map or systematic review, researchers typically produce a detailed database of relevant studies that includes various columns of descriptive information. Some of this data may be rich, textual descriptions (meta-data), and some of it may be categorical or numerical data (coding or quantitative data). Coding (for example different levels of a factor; high, medium, low, or different country names) allows a database to be easily filtered and searched, and allows the production of interactive visualisations of the evidence base to examine what research has been conducted, when, where, how, by whom, etc.. EviAtlas is the first Open Source tool that allows users to produce a range of different visualisations for their systematic reviews and maps. </span></p><p class="c1"><span class="c0"></span></p><p class="c1"><span class="c0"></span></p>
3 changes: 3 additions & 0 deletions html/HowEviWorks.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h3>How EviAtlas Works</h3>

<p class="c1"><span class="c10"></span></p><p class="c5"><span class="c0">Upload a systematic review dataset (csv format) using the panel on the right, and then use the left sidebar to view a systematic map generated from your dataset, as well as some common plots used in systematic reviews.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c6">Please ensure that your database is formatted in the correct way - column labels should all appear in the first row. To create an Evidence Atlas you will need one column with latitude data and one with longitude data; you can select these spatial variables in the Evidence Atlas pane. Please provide the lat/long in decimal degrees. </span><span class="c6">In the future we hope to provide tools to recognise multiple coordinate types</span><span class="c6">. If you have categorical variables that you wish to cross-tabulate in a Heat Map or other visualisation, EviAtlas currently requires that you store these categories in a single column. </span><span class="c6">In the future we hope to integrate </span><span class="c6 c11">tidy </span><span class="c6">principles that will allow you to aggregate and disaggregate complex data automatically.</span></p><p class="c1"><span class="c0"></span></p><p class="c5"><span class="c0">Please use the example dataset to see what EviAtlas can do!</span></p>
130 changes: 95 additions & 35 deletions server.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
## server.R ##

# load functions
source("GenHeatMap.R")
source("GenLocationTrend.R")
source("GenTimeTrend.R")
source("sys_map.R")
source("get_link_cols.R")
source("get_coord_cols.R")
source("src/GenHeatMap.R")
source("src/GenLocationTrend.R")
source("src/GenTimeTrend.R")
source("src/sys_map.R")
source("src/get_link_cols.R")
source("src/get_coord_cols.R")

# load data + text
load("data/pilotdata.rda")
start_text <- read_file("html/AboutEvi.html")
about_sysmap_text <- read_file("html/AboutSysMap.html")
how_works_text <- read_file("html/HowEviWorks.html")

# maximum upload size 100 MB-- could be increased if proves problematic for users and we have server space
max_file_size_mb <- 100
options(shiny.maxRequestSize = max_file_size_mb*1024^2)

Expand All @@ -27,16 +33,26 @@ shinyServer(
# DATA TAB
# if no data are available but input$sample_or_real == 'sample', show intro text
output$start_text <- renderPrint({
cat(start_text)
})
output$about_sysmap_text <- renderPrint({
cat(about_sysmap_text)
})
output$how_works_text <- renderPrint({
cat(how_works_text)
})
output$uploaded_attributes <- renderPrint({
if(is.null(data_internal$raw) & input$sample_or_real == 'user'){
cat("EviAtlas is an open-source tool for creating systematic maps, a key element of systematic reviews. Upload a systematic review dataset (csv format) using the panel on the right, and then use the left sidebar to view a systematic map generated from your dataset, as well as some common plots used in systematic reviews.
<h3>About Systematic Maps</h3><br>
Systematic Maps are overviews of the quantity and quality of evidence in relation to a broad (open) question of policy or management relevance. The process and rigour of the mapping exercise is the same as for systematic review except that no evidence synthesis is attempted to seek an answer to the question. A critical appraisal of the quality of the evidence is strongly encouraged but may be limited to a subset or sample of papers when the quantity of articles is very large (and even be absent in exceptional circumstances). More guidance can be found <a href='http://www.environmentalevidence.org' target='_blank' rel='noopener'>here</a>.<br><br>
For systematic maps to be relevant to policy and practice they need to be as up-to-date as possible. Consequently, at the time of acceptance for publication, the search must be less than two years old. We therefore recommend that systematic maps should be submitted no later than 18 months after the search was conducted."
)
}else{
cat("Upload a dataset using the panel to the right -->")
} else {
cat("<h3>Attributes of uploaded data:</h3>")
}
})
})

# output$help_text <- renderPrint({
# cat("<br><br><br><br>Find a bug? Have a suggestion for future improvements? Feel free to contact Neal Haddaway (Research Fellow at the Stockholm Environment Institute): <a href='mailto:neal.haddaway@sei.org'>neal.haddaway@sei.org</a></span>"
# )
# })


# if data are supplied, add them to data_internal
Expand Down Expand Up @@ -110,17 +126,24 @@ shinyServer(
}
})

output$filtered_table <- DT::renderDataTable(DT::datatable(data_internal$filtered, filter = c('top'),
caption = "Use the boxes below column headers to filter data",
class = c('display', 'compact'), style='bootstrap',
options = list(scrollX = TRUE, scrollY = TRUE, responsive=T)),
server = T)
output$filtered_table <- DT::renderDataTable(
DT::datatable(data_internal$filtered, filter = c('top'),
caption = "Use the boxes below column headers to filter data",
class = c('display', 'compact'),
style='bootstrap',
options = list(scrollX = TRUE,
scrollY = TRUE,
responsive=T)),
server = T)

# download the filtered data
output$download_filtered = downloadHandler('eviatlas-datatable-filtered.csv', content = function(file) {
s = input$filtered_table_rows_all
write.csv(data_internal$filtered[s, , drop = FALSE], file)
})
output$download_filtered = downloadHandler(
'eviatlas-datatable-filtered.csv',
content = function(file) {
s = input$filtered_table_rows_all
write.csv(data_internal$filtered[s, , drop = FALSE], file)
}
)

# map UI
output$map_columns <- renderUI({
Expand Down Expand Up @@ -186,7 +209,7 @@ shinyServer(
),
div(
style = "display: inline-block; width = '20%'",
title = "Use the Filter Data tab to subset data",
title = "Use the Map Database tab to subset data",
shinyWidgets::materialSwitch(
inputId = "map_filtered_select",
label = "Use filtered data?",
Expand All @@ -200,22 +223,59 @@ shinyServer(
} else {wellPanel('To use the map, upload data in the "About EviAtlas" tab.')}
})

observeEvent(input$map_filtered_select, {
observeEvent(input$map_filtered_select, {
# Change values for map inputs whenever button is toggled
updateSelectInput(session, "map_lat_select",
choices = if(input$map_filtered_select) {colnames(data_internal$filtered)} else {colnames(data_internal$raw)},
selected = if(input$map_filtered_select) {get_latitude_cols(data_internal$filtered)} else {get_latitude_cols(data_internal$raw)})
updateSelectInput(
session,
"map_lat_select",
choices = if (input$map_filtered_select) {
colnames(data_internal$filtered)
} else {
colnames(data_internal$raw)
},
selected = if (input$map_filtered_select) {
get_latitude_cols(data_internal$filtered)
} else {
get_latitude_cols(data_internal$raw)
}
)

updateSelectInput(session, "map_lng_select",
choices = if(input$map_filtered_select) {colnames(data_internal$filtered)} else {colnames(data_internal$raw)},
selected = if(input$map_filtered_select) {get_longitude_cols(data_internal$filtered)} else {get_longitude_cols(data_internal$raw)})
updateSelectInput(
session,
"map_lng_select",
choices = if (input$map_filtered_select) {
colnames(data_internal$filtered)
} else {
colnames(data_internal$raw)
},
selected = if (input$map_filtered_select) {
get_longitude_cols(data_internal$filtered)
} else {
get_longitude_cols(data_internal$raw)
}
)

updateSelectInput(session, "map_link_select",
choices = c("", if(input$map_filtered_select) {get_link_cols(data_internal$filtered)} else {get_link_cols(data_internal$raw)}))
updateSelectInput(session, "map_link_select",
choices = c("", if (input$map_filtered_select) {
get_link_cols(data_internal$filtered)
} else {
get_link_cols(data_internal$raw)
}))

updateSelectInput(session, "map_popup_select",
choices = if(input$map_filtered_select) {colnames(data_internal$filtered)} else {data_internal$cols},
selected = if(input$map_filtered_select) {colnames(data_internal$filtered)[1]} else {data_internal$cols[1]})
updateSelectInput(
session,
"map_popup_select",
choices = if (input$map_filtered_select) {
colnames(data_internal$filtered)
} else {
data_internal$cols
},
selected = if (input$map_filtered_select) {
colnames(data_internal$filtered)[1]
} else {
data_internal$cols[1]
}
)
})

# BARPLOT
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion sys_map.R → src/sys_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ sys_map <- function(studies_data, latitude,

if (links_user != "") {
links_input <- sapply(studies_data[links_user], as.character)
links = paste0("<strong><a href='", links_input, "'>Link to paper</a></strong>")
links = paste0("<strong><a target='_blank' rel='noopener noreferrer' href='",
links_input, "'>Link to paper</a></strong>")
} else {links <- ""}

if (!is.null(radius_user)) {
Expand Down
39 changes: 27 additions & 12 deletions ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ sidebar <- dashboardSidebar(
# sidebarUserPanel("EviAtlas Nav"),
sidebarMenu(
menuItem("About EviAtlas", tabName = "about", icon = icon("question")),
menuItem("Map Database", tabName = "home", icon = icon("map")),
menuItem("Filter Data", tabName = "data", icon = icon("database")),
menuItem("Bar Plots", tabName = "insightplots", icon = icon("home")),
menuItem("Evidence Atlas", tabName = "home", icon = icon("map")),
menuItem("Map Database", tabName = "data", icon = icon("database")),
menuItem("Descriptive Plots", tabName = "insightplots", icon = icon("home")),
menuItem("Heatmap", tabName = "heatmap", icon = icon("fire"))
)
)
Expand Down Expand Up @@ -44,10 +44,15 @@ body <- dashboardBody(
")),
tabItems(
tabItem(tabName = "about",
mainPanel(
tableOutput("start_text"),
tableOutput("data_summary")
),
fluidRow(
mainPanel(wellPanel(
tabsetPanel(
tabPanel(title = 'About EviAtlas', htmlOutput("start_text")),
tabPanel(title = 'About Systematic Maps', htmlOutput("about_sysmap_text")),
tabPanel(title = 'How to Use EviAtlas', htmlOutput("how_works_text")),
tabPanel(title = 'Data Attributes', htmlOutput("uploaded_attributes"), tableOutput("data_summary"))
))
),

#Sidebar panel for inputs
sidebarPanel(
Expand Down Expand Up @@ -76,7 +81,7 @@ body <- dashboardBody(
"text/csv",
"text/comma-separated-values,text/plain",
".csv"),
placeholder = "Systematic Map Data"
placeholder = "Systematic Map Data (100 MB Limit)"
)),
fluidRow(h5(strong("CSV Properties")),
column(6,
Expand Down Expand Up @@ -112,7 +117,7 @@ body <- dashboardBody(
selected = '"'
)))
))
))
)))
),

tabItem(tabName = "home",
Expand All @@ -123,9 +128,19 @@ body <- dashboardBody(
),
tabPanel('Save Map',
wellPanel(
downloadButton(outputId = "savemap_interactive", label = "Save Map (Interactive)"),
downloadButton(outputId = "savemap_png", label = "Save Map (png)"),
downloadButton(outputId = "savemap_pdf", label = "Save Map (PDF)")
downloadButton(outputId = "savemap_interactive",
label = "Save Map (Interactive)"),
downloadButton(outputId = "savemap_png",
label = "Save Map (png)"),
downloadButton(outputId = "savemap_pdf",
label = "Save Map (PDF)"),
bsTooltip("savemap_interactive", title = "Save an interactive HTML version of the map using the current display settings. This HTML map can then be easily hosted on your own website",
placement = "bottom", trigger = "hover"),
bsTooltip("savemap_png", title = "Save a static version of the map using the current display settings.",
placement = "bottom", trigger = "hover"),
bsTooltip("savemap_pdf", title = "Save a static version of the map using the current display settings.",
placement = "bottom", trigger = "hover")

)))
),
fluidRow(
Expand Down

0 comments on commit 6f0b05c

Please sign in to comment.