# energy-transition-analytics
A data pipeline and dashboard that identifies which countries are shifting
fastest toward renewable electricity **while** facing the fastest-growing
electricity demand — using Our World in Data's
public energy dataset.
## Data source & licensing
All data comes from the OWID Energy dataset,
downloaded directly from its public GitHub raw CSV
(`
raw.githubusercontent.com`).
No API key is required.
OWID's energy data is licensed **CC-BY** (Creative Commons Attribution). If you
reuse this project's outputs, please credit **Our World in Data** as the
underlying data source, per their license terms. OWID in turn compiles this
dataset from primary sources including Ember, the Energy Institute Statistical
Review of World Energy, and the World Bank; see OWID's own documentation for
full source attribution.
## Project structure
| File | Purpose |
|---|---|
| `ingest.py` | Downloads the OWID CSV and loads it into a pandas DataFrame. |
| `schema.sql` / `db.py` | SQLite schema (`energy_metrics`, `data_quality_flags`) and the loader, including rule-based validation (nulls, YoY sanity jumps, sparse-history detection). |
| `quality_scoring.py` | Deterministic, per-country statistical anomaly scoring on top of the rule-based checks. |
| `analysis.py` | Computes each country's renewables-growth and demand-growth rates and ranks them by a composite "transition momentum" score. |
| `forecast.py` | Backtests ARIMA, Holt-Winters, and a naive linear-trend baseline per country and auto-selects whichever wins, forecasting renewables share to 2030. |
| `server.py` | Flask backend serving the dashboard's JSON API — thin plumbing over the modules above, no analysis logic of its own. |
| `static/` | The dashboard frontend: plain HTML/CSS/vanilla JS (no build step, no framework), matching the design at this Claude Design mockup. |
| `validation/` | Reproducible scripts backing every threshold/weighting/model c …