Logo Lanfrica

ianvwyk11/loadshedding-etl

Domain:

digital infrastructureenvironment and energy

Record type:

softwareproject
Creator:
ian
Host:
End-to-end ETL pipeline for South African load shedding data using Python, SQL and Apache Airflow # πŸ”Œ South African Load Shedding ETL Pipeline An end-to-end data engineering pipeline that **extracts**, **transforms**, and **loads** South African load shedding schedule data from the EskomSePush API into a structured analytical database β€” orchestrated with Apache Airflow and scheduled to run daily. --- ## πŸ“ Architecture ``` EskomSePush API β”‚ β–Ό [Extract] ──▢ data/raw/ (raw JSON) β”‚ β–Ό [Transform] ──▢ data/processed/ (clean CSVs) β”‚ β–Ό [Load] ──▢ SQLite DB (star schema) β”‚ β–Ό [Airflow DAG] ── scheduled daily ``` --- ## πŸ—‚οΈ Project Structure ``` loadshedding_etl/ β”œβ”€β”€ etl/ β”‚ β”œβ”€β”€ extract.py # API ingestion β”‚ β”œβ”€β”€ transform.py # Data cleaning & normalization β”‚ └── load.py # Database loading β”œβ”€β”€ dags/ β”‚ └── loadshedding_dag.py # Airflow DAG definition β”œβ”€β”€ sql/ β”‚ β”œβ”€β”€ create_tables.sql # Schema definition β”‚ └── analysis_queries.sql # Analytical SQL queries β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ raw/ # Raw API responses (gitignored) β”‚ └── processed/ # Cleaned CSVs (gitignored) β”œβ”€β”€ notebooks/ β”‚ └── exploration.ipynb # EDA & findings β”œβ”€β”€ tests/ β”‚ └── test_transform.py # Unit tests β”œβ”€β”€ .github/workflows/ β”‚ └── ci.yml # GitHub Actions CI β”œβ”€β”€ requirements.txt β”œβ”€β”€ .env.example └── README.md ``` --- ## βš™οΈ Setup ### 1. Clone the repository ```bash git clone github.com cd loadshedding-etl ``` ### 2. Create virtual environment ```bash python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows ``` ### 3. Install dependencies ```bash pip install -r requirements.txt ``` ### 4. Configure environment variables ```bash cp .env.example .env # Add your EskomSePush API key to .env ``` ### 5. Initialise the database ```bash python -m etl.load --init ``` ### 6. Run the pipeline manually ```bash python -m etl.extract python -m etl.transform python -m etl.load ``` --- ## πŸ—„οΈ Database Schema The pipeline loads data i …