Logo Lanfrica

manasseh-asaah/etl-data-pipeline

Domain:

socioeconomic

Record type:

software
Creator:
man
Host:
Modular ETL pipeline: extracts African country data from a REST API, transforms and validates it, loads into SQLite and runs analytical SQL queries # πŸ”„ African Countries ETL Pipeline A modular **Extract β†’ Transform β†’ Load (ETL)** pipeline that ingests live African country data from a public REST API, applies data quality transformations, loads the result into a **SQLite** database, and runs analytical **SQL** queries β€” all in a single command. ## πŸ—οΈ Pipeline Architecture ``` REST Countries API β”‚ β–Ό [1] EXTRACT fetch_countries() β€” HTTP GET, error handling β”‚ β–Ό [2] TRANSFORM transform() β€” flatten JSON, compute density, cast types β”‚ β–Ό [3] VALIDATE validate() β€” data quality checks (nulls, types, ranges) β”‚ β–Ό [4] LOAD load_to_sqlite() β€” full-refresh into SQLite β”‚ β–Ό [5] QUERY run_queries() β€” 5 analytical SQL queries β”‚ β–Ό [6] EXPORT export_csv() β€” CSV for downstream use ``` ## πŸ› οΈ Tech Stack | Tool | Purpose | |------|---------| | Python 3.10+ | Core language | | `requests` | API extraction | | `pandas` | Data transformation & quality checks | | `sqlite3` | Embedded database (stdlib) | | SQL | Analytical querying | ## πŸš€ Getting Started ```bash # Clone the repo git clone github.com cd etl-data-pipeline # Install dependencies pip install -r requirements.txt # Run the pipeline python main.py ``` ## πŸ“ Project Structure ``` etl-data-pipeline/ β”œβ”€β”€ main.py # Orchestrator β€” runs all 5 stages β”œβ”€β”€ config.py # Centralised configuration β”œβ”€β”€ requirements.txt β”œβ”€β”€ pipeline/ β”‚ β”œβ”€β”€ extract.py # Stage 1: API extraction β”‚ β”œβ”€β”€ transform.py # Stage 2 & 3: transformation + validation β”‚ └── load.py # Stage 4–6: loading, querying, export β”œβ”€β”€ data/ # SQLite database (auto-created) └── outputs/ # CSV export + pipeline log (auto-created) ``` ## πŸ“Š Analytical SQL Queries | Query | Description | |-------|-------------| | `top_10_by_population` | Most populous African countries | | `top_10_by_area` | Largest countries by land area | | `hig …