How terry395/sg-election-simulator works
GE2030 Simulator is an interactive Singapore election-boundary, contest, forecast and election-night simulator, with a separate National Planner for population and land-use decisions through 2050. The main election workflow runs from map editing through contests and swings to forecast and simulated results; past-election comparison, reports and coalition building extend that workflow. The planner has its own population, plan-building, simulation and reporting stages. Edges are limited to calls visible in excerpts or capabilities and relationships documented in the README; unsampled implementation details are not assumed.
Main entry points: App.tsx Election app · PlannerApp.tsx Planner workspace · derived.tsx Live projection · DrawPanel.tsx Boundary drawing
Components 27
Election Workspace
- Election app
src/App.tsx - Map workspace
src/map/MapView.tsx - Boundary drawing
src/panels/DrawPanel.tsx - Contest setup
src/panels/ContestPanel.tsx - Forecast controls
src/panels/ForecastPanel.tsx - Election night
src/panels/NightPanel.tsx
Election Models
- Election data loader
src/data/loadData.ts - Election state
src/state/store.ts - Live projection
src/state/derived.tsx - Boundary statistics
src/model/stats.ts - Vote and seat model
src/model/swing.ts - Automatic redistricting
src/model/redistrict/index.ts - Forecast simulation
src/model/montecarlo.ts
Election Insights
- Past election comparison
src/panels/ComparePanels.tsx - Election report
src/components/ElectionReport.tsx - Mock EBRC report
src/components/EbrcReport.tsx - Coalition builder
src/components/CoalitionBuilder.tsx - Mock news article
src/components/NewsArticle.tsx
National Planner
- Planner workspace
src/planner/PlannerApp.tsx - Land-use map
src/planner/map/PlannerMap.tsx - Plan editing
src/planner/panels/BuildPanel.tsx - Planner report
src/planner/report/PlannerReport.tsx
Planner Models
- Population projection
src/planner/model/population.ts - Planner state
src/planner/state/planner.ts - Plan simulation
src/planner/model/simulate.ts - Automatic planning
src/planner/model/autoplan.ts
Other components
- Political enthusiast
Connections 26
- Political enthusiast → Election app: opens simulator
README.md - Election app → Election data loader: loads data
src/App.tsx - Election app → Map workspace: renders map
src/App.tsx - Election app → Boundary drawing: renders panel
src/App.tsx - Election app → Contest setup: renders panel
src/App.tsx - Election app → Forecast controls: renders panel
src/App.tsx - Election app → Election night: renders panel
src/App.tsx - Boundary drawing → Automatic redistricting: auto-draws boundaries
README.md - Boundary drawing → Mock EBRC report: generates report
README.md - Election state → Boundary statistics: builds boundary context
src/state/store.ts - Live projection → Boundary statistics: computes statistics
src/state/derived.tsx - Live projection → Vote and seat model: runs election model
src/state/derived.tsx - Contest setup → Live projection: sets contest inputs
README.md - Forecast controls → Live projection: sets swing inputs
README.md - Forecast controls → Forecast simulation: runs simulations
README.md - Election night → Election report: shows final report
src/panels/NightPanel.tsx - Election night → Coalition builder: offers coalition builder
src/panels/NightPanel.tsx - Election report → Mock news article: opens mock article
src/components/ElectionReport.tsx - Past election comparison → Political enthusiast: compares past elections
README.md - Political enthusiast → Planner workspace: opens planner
README.md - Planner workspace → Land-use map: renders map
src/planner/PlannerApp.tsx - Planner workspace → Population projection: uses projection
src/planner/PlannerApp.tsx - Plan editing → Planner state: edits plan
README.md - Planner state → Plan simulation: simulates plan
src/planner/state/planner.ts - Plan editing → Automatic planning: runs auto-plan
- Planner workspace → Planner report: shows report
src/planner/PlannerApp.tsx