Predicts Food Prices 3 Months Ahead
# Food Security — West Africa: What Moves the Price of Food
Capstone project — Thrive Africa / capstone-projects-march-2026, Project 4 (Food Security, Route A · integration).
## Business question
Is the rise in staple food prices in Ghana driven by weather, currency, or season — and where is it heading?
## Data
- **WFP food prices** (HDX) — market × commodity × date × pricetype, Ghana, 2006–2023. Filtered to Wholesale, normalized to price-per-KG. See `docs/data_dictionary.md` for the full cleaning rules.
- **Open-Meteo weather** — daily rainfall/temperature, downsampled to monthly, 2015–2023.
- **World Bank CPI** — annual, broadcast across each year's 12 months, used to deflate prices to real terms.
## Pipeline
```
Extract (requests, wbgapi, CSV)
-> Load (DuckDB, sql/01_staging.sql)
-> Clean (sql/02_clean.sql — pricetype filter, unit normalization)
-> Model schema + Transform (sql/03_marts.sql — region x month mart)
-> Analyse (sql/04_analysis.sql — LAG, rolling avg, volatility rank)
-> Predict (scikit-learn, in the notebook)
-> Dashboard (dashboard/streamlit_app.py)
```
## How to run
1. `pip install -r requirements.txt`
2. The dataset (`data/wfp_food_prices_gha.csv`) is committed directly in this repo — no separate download needed. If you replace it with a fresher pull from data.humdata.org, **check for an HXL tag row first** (is row 2 real data, or does it look like `#date,#adm1+name,...`?). If there's no HXL row, do **not** pass `skip=1` to `read_csv_auto` — it will corrupt the header. `sql/01_staging.sql` already reflects the no-skip version for this dataset.
3. Run `notebooks/04_food_security_integration_SOLVED.ipynb` top to bottom (Kernel → Restart & Run All).
4. `streamlit run dashboard/streamlit_app.py` — builds `project.duckdb` automatically on first run if it doesn't exist yet.
## Deploying to Streamlit Community Cloud
Before deploying, **verify on GitHub's own file browser** (not just locally) that these are all present at the repo root, sittin …