Getting Started¶
Prerequisites¶
R Packages¶
The app requires the following R packages:
# Core Shiny packages
install.packages(c("shiny", "shinydashboard", "shinyWidgets",
"shinycssloaders", "shinyBS", "shinyjs"))
# Data manipulation
install.packages(c("dplyr", "tidyr", "readr", "data.table", "stringr"))
# API and web
install.packages(c("httr", "jsonlite", "RCurl", "rsdmx"))
# Visualization
install.packages(c("plotly", "DT"))
# Other utilities
install.packages(c("countrycode", "readxl", "stringdist", "base64enc"))
# DHS data
install.packages("rdhs")
Running Locally¶
Option 1: RStudio¶
- Open the
survey_data_fetcher.Rprojfile in RStudio - Open
app.R - Click "Run App" or press
Ctrl+Shift+Enter
Option 2: Command Line¶
cd /path/to/survey_data_fetcher
R -e "shiny::runApp()"
Option 3: With specific port¶
shiny::runApp(host = "0.0.0.0", port = 3838)
Accessing on Hugging Face¶
The app is deployed at:
https://huggingface.co/spaces/CIJBoulange/survey-data-fetcher
No installation required - just open in your browser.
Environment Variables¶
Set up a .Renviron file with your API keys:
# .Renviron
# Required for UNWPP data fetching
UNWPP_TOKEN=your_unwpp_api_token_here
# Required for GitHub database integration
GITHUB_TOKEN=ghp_your_personal_access_token_here
On Hugging Face Spaces, add these as secrets in Settings.
Getting a UNWPP Token¶
- Go to population.un.org/dataportal
- Register for an account
- Request API access to get your token
Next Steps¶
Once set up, see Fetching Data for a complete workflow example.