
ElectionLens India
Every Indian election, browsable and answerable
Problem
Indian election data is public but hard to actually use — spread across PDFs, statutory reports and community mirrors, in inconsistent shapes, with candidate names as free text and constituencies renumbered every delimitation. Asking a plain question like "how much of the 2024 Andhra Pradesh result was the TDP–JanaSena alliance?" means hours of spreadsheet work.
Solution
ElectionLens ingests every Lok Sabha and state Assembly election since 1951 into one typed dataset, then builds three things on top of it: a seat-by-seat explorer with a clickable constituency map, a pure scenario engine for alliance and vote-transfer what-ifs, and AskVoter — a Q&A layer that classifies the question, runs a deterministic analysis (swings, consolidation vs swing decomposition, closest races, vote-share moves) and explains the result. Every number traces back to its source; a language model is never allowed to produce one.
Architecture
committed source snapshots ──▶ ingest (scripts/ingest/build.mjs)
TCPD Lok Dhaba · DataMeet · ECI workbooks normalise → one ElectionDataset shape
│
data/elections/*.json + index.json
│
┌───────────────────────┬───────────────────────┼───────────────────────┐
explorer scenario engine AskVoter router constituency maps
(seat tables, (anchor + per-party (intent classifier → (2008-delimitation
donut, mini-map) vote transfer, pure) deterministic answer) shapes, re-keyed)Key Design Decision
“Official data is the only source of truth. Every seat count, vote total and margin comes from the structured dataset; AskVoter and the scenario engine build typed, inspectable answers, and a model never fills a gap — if a number isn't in the data, it isn't shown.”
Challenges
- Candidate identity: the source carries names as free text, so one person appears under several spellings and different people share a name. A conservative name-normalisation plus a "more than one person" notice keeps the record honest without wrongly merging.
- Matching seats across delimitation: constituencies are renumbered, so year-over-year analysis matches by normalised name with an AC-number fallback only within a delimitation era.
- Alliance analysis: decomposing the 2019→2024 Andhra Pradesh swing into seat-sharing consolidation versus a genuine vote swing, per seat, from combined vs single-candidate shares.
- Hand-built visualisation: donut, margin bars, seat-flow alluvial and the state map are all bespoke SVG to stay inside one editorial visual language rather than pulling in a charting library.
Technology
Future Roadmap
- Swap the local AskVoter classifier for a real query planner that emits the same typed answer contract
- Proper cross-delimitation constituency matching (2008 boundary redraw)
- Replace the schematic grid maps with a GeoJSON / MapLibre choropleth
- Fill the remaining pre-2010 candidate-name gaps and deferred-poll seats