loadshedding#

Real-time Eskom loadshedding status tracking with multi-source consensus, history tracking, and recovery period monitoring.

Models#

No Django ORM models. Uses Pydantic validation models:

Pydantic Model

Description

LoadsheddingData

Top-level container for all loadshedding data

DerivedStatus

Consensus status derived from multiple sources

CityStatus

Per-source status (Eskom, SePush, Cape Town Gov)

DailySummary

Daily loadshedding summary (hours, stages)

MonthlyHistory

Monthly aggregated history

StageChange

Stage transition event record

URL Routes#

Path

View

Description

/api/loadshedding/

LoadsheddingView

JSON API with cache control + CORS

/loadshedding/status/

status_page

Current stage, schedule, recovery context

/loadshedding/other-cities/

other_cities_page

Johannesburg, Durban, Pretoria, PE

Management Commands#

Command

Description

fetch_loadshedding

Async multi-source fetch: Eskom GetStatus, EskomSePush API, Cape Town Gov (browser scrape)

Multi-Source Consensus#

flowchart LR ESKOM[Eskom GetStatus API] --> DERIVE[DerivedStatus] SEP[EskomSePush API] --> DERIVE CTG[Cape Town Gov scrape] --> DERIVE DERIVE --> JSON[loadshedding.json] JSON --> API[LoadsheddingView] JSON --> PAGE[status_page]

Key Design Decisions#

  • Multi-source consensus prevents outages from any single API. The derived status cross-references three independent sources.

  • Pydantic models (not Django ORM) — loadshedding data is validated and serialised as JSON, not stored in PostgreSQL.

  • Recovery period tracking monitors when loadshedding ends and tracks the transition back to normal supply.