Follow South Africa's money — National Treasury Municipal Money spending visualised as interactive Sankey diagrams (Python ETL + static React/d3 site). Civic project.
# GovSpend ZA — follow South Africa's money
A public, civic tool that visualises how South African government money flows from the
**National Revenue Fund → grants → provinces → municipalities → actual spending**, as
interactive Sankey diagrams. Built entirely on **live National Treasury "Municipal Money"
data**, stored locally and pre-computed into a fast static site.
> Civic project — **not affiliated with government**. Figures come from National Treasury;
> they can contain source-data quirks (noted below).
## What it shows
- **National flow** — `National Revenue Fund` (and, where present, `Provincial departments`)
→ each grant → the 9 provinces. Click a province to **drill into its municipalities**.
- **Municipality profiles** — `National → Province → Municipality` (+ own revenue + fuel levy)
→ **spending by function** (Electricity, Water, Housing, Roads…). All 257 municipalities, searchable.
- **Budget vs Actual-spend** toggle and a **year selector** (FY2020–2026 for budget).
- An **honesty model** baked into the visuals:
- **Equitable share** — unconditional/pooled (the municipality decides how to spend it).
- **Conditional grants** — ring-fenced, traceable to a named purpose.
- **Provincial transfers** — from provincial departments, not the National Revenue Fund.
- **Own revenue** — rates, electricity, water charges the municipality raises itself.
## Data sources
National Treasury **Municipal Money** API (`
municipaldata.treasury.gov.…`) — OLAP
"cubes":
- `grants_v2` — transfers received per municipality (incl. the Local Government Equitable Share).
- `incexp_v2` — income & expenditure line items (mSCOA), by item, subcategory and function.
- `municipalities` — names, provinces, categories.
## Architecture
```
Municipal Money API ──(ETL, Python stdlib)──▶ SQLite ──(export)──▶ JSON
│
Vite + React + TS + d3-sankey (static site)
```
## Layout
```
etl/ Python ETL (stdlib only — no pip install)
api.py Municipal Money cubes client (pa …