Commit 1f8b635
MI: fix House votes never scraped due to regex mismatch and tab-separated names (#5696)
Two bugs introduced by #5379 (merged 2025-05-01) that together cause all
Michigan House vote records to be silently dropped.
Bug 1 — regex mismatch (scrape_votes, line 197):
The roll call regex `r"Roll Call # (\d+)"` requires a space between "#"
and the number. House journal action strings use "Roll Call #44" (no
space); Senate uses "ROLL CALL # 1" (with space). Because `rcmatch` is
always None for House actions, the `if rcmatch:` block never executes
and no House votes are ever scraped. Fixed with `r"Roll Call #\s*(\d+)"`.
Bug 2 — tab-separated voter names (parse_roll_call, line 351):
House journal <p> elements separate voter names with single tab characters
("Alexander\tFarhat\tMartus\tSchmaltz"), while Senate journals use
multi-space padding. The split `re.split(r"(?<!,)\s{2,}", p)` requires
2+ consecutive whitespace characters, so single tabs go unsplit — all
four names on a line are stored as one fused string. Note: a
session-specific workaround for the identical tab issue already existed
for 2017-2018 but was never generalised. Fixed by changing the split to
`r"\t|(?<!,)\s{2,}"`, which handles both formats.
Tested against 45 Michigan 2025-2026 bills (38 House, 7 Senate) from a
known-missing dataset. 31 House votes recovered with correct counts and
fully split individual voter name lists (e.g. HB4707: 57 yeas, 44 nays).
Senate bills with no floor votes correctly return 0 votes.
Co-authored-by: Ramon Perez <ramon.perez@digitaldemocracyproject.org>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 5e405af commit 1f8b635
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| |||
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
350 | | - | |
351 | | - | |
| 351 | + | |
| 352 | + | |
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
| |||
0 commit comments