How rasmusab/swedish-election-night-prediction-2026 works
This repository produces Swedish 2026 election-night seat projections and an HTML report from official preliminary results. The main workflow is an on-demand update: collect and verify a feed snapshot, reconcile and align it with frozen election geography, forecast votes and seats, simulate uncertainty, then render and write the report. Separate branches refresh background inputs and check operational readiness. The README documents rehearsal and publication behavior; some subsystem links below are based on those docs because their implementations were not sampled.
Main entry points: election_report.py Report update cycle · election_forecast.py Vote forecast · readiness.py Readiness checks · election_feed.py Feed collector
Components 19
Feed collection
- Feed collector
val2026/election_feed.py - Verified snapshots
data - Aggregate reconciliation
val2026/reconciliation.py
Forecasting
- Frozen geography
reference-data - Vote forecast
val2026/election_forecast.py - Forecast model
val2026/forecast_model.py - Seat allocation
val2026/seats.py - Uncertainty simulation
val2026/uncertainty.py - Uncertainty settings
val2026/forecast_uncertainty.py
Report generation
- Update command
update-report.py - Election-night workflow
election-night.py - Report update cycle
val2026/election_report.py - Report presentation
val2026/election_report.py - Generated report
index.html
Preparation and checks
- Input refresh
refresh-inputs.py - Readiness checks
val2026/readiness.py - Prepared inputs
reference-data
Other components
- Operator
- Election authority
Connections 23
- Operator → Update command: runs
- Update command → Election-night workflow: executes
- Election-night workflow → Report update cycle: runs cycle
- Report update cycle → Feed collector: collects snapshot
- Feed collector → Election authority: fetches feed
- Feed collector → Verified snapshots: stores verified data
- Report update cycle → Verified snapshots: loads snapshot
- Report update cycle → Frozen geography: loads inputs
- Report update cycle → Aggregate reconciliation: reconciles totals
- Report update cycle → Vote forecast: evaluates snapshot
- Vote forecast → Forecast model: predicts votes
- Vote forecast → Seat allocation: allocates seats
- Vote forecast → Uncertainty simulation: simulates ranges
- Uncertainty simulation → Uncertainty settings: uses settings
- Report update cycle → Report presentation: builds presentation
- Report presentation → Generated report: renders HTML
- Operator → Input refresh: refreshes inputs
- Input refresh → Election authority: retrieves sources
- Input refresh → Prepared inputs: writes prepared data
- Operator → Readiness checks: checks readiness
- Readiness checks → Election authority: checks feed access
- Readiness checks → Verified snapshots: checks snapshot
- Readiness checks → Frozen geography: checks alignment