dataportal#

Live data portal serving continuously-updated Cape Town datasets. The portal aggregates data from multiple sources (R2 cloud storage with local JSON fallback) and presents it through dedicated pages.

Models#

No Django models — data is served from JSON files fetched by management commands.

URL Routes#

Path

View

Description

/data/

portal_index

Landing page with all data products and last-updated timestamps

/data/dam-levels/

dam_levels

Cape Town dam levels with trends + Leaflet map

/data/table-mountain/

table_mountain

Table Mountain cableway status

/data/traffic/

traffic

V&A Waterfront ↔ Airport commute times

Management Commands#

Command

Description

fetch_dam_levels

Scrape dam level data from R2 / local fallback

fetch_table_mountain

Fetch Table Mountain cableway operating status

fetch_traffic

Fetch traffic commute data from R2 / local fallback

Data Sources#

flowchart LR DAMS_SRC[City of Cape Town] -->|scraped| R2_D[R2: dam_levels.json] TRAFFIC_SRC[Google Maps Routes API] -->|fetched| R2_T[R2: traffic.json] TM_SRC[Table Mountain API] -->|fetched| R2_TM[R2: table_mountain.json] R2_D -->|fetch_dam_levels| VIEW_D[dam_levels view] R2_T -->|fetch_traffic| VIEW_T[traffic view] R2_TM -->|fetch_table_mountain| VIEW_TM[table_mountain view]

Key Design Decisions#

  • No ORM models — data is ephemeral and read from JSON. This avoids unnecessary database writes for fast-changing metrics.

  • R2-first with local fallback: Management commands try R2 first; if unavailable they fall back to data/*.json files in the repo.

  • Table Mountain pipeline is currently disabled pending upstream API changes.