Spaces:
Running
Running
| # data/ | |
| Runtime data directory for UNHCR Refugee Statistics. | |
| ## Structure | |
| ``` | |
| data/ | |
| βββ scripts/ | |
| β βββ unhcr_downloader.py # Full UNHCR API downloader (all endpoints) | |
| β βββ enrich_downloader.py # Targeted per-country enrichment downloader | |
| β βββ query_data.py # Runtime query layer (used by agent tools) | |
| β βββ refresh_data.py # Staleness check + re-download | |
| βββ raw/ # Raw API responses (gitignored, regenerate) | |
| β βββ .gitkeep | |
| βββ processed/ # Merged flat JSON per endpoint (gitignored) | |
| βββ .gitkeep | |
| ``` | |
| ## Setup | |
| ```bash | |
| cd data/scripts | |
| # First run β downloads all UNHCR data (~5-7 min): | |
| python3 unhcr_downloader.py --all | |
| # Then enrich countries.json with live stats (~4 min): | |
| python3 enrich_downloader.py | |
| # Output: specs/data/countries_enriched.json | |
| # Annual refresh: | |
| python3 refresh_data.py | |
| ``` | |
| ## Data license | |
| All UNHCR data is published under **CC BY 4.0**. | |
| Source: [UNHCR Refugee Statistics API](https://api.unhcr.org/population/v1/) | |
| Attribution required in any public-facing use. | |