This repository contains two main pieces of code:
- the
/silbRnetz
package - the shiny app interface in
/shinyapp
and the setup follows this order :
- Install R and Positron or RStudio
- Download/clone the repository
- Install Font Open Sans
All the data is obtained from the API using the authentication provided
by the api_spec.R
. It then gets processed to a level that preserves
the anonymitiy of all callers to an appropriate level and gets stored
locally under /data/raw
.
To get started without accessing the data via the API, you can use the fake data provided with the repository.
- rename
data/raw/current_data_fake.csv
todata/raw/current_data.csv
. - start the app:
shiny::runApp("shinyapp/app.R")
You won't be able to use the "Zahlen aktualisieren" button.
- obtain the
api_spec.R
file and place this file under/R
. The valid keys can be obtained from Inopla and the final file should look like this:
url_base <- "url"
api_urls <- list()
api_urls[['Dest']] <- paste(url_base, "hash1/Statistics/EVN/Destinations", sep = '')
api_urls[['Dest_Count']] <- paste(url_base, "hash2/Statistics/EVN/Destinations/COUNT", sep = '')
api_urls[['Numbers']] <- paste(url_base, "hash3/Statistics/EVN/Numbers", sep = '')
api_urls[['Numbers_Count']] <- paste(url_base, "hash4/Statistics/EVN/Numbers/COUNT", sep = '')
api_urls[['Callerlists']] <- paste(url_base, "hash5/Lists/Callerlists/1870/Items", sep = '')
-
Setting up the data can be done in two ways: The first possibility is just to copy an existing file called
current_data.csv
from an old installation intodata/raw
. The second option is to call thecreate_current_data
file from the package manually and give it the corresponding path where to write thecurrent_data.csv
file (should bedata/raw
). -
start the app:
shiny::runApp("shinyapp/app.R")
Packages are very outdated but a (hopefully working) state has been collected in an renv environment.
To install:
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.
The folder silbRnetz
contains an internal R package.
it will be installed when using renv::restore()
from the local tarball silbRnetz_0.0.12.tar.gz
.
Over the course of the project, you will potentiall write new code and/or refactor old code in the silbRnetz package. To make this available to the app, you need to load the changed functions into R. To do this, execute in the console whenever you changed something:
devtools::load_all("silbRnetz")
To start the app, you can either use the RStudio interface in shinyapp/app.R
or in the console:
shiny::runApp("shinyapp/app.R")
- 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)"
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
The map-drawing function with the corresponding fonts still causes trouble on Mac.