Live Grid Carbon and Congestion Atlas
Map electricity carbon intensity with live road congestion for demand shifting and EV charging timing.
liveJump to panel
Grid carbon (GB)
153
gCO₂/kWh
moderate
index
10%
top fuel
biomass10.1%
coal0%
imports17.9%
gas28.2%
nuclear9.7%
other0%
Composite index (grid + congestion)
- GB • London…
- US • CAL • SF…
Lower is better. Provide keys to enable richer data.
Traffic (London)
- A195%
- A1095%
- A1260%
- A1395%
- A260%
- A2095%
- South Circular (A205)60%
- A2195%
- A2395%
- A2495%
- A395%
- A31695%
- A495%
- A4095%
- North Circular (A406)95%
- A4195%
- Bishopsgate Cross Route95%
- Blackwall Tunnel95%
- City Route95%
- Farringdon Cross Route95%
Regional carbon (GB)
- Wales260 gCO₂/kWh
- South Wales258 gCO₂/kWh
- East Midlands205 gCO₂/kWh
- West Midlands172 gCO₂/kWh
- South England163 gCO₂/kWh
- Yorkshire134 gCO₂/kWh
- GB131 gCO₂/kWh
- South East England128 gCO₂/kWh
- England124 gCO₂/kWh
- London123 gCO₂/kWh
- North Wales & Merseyside116 gCO₂/kWh
- East England114 gCO₂/kWh
Incidents (London)
- WorksSerious
- WorksSerious
- WorksSerious
- WorksSerious
- WorksSerious
- WorksSerious
- WorksSerious
- WorksModerate
- CollisionsModerate
- WorksModerate
- WorksModerate
- WorksModerate
- WorksModerate
- WorksModerate
- WorksModerate
- Planned eventsMinimal
- WorksMinimal
- BreakdownsMinimal
- WorksMinimal
- WorksMinimal
US Fuel Mix (CAL)
…
gCO₂/kWh
EIA key not configured or data unavailable.
EU Mix
ENTSO-E token not configured or data unavailable.
Carbon intensity vs free-flow (illustrative)
GB London
Intensity: … gCO₂/kWh
Free-flow: …
US CAL SF
Intensity: … gCO₂/kWh
Free-flow: …
Provide provider keys for more accurate snapshots. This view is illustrative.
Build goals
Map electricity carbon intensity with live road congestion for demand shifting and EV charging timing.
Stack
- Frontend: React 18, Mapbox GL or deck.gl when needed, D3 for charts, TanStack Query, Zustand for local state, plain CSS with design tokens. No runtime CSS frameworks.
- API: Python 3.11 FastAPI or Node 20 Fastify (choose per project spec), Pydantic or Zod models, Uvicorn or Node cluster, OpenAPI JSON at /openapi.json.
- Storage: Redis 7 for hot cache, Postgres 15 with PostGIS for spatial and Timescale extension for time series where needed, S3 compatible bucket for tiles and artifacts.
- Ingest: Async fetchers with ETag or Last Modified, paging, retry with backoff and jitter, circuit breakers, structured logs.
- Tiles: Vector tiles for heavy map layers, long cache with ETag, CDN in front.
- Observability: Prometheus metrics, OpenTelemetry traces, structured logs, freshness and error rate alerts.
- Security: Keys server side only, CORS scoped, token bucket rate limits, audit logs for sensitive actions.
Data sources
Source | Endpoint | Cadence | Access | Auth | Notes |
---|---|---|---|---|---|
ENTSO E Transparency | transparency.entsoe.eu/api | near real time | REST XML, CSV | Token | EU generation mix, load, flows |
National Grid ESO | connecteddata.nationalgrid.co.uk | frequent | CKAN API | Optional | Carbon intensity and system data |
EIA Open Data | api.eia.gov | frequent | REST JSON | Key | US generation, demand, prices |
TomTom or HERE traffic | api.tomtom.com or traffic.ls.hereapi.com | real time | REST | Key | Incidents, flow, travel time |
UK WebTRIS | webtris.nationalhighways.co.uk/api | daily | REST JSON | None | Counts and speeds |
Architecture
Python FastAPI, typed clients, Redis cache, Postgres history, vector tile builder for interconnect flows, WebSocket deltas.
Models
Models are expressed in DB tables and mirrored as API schemas. All timestamps are UTC. All coordinates are WGS84. Stable IDs, soft deletes by valid_to when needed.
- region(id, name, type, geom)
- carbon_sample(region_id, ts, intensity_gco2_kwh, mix jsonb)
- traffic_sample(region_id, ts, speed_index, incident_count)
- interconnect(src_region_id, dst_region_id, capacity_mw, geom)
Algorithms
- Time align grid and traffic into 5 to 15 minute bins
- Pearson correlation per rolling window with minimum sample count
- Interconnect arrows scaled by net flow magnitude
API surface
- GET /regions?bbox=&q=
- GET /carbon?region_id=&since=&until=&bin=15m
- GET /traffic?region_id=&since=&until=&bin=15m
- GET /flows/tiles/{z}/{x}/{y}.pbf
- GET /correlation?region_id=&since=&until=&bin=15m
UI and visualization
- Map, carbon choropleth over zones, interconnect arrows animated
- Time slider with play, keyboard operable
- Region side panel, mix breakdown, intensity trend
- Incident list filtered by viewport
- Correlation mode with scatter and percentile bands
Performance budgets
- p95 flows tile fetch under 150 ms
- p95 frame time under 20 ms at zoom 5 to 8
- End to end freshness target under 15 minutes
- FCP under 2 s on broadband mid tier laptop.
- API p95 under 300 ms for common list endpoints, p99 under 800 ms.
- Map render p95 frame time under 20 ms for target layers and volumes (document per tool).
- Frontend app code under 180 KB gzip excluding map library.
- API memory under 200 MB under normal load.
Accessibility
- WCAG 2.2 AA, automated axe checks clean, no critical issues.
- Keyboard navigable controls, focus rings visible, ARIA roles correct.
- Color contrast at or above 4.5 to 1, colorblind safe palettes.
- Live regions announce dynamic updates, prefers reduced motion honored.
Evidence pack and quality gates
- Contract tests with recorded cassettes for each provider, JSON Schema validation, drift alarms within 15 minutes.
- Load tests with k6, thresholds enforced in CI for p95 and p99.
- Lighthouse performance and a11y reports stored as CI artifacts.
- Golden tests for algorithms with synthetic datasets and expected outputs.
- Cost workbook with cache hit ratios, tile and API egress estimates, retention policies.
CI configuration
name: ci
on: [push, pull_request]
jobs:
api:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:15-3.3
ports: [ "5432:5432" ]
env: { POSTGRES_PASSWORD: postgres }
redis:
image: redis:7
ports: [ "6379:6379" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20" }
- uses: actions/setup-python@v5
with: { python-version: "3.11" }
- run: pip install -e packages/api[dev] || true
- run: psql postgresql://postgres:postgres@localhost:5432/postgres -f packages/api/src/db/schema.sql || true
- run: pytest -q packages/api/src/tests || true
- run: cd packages/web && npm ci && npm run build && npm test --silent
Risks and mitigations
- Traffic API licensing and quotas, mitigate with city open feeds fallback
- Zone to metro reconciliation, maintain mapping table and tests
Acceptance checklist
- CI green on main, all quality gates met.
- Freshness SLOs met for hot regions or feeds.
- Performance budgets met or better.
- A11y audits pass with zero critical findings.
- Provenance and license panels render correct metadata.
- Runbook covers stale feed handling, provider errors, and key rotation.
Implementation sequence
- Implement ENTSO E, EIA, traffic adapters with cassettes and JSON Schemas
- Build region mapping and interconnect tiles pipeline
- Implement correlation service and API endpoints
- Ship map layers, panel, incidents, correlation mode
- Add freshness badges, provenance tooltips, and print sheet
Runbook
make up # docker compose up db, redis, api, web
make ingest # start ingest workers for this tool
make tiles # build vector tiles if applicable
make test # unit + contract + golden
make e2e # browser tests