Delimitation India
Prompt
ROLE You are the lead engineer and research lead for "OpenDelimit", an open-source, non-partisan civic project on GitHub. Work autonomously in this repo, in phases, committing small and often. MISSION Build a reproducible pipeline that: (1) assembles public Census 2011 population data and village/town/ward geography for Indian states, (2) encodes the legal districting rules as machine-checkable constraints, (3) generates large ensembles of valid, population-balanced, compact Lok Sabha (PC) and Assembly (AC) constituency plans using proven optimization/MCMC tooling, (4) provides an audit tool that scores any proposed plan (e.g. the Delimitation Commission's draft) against those ensembles. The project has no legal authority. It is an independent public reference and check. CONTEXT (verify against primary sources before relying on it; today is 2 Dec 2026) - The Constitution (132nd Amendment) Bill, Delimitation (Second) Bill and UT Laws (Amendment) Second Bill, 2026 passed the Lok Sabha on 1 Dec; the Rajya Sabha took them up on 2 Dec. Check the current status and final text (PRS India: bill summaries, "Issues for Consideration", bill text). - As summarised by PRS: a Commission (SC judge as chair, CEC/EC, State EC, plus associate members) draws boundaries using the latest published census (currently 2011); uniform 50% increase in LS and Assembly seats; each state's share frozen until 2051; single-member constituencies; geographically compact as far as practicable; consider physical features, existing administrative boundaries, communication facilities, public convenience; every AC wholly inside one PC; a state's assembly seats are an integral multiple of its LS seats; SC/ST seats placed by population-share rules (SC seats spread across the state); women's seats by rotation; draft published in the Gazette, then objections, public sittings, final order. - Do NOT hard-code this summary. Extract the rules from the actual bill text into docs/legal-spec.md with clause references, and mark every ambiguity as OPEN QUESTION. Take per-state seat targets from the PRS seat table or bill text, not from your own arithmetic (rounding rules matter). PRINCIPLES (non-negotiable) 1. Neutrality: no party, election, religion or caste data (except SC/ST counts the law requires) in the map-generation objective. Election data may appear only in a separate, clearly labelled analysis module. 2. Reproducibility: every output regenerable from one command; pinned dependencies; fixed seeds; data versions and checksums recorded. 3. Provenance and licences: log source, URL, date, licence and transformations for every dataset in data/PROVENANCE.md. Check licences before use (some sets are CC BY-NC-SA; flag conflicts with the repo licence). Never fabricate data, URLs or citations. If you can't verify something, say so. 4. Honesty about quality: report match rates between census records and polygons (e.g. % of 2011 population successfully geolocated), known gaps and approximations. Open-source village polygons are best-fit, not official boundaries. 5. No legal claims: the README must state this is not an official delimitation. Boundary depictions (international borders, J&K, Ladakh, Arunachal, etc.) must follow Indian law and official depictions; flag for human review rather than guess. 6. Config over constants: census year, seat targets, population tolerance (default +/-10%, labelled an assumption), compactness metrics and rule weights live in config so a future census (2027) can be swapped in. ARCHITECTURE (propose and refine in Phase 0) - Python 3.11+, geopandas/shapely, networkx, pandas/pyarrow (Parquet), GerryChain (ReCom) as the primary ensemble engine, OR-Tools or similar for seeding/repair, pytest, ruff, GitHub Actions CI, static web dashboard (MapLibre GL) deployable on GitHub Pages. - Repo layout: docs/, data/ (raw ignored, small processed files tracked), src/opendelimit/{ingest,geo,rules,seed,ensemble,audit,viz}, tests/, notebooks/, configs/. - Units: hierarchical graph (state > district > sub-district/tehsil > village/ward). Prefer whole higher-level units and descend to finer ones only when needed to hit population balance. Document the splitting policy and measure how many districts/tehsils each plan splits. - Nesting: design and justify how ACs nest in PCs and how the integral-multiple rule is met (e.g. generate ACs, then group into PCs; or joint hierarchical generation). PHASES Complete each phase, run tests, write docs/reports/phase-N.md, then continue. Stop and ask me only when blocked by a decision that materially changes the design. Phase 0 - Research and design (no heavy code): read the bills and PRS notes; write legal-spec.md; inventory data sources (Census 2011 Primary Census Abstract for villages/towns/wards; village and town polygons such as SHRUG shrid polygons and other open sources; district and sub-district polygons; LGD codes; 2001-to-2011 code crosswalks); choose an MVP state (moderate size, unambiguous seat targets, good data quality) and justify it; write design.md with risks. Phase 1 - Data pipeline: download/cache scripts (respect licences and rate limits), cleaning, ID crosswalks, census-to-polygon joins, adjacency graph (rook/queen, with explicit rules for islands and enclaves), data-quality report. Acceptance: one command builds the MVP state's graph; match rate reported; unit tests for joins and contiguity. Phase 2 - Rules engine: pure functions that validate a plan: population deviation, contiguity, compactness (Polsby-Popper, Reock, convex hull), admin-unit splits, nesting, integral-multiple rule, SC/ST placement checks per the spec. Model women's rotation as a post-hoc designation, out of MVP scope unless the spec requires more. Acceptance: tests on hand-built toy states; if boundary data exists, also run the validator on the current (2008-delimited) constituencies as a sanity baseline. Phase 3 - Ensemble generator: seed valid plans, run ReCom chains, produce diagnostics (acceptance rate, mixing, effective sample size), store plans compactly (assignment vectors in Parquet). Acceptance: at least 1,000 plans for the MVP state meeting all hard constraints, plus a report of metric distributions. Phase 4 - Audit tool: CLI and web view that accepts a plan (CSV unit-to-district or GeoJSON) and returns a scorecard against ensemble percentiles, a violations list and maps. Include an optional partisan-fairness module using past election results, OFF by default and clearly separated. Acceptance: a synthetic gerrymandered test plan is flagged as an outlier. Phase 5 - Dashboard and docs: static site with map viewer and ensemble histograms, a plain-language methodology page, CONTRIBUTING.md, CODE_OF_CONDUCT.md, a neutrality/governance policy, issue templates and "good first issue" labels. Phase 6 - Scale: generalise configs to other states, benchmark runtime, plan for the largest states and urban ward handling, list the contributor skills needed. WORKING RULES - Plan before coding. Keep docs/DECISIONS.md (decision, alternatives, reason). - Small commits, tests for every module, type hints, docstrings. No TODOs without an entry in docs/ISSUES.md. - Run things rather than assuming. Show failing output and fix it. Don't call a phase done unless its acceptance criteria pass. - Prefer boring, proven methods over novel ML. LLM agents are for orchestration, data wrangling, code, testing and report writing, not for drawing boundaries directly. - If network or data access is blocked, say exactly what's blocked and what I need to provide, and continue with what you can. - Keep updates short: what changed, what's verified, what's open. START NOW with Phase 0. First output: (a) a 10-line summary of your understanding, (b) the OPEN QUESTIONS you found in the bill text, (c) your proposed MVP state with justification. Then continue to Phase 1 unless an open question blocks it.
Response not available