Validation and audit

Validation in camara-senadores-mex is a read-only inspection of senado.db. It does not fix data or rewrite tables; it produces a consistency report that separates structural failures from accepted warnings caused by historical limits of the source.

Read mode

The validator must open SQLite with a read-only URI:

file:senado.db?mode=ro

The validator uses sqlite3.connect(uri, uri=True) and sets row_factory = sqlite3.Row for column-name inspection. Using mode=ro is part of the contract: an audit must not modify the snapshot and should not be described as re-enabling write or concurrency PRAGMAs.

States

StateMeaningExpected action
PASSThe condition satisfies the contract.Accept.
WARNKnown or historically tolerated anomaly.Document and monitor.
FAILStructural contract break.Fix extraction, persistence, or the data source.

Accepted warnings do not block documentation publication when they are explained as source or coverage limits.

Audited snapshot

Reference metrics for the documented snapshot:

MetricValue
Voting events4,993
Senatorial roll-call votes454,094
Persisted profiles700
Distinct senatorial IDs in votes737
IDs with votes but no profile37
Votes linked to IDs without profile29,879
Voting events without votes7
Empty vote values14
Empty party values88

The 7 voting events without votes are: 408, 621, 801, 848, 3697, 3698, 3848.

Distribution by legislature

LegislatureRoll-call votes
6061,924
6165,869
6282,856
6373,790
6464,099
6576,953
6628,603

Reading anomalies

  • IDs without profile: accepted warning if votes preserve the institutional senador_id and the profile is unavailable or not parseable.
  • Voting events without votes: accepted warning for the listed IDs; they must not be inflated with synthetic rows.
  • Empty vote or party values: accepted warning at low counts; they are preserved as extraction evidence.

Closed historical P0s

Two historical risks must not be treated as active P0s:

  • HTML parser based on sidebar counts: obsolete and resolved by the current AJAX architecture.
  • AJAX not summing aggregate counts: out of contract / obsolete as an active P0; the current contract audits persisted roll-call votes and derived metrics.