Skip to content

CorrelAid/silbernetz-public

Repository files navigation

Silbernetz Dashboard

Shiny Dashboard for Silbernetz e.V. Initially developed as part of a CorrelAid data4good volunteering project between 2021 and 2022. Revisited in autumn 2025 to update the app.

App

  • app.R
  • functions in R are automatically loaded at startup

Data

Call data

  • call data is stored in data/raw/annual/. Each year has its own csv file.
  • Fake data is provided in data/raw/annual_fake/.
  • Real data is not part of this repository due to data protection concerns.
  • Real data goes back to 2020-09-05.

Geo data

  • data/geo/DEU_admin: shapefile for Bundesländer
  • mapping_bula.csv: mapping containing additional information for each Bundesland
  • mastertable_vorw_bdl.csv: maps Ortskennzahl ("Vorwahl") to Bundesland.

additional files

  • qmd/create_map.qmd: create map without starting app
  • qmd/diagnostics.qmd: some data quality analyses (e.g. duplicates, data coverage)

Setup

General setup

  1. install R if not already installed on your system
  2. Install Font Open Sans on your operating system. You can find the .tff files in assets/font. Google "install tff on [windows|mac|linux]" to find out how to install a font on your operating system.

Setup with fake data

To get started without accessing the data via the API, you can use the fake data provided with the repository in the folder data/raw/annual_fake/

  1. Clone or download this repository and place it into a suitable location on your computer.
  2. install dependencies
install.packages("renv")
renv::restore()
  1. Copy the .env-template to .env and set the DATA_FOLDER variable as follows:
DATA_FOLDER="data/raw/annual_fake/"
  1. Start the app
shiny::runApp("app.R")

⚠️ In order to work with real data and/or work on the "Zahlen aktualisieren" (Update) functionality, you need authentication details for the hotline provider API. Please see instructions on "Setup with real data".

Setup with real data

  1. Clone or download this repository and place it into a suitable location on your computer.
  2. Obtain a historical dump of the real data and put the csv files into data/raw/annual/
  3. install dependencies
install.packages("renv")
renv::restore()
  1. Create .env file: Copy .env-template to .env and fill in values under "Authentication for API". Values can be obtained from your contact at CorrelAid.
  2. Start the app:
shiny::runApp("app.R")

Package management

Package management is done with renv.

To install the environment:

install(renv)
renv::restore()

To add new packages:

renv::install("packagename") # installs new package 
renv::snapshot() # adds new package to the renv.lock file  

For other potentially useful functionality (updating packages...) of renv, refer to the renv documentation.

Deployment

With bash file

  1. Write a bash file that allows to start the app without having to start RStudio looking something like this with the appropriate paths:
"C:/Program Files/R/R-3.6.3/bin/Rscript.exe" -e "shiny::runApp('C:/Users/USER/Desktop/cards', launch.browser = TRUE)"

Known issues / Limitations

OneDrive on Windows-Machines

We encountered the problem that if the default user directory is completely set up with OneDrive so that all files get synchronized, R can run into problems when installing new packages and we weren’t able to install the silbRnetz package. The best way to work around this, was to make sure that R is installed in a directory not linked to OneDrive

Deployment on Windows

Workflow New Machine

Prerequisites

  • install R
    • on machines with admin rights, this will install to C:\Programme\R\R-4.5.2
    • on machines without admin rights, installation location is C:\Users\[user]\AppData\Local\Programs\R\R-4.5.2
  • install R Tools
  • install git

Clone

  • start Git CMD in the background
  • manually download 0-clone.bat and double-click on it in the Downloads folder. This should start the command prompt ("Eingabeaufforderung") and clone the repository.
  • the content of the repository will be put in Dieser PC\[name]\Dokumente\silbernetz-dashboard

install R packages

  • open Command prompt ("Eingabeaufforderung")
  • cd to project folder: cd Documents\silbernetz-dashboard
  • C:\Programme\R\R-4.5.2\bin\R
  • in the R console:
    • install renv: install.packages("renv")
    • renv::install() (not restore wbecause that somehow builds from source?)

Note: installation of s2 package takes a while (> 10 minutes).

Move files

  1. move .env to project root
  2. move csv files into data/raw/annual

In real life

  • put on USB stick:
    • installers (Git, R, R Tools)
    • .env
    • annual
    • 0-clone.bat
  • insert USB stick into machine and pull all assets into Downloads
  • start Git installer and follow default installation except:
    • don't use vim but Notepad
    • change default branch to main
    • don't create menu entry
  • simultaneously, start R installer -> follow default installation except:
    • don't create Desktop shortcut
  • once Git has finished, double click 0-clone.bat to clone the repo and open it in the file explorer
    • copy csv files from annual into the data/raw/annual folder of the repository
    • copy .env into root folder of repository
  • once R installation is finished, start installing RTools -> follow default installation
  • open command prompt ("Eingabeaufforderung")
    • cd Documents\silbernetz-dashboard
    • open R console: Path depends on whether the installation was local or with admin rights (see above). the path within the R folder is bin/R
    • renv should start bootstrapping itself, i.e. installing itself
  • wait until RTools installation has finished
  • then: renv::install()
  • in the meantime, create shortcut on Desktop: right click on bat file -> "Weitere Optionen anzeigen" -> "Verknüpfung erstellen" -> copy paste the Verknüpfung to Desktop and potentially rename
    • windows_deployment/start_dashboard.bat for when the user has admin rights and R was isntalled to C:\Programme
    • `windows_deployment/start_dashboard_local_rinstall.bat for when the user does not have admin rights and R was installed to C:\Users[user]\AppData... (see above)

Workflow Update Code

About

Silbernetz dashboard code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published