prepare-update-data-used-by-the-app.Rmd
# library(exploratorium)
devtools::load_all() # to be sure than the app_sys() used internaly by some function link to ./inst folder instaler of .libPaths()
#> ℹ Loading exploratoriumThe aim of this article is to show you how to update the data used by the app.
The data used by the app is extracted from Promotion Digital Database
via an ETL (Extract Load Transform) pipeline and then stored in
inst/data-projects as two separated datasets:
projects_fr.rdsprojects_de.rdsThose datasets are loaded at runtime by the app depending on the language selected by the user.
The ETL pipeline also uses .csv dictionary files to translate or modify the raw data.
The data preparation process must be repeated each time the raw data is modified or each time a modification is required to the data dictionaries.

Make sure that:
DB_HOST
DB_PORT
DB_USER
DB_PASSWORD
Then run the etl with:
exploratorium::prepare_app_data()You must modify directly the dictionaries used for the translations.
Dictionnaries used during data preparation are .csv
files located in inst/data-dic folder:
dic_variables.csvdic_cantons.csvdic_values.csvContains translations of all variables names of the raw data file
inst/data-projects-raw/PGV.xlsx.
Contains values in the columns status and other columns from the original excel file that was fed in the etl. Many of which should be removed in the future.
You will then need to rebuild the projects data:
exploratorium::prepare_app_data()