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
| State | Meaning | Expected action |
|---|---|---|
PASS | The condition satisfies the contract. | Accept. |
WARN | Known or historically tolerated anomaly. | Document and monitor. |
FAIL | Structural 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:
| Metric | Value |
|---|---|
| Voting events | 4,993 |
| Senatorial roll-call votes | 454,094 |
| Persisted profiles | 700 |
| Distinct senatorial IDs in votes | 737 |
| IDs with votes but no profile | 37 |
| Votes linked to IDs without profile | 29,879 |
| Voting events without votes | 7 |
| Empty vote values | 14 |
| Empty party values | 88 |
The 7 voting events without votes are: 408, 621, 801, 848, 3697, 3698, 3848.
Distribution by legislature
| Legislature | Roll-call votes |
|---|---|
| 60 | 61,924 |
| 61 | 65,869 |
| 62 | 82,856 |
| 63 | 73,790 |
| 64 | 64,099 |
| 65 | 76,953 |
| 66 | 28,603 |
Reading anomalies
- IDs without profile: accepted warning if votes preserve the institutional
senador_idand 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.