This repository contains all materials that were used to setup a (semi-)automated workflow and to deploy a ShinyApp that interactively visualizes the annual report data for countreis debt situation by erlassjahr.de.
The goal of CorrelAid was to help the team of erlassjahr to automate their data generation process and to develop and implement an interactive web application where users can explore the debt situation of countries, complementary to their annual report.
A detailed description of the project, its implementation and the impact can be found in the project description here.
In order to run the app locally, do the following:
- clone this repository
- setup R environment
renv::restore()
- Run app
runApp('erlassjahr_map/app.R') # german version
runApp('erlassjahr_map/app_en.R') # english version
The data is licensed by Erlassjahr e.V. under a Creative Commons Attribution 4.0 International License. Please see LICENSE.md for more detailed information.
The code is licensed by CorrelAid e.V. under a MIT License. Please see LICENSE.md for more detailed information.
Below is a (reduced) structure of the repo.
.Rprofile
.gitignore
Anleitung_Update_Karte.docx
Anleitung_zur_Excel_Vorlage.docx
data
|-- final_data_2019.RData
|-- final_data_2020.RData
erlassjahr.Rproj
erlassjahr_map
|-- app.R
|-- app_en.R
|-- data
| |-- final_data_2020.RData
| |-- year_data.Rdata
|-- map_files
| |-- ...
|-- modules
| |-- graphics.R
| |-- legends.R
|-- rsconnect
| |-- shinyapps.io
| | |-- erlassjahr
| | | |-- erlassjahr_map.dcf
|-- symbols
| |-- ...
|-- www
| |-- ...
main.Rmd
renv.lock
renv
|-- ...
scripts
|-- data_preparation.R
|-- functions.R
|-- template_setup.R
There are 4 main components to this repository.
Besides files to setup the Rproject and to make sure that all dependencies are loaded (using renv
), the root has three important files that detail how to use this repo to setup the automated data generation process and how to publish the ShinyApp (for more details, see the project description here).
main.Rmd
is the main file where that executes all scripts to setup an excel template, to process the data and to deploy the ShinyApp. More details can be found in the two .docx files in the root and the project description.Anleitung_zur_Excel_Vorlage.docx
is a description of how to execute the first part of themain.Rmd
to generate a new Excel file containing the static information from the previous year as well as scraping information from the World Bank API (using theWDI
package in R). To allow further comments and fully customization, this file is a .docxAnleitung_Update_Karte.docx
details the second part in themain.Rmd
and specifies the steps required to automatically categorize states and how to eventually update and deploy the shinyapp. Again, for customization, this file is a .docx.
The data folder contains the final data for all debt years.
This folder is used to generate the ShinyApp. There are two app files: app.R
is for the German version and app_en.R
for the English version of the map. Both source the same files in the subfolders, i.e., the data, the helper functions in modules
or any other source files, such as images or shape files for the map.
data_preparation.R
generates the new Excel file for a given yearfunctions.R
contains helper functionstemplate_setup.R
is the original script that was used to generate the first automated version based on the raw dataset for the debt report in 2020.