# Ethiopia Electricity Analysis
A Python-based data analysis of Ethiopia's electricity sector using World Bank open data.
**Author:** Netsanet Worku
**Institution:** Madda Walabu University
**Indicators:**
- Electric power consumption per capita — `EG.USE.ELEC.KH.PC`
- Access to electricity (% of population) — `EG.ELC.ACCS.ZS`
---
## Setup
1. **Clone / download** this repository and `cd` into the project root:
```bash
cd ethiopia-electricity-analysis
```
2. **Create and activate a virtual environment** (recommended):
```bash
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
```
3. **Install dependencies** with pinned versions:
```bash
pip install -r requirements.txt
```
---
## Data Download
Data is fetched automatically from the World Bank API the first time the notebook or the data-collection script is run.
To download and cache the raw data manually:
```bash
python -c "import config; from src.data_collector import collect_all; collect_all(config)"
```
Raw CSV files are saved to `data/raw/`:
- `data/raw/EG.USE.ELEC.KH.PC.csv`
- `data/raw/EG.ELC.ACCS.ZS.csv`
If the API is unreachable, the pipeline falls back to these cached files automatically. If the files are also missing, a descriptive error is raised.
---
## Running the API
After installing dependencies, run the FastAPI application from the project root:
```bash
uvicorn app:app --host 0.0.0.0 --port 8501
```
Then open:
-
localhost for the HTML landing page
-
localhost for the interactive OpenAPI docs
-
localhost for JSON summary results
-
localhost for the cleaned dataset
-
localhost for the generated Markdown report
## Vercel deployment
This repository includes a `vercel.json` file at the project root that routes all incoming requests to `app.py` and uses Vercel's Python runtime. After pushing to GitHub, deploy with the Vercel CLI:
```bash
vercel --pr …