| name | data-validation |
| description | Validate integrity of all public/data JSON files. Use when: after editing candidates, constituencies, or districts JSON; before committing data changes; checking coverage completeness; debugging data mismatches. |
Data Validation
When to Use
- After creating or editing any file in
public/data/
- Before committing data changes
- When troubleshooting missing candidates or broken district pages
Procedure
Run npm run check:e2e-lite (or trigger ingestion-validator-agent) and inspect:
research/swarm/control/validation-state.json
- If
research/constituency-outcomes/ or research/constituency-outcome-reviews/ changed, confirm the validator reports zero constituency-outcome gate defects before commit.
- For Tamil Nadu missing-party or thin-seat questions, also run
npm run check:live-candidate-coverage -- --state tamil-nadu plus node tools/tamil-nadu-party-coverage-report.mjs --json so literal missing DMK / AIADMK / TVK / NTK rows, alliance-covered literal gaps, source-confirmed official absences, and missing SPA / NDA / TVK / NTK fronts come from current runtime data rather than screenshots.
- For portrait fixes, rerun
node tools/candidate-photo-coverage-report.mjs --ref HEAD (or a scoped candidate check) and keep district-row + linked-detail photo parity on the same verified candidate-local URL.
What It Checks
- District counts —
constituencyCount in districts.json matches actual count in constituencies.json
- Sequential numbering — Constituency numbers are 1 through N with no gaps
- Packet resolution — Coverage packet headings resolve cleanly to the district constituency registry
- Structured seat coverage — Every constituency live-field JSON has at least one candidate
- ID validity — All
constituencyId values in candidate files exist in constituencies.json
- Full staged backing — Every public candidate row is backed by staged facts/timelines
- Public parity — Every structured seat candidate also appears in the generated public district rows
- E2E-lite push gate — Constituency coverage, candidate/detail id mapping, and timeline visible copy/source constraints
- Outcome packet gate — When outcome packet/review files exist,
passed seats need one primary plus three independent approvals and cannot leak runtime projections early
Required Fields Per Candidate
Every candidate row must have: id, name, frontId, frontLabel, party, partyFull, constituencyId.
Thin rows set: age: null, education: null, photo: null, timeline: [].
Trust fields: verificationStatus, confidence, lastReviewed, sourceNote.