A Medallion Lakehouse built with Polars, DuckDB, and Parquet. Ingests, cleans, and analyzes 98,000+ health facility records across 50 Sub-Saharan African countries.
# Sub-Saharan Africa Health Facility Lakehouse
A Medallion Lakehouse built with Polars, DuckDB, and Parquet. Ingests, cleans, and analyzes 98,000+ health facility records across 50 Sub-Saharan African countries.
## Data Architecture
- **Bronze Layer (\data/bronze/\)**: Ingests raw XLSX records from the Humanitarian Data Exchange (HDX) / KEMRI-Wellcome Trust and outputs raw Parquet.
- **Silver Layer (\data/silver/\)**: Deduplicates records, fixes UTF-8 string encodings, normalizes coordinates, maps 172 raw facility types into 3 operational tiers (Primary, Secondary, Tertiary), and categorizes ownership into 4 sectors (Public, Private, Faith-Based, NGO).
- **Gold Layer (\data/gold/\)**: Aggregates metrics into two analytical Parquet datasets:
- egional_facility_metrics.parquet\: Subnational breakdown across 619 administrative regions.
- ational_facility_summary.parquet\: Country-level summary across 50 nations.
## Project Structure
```text
africa-health-lakehouse/
├── data/ # Ignored from Git (Parquet storage)
├── src/
│ ├── ingest_health_data.py # Downloads raw data and converts to Bronze Parquet
│ ├── inspect_bronze.py # Audits raw Bronze schema and row counts
│ ├── inspect_facility_types.py # Profiles distinct facility strings in raw data
│ ├── transform_lakehouse.py # Runs Silver cleaning and Gold dataset aggregation
│ ├── read_silver.py # Previews clean Silver layer schemas and tier distributions
│ ├── read_gold.py # Queries Gold Parquet datasets and surface core findings
│ ├── country_facilities.py # Extracts single-country subnational metrics
│ └── ownership_breakdown.py # Analyzes public vs non-state reliance metrics
├── .gitignore
└── README.md
```
## Core Findings
## Core Findings
1. **National Facility Volume**: Infrastructure volume varies widely across Sub-Saharan Africa. Nigeria leads total facility count (20,733), followed by DRC (14,573), Tanzania (6,304), Kenya (6,144), Ethio …