A website to present the early results of exploring the availability of micro-data and published statistics about 12 priority SDG indicators for Refugees and IDPs, developed for the United Nations High Commissioner for Refugees (UNHCR).
This platform is built using Laravel/PHP. The front-end uses an R shiny dashboard and the admin panel uses Backpack for Laravel.
- Clone repo:
git clone git@github.com:stats4sd/unhcr_site.git
- Copy
.env.example
as a new file and call it.env
- Update variables in
.env
file to match your local environment:- Check APP_URL is correct
- Update DB_DATABASE (name of the local MySQL database to use), DB_USERNAME (local MySQL username) and DB_PASSWORD (local MySQL password)
- Create a local MySQL database with the same name used in the
.env
file - Run the following setup commands in the root project folder:
composer install
php artisan key:generate
php artisan backpack:install
npm install
npm run dev
- Migrate the database:
php aritsan migrate:fresh --seed
(or copy from the staging site)
Requirements:
- R Studio
- Packrat
Process:
- Open the
unhcr.Rproj
in R Studio. - It will probably give a warning: "Packrat is not installed in the local library -- attempting to bootstrap an installation...". It may take a minute or so to load fully, but once you see the Files, Packages sidebar etc, you're ready to go.
- run
packrat::restore()
. This will read thepackrat/packrat.lock
file and attempt to install the required packages locally.
- NOTE: I had to run
packrat::restore()
twice for this project. The first run fails when installing gtable. But the second run successfully installs gtable and then finishes the process.
- You should then be able to run the app through RStudio!
Note - The R Shiny app now requires the .env file, and will fail on database connection without it. (Copy the .env.example file to .env, and update the DB_ details if needed).