Datasets:
sejm_committee_transcripts: redact() counts only actual replacements; card corrects the 454
Fixes the redaction counter in sejm_committee_transcripts and corrects the card sentence that quotes it. No data change, no rebuild.
What was wrong: the sub() wrapper inside redact() (src/fetch_sejm_committee_transcripts.py, line 628) added 1 to the count for every regex match. That included PESEL/NIP/REGON candidates whose checksum fails, which are returned unchanged. extract() adds that count into its printed stats["pii"], the source of the card's "pre-dedup counter read 454". The count never reached stats.json, which has no redaction field.
Change (3 files, +14/−3):
redact(): a match is counted only when its replacement differs from it (line 635). The text output is identical: on both the shipped shard and the PR 37 shard, old and newredact()give the same text, and re-running it on the shipped text changes nothing.- New test
test_checksum_failing_ids_not_counted: a failing PESEL, NIP and REGON give(raw, 0). With one valid PESEL added, the count is exactly 1. It fails on main and passes here. - Card, line 74: the 454 also included checksum-failing candidates left in the text, at least 10 of them.
Measured:
| Rows | Placeholders (real redactions) | Old counter |
|---|---|---|
| Shipped shard, 613,722 rows | 403 (396 e-mail, 6 numbers, 1 contact), as the card says | 411 |
| PR 37 shard, 653,411 rows (deduplicated, before the speaker filter) | 415 | 425 |
| Pre-dedup, 727,570 rows | not measurable (parsed turns are not cached) | 454 |
The other 29 counts come from the 74,159 dropped duplicate rows and can't be split into real and false without the parsed turns. At the rate in the kept rows (10/425), about one more of them is false.
Not changed: regon_ok() raises IndexError on a standalone 14-digit number (it reads d[14] and has the wrong weights). Neither shard contains one. It is left as is because the shard goes through NERGAL before v0.2.6 (v2#60), and NERGAL has correct PESEL/NIP/REGON checks.
Tests: GIT_LFS_SKIP_SMUDGE=1 python3 -m pytest -q -p no:cacheprovider -rfE. On main: 98 failed, 18 errors, all from LFS pointers. On this branch with the shard's LFS objects pulled: 93 failed, 18 errors, no new failures. The 5 that now pass are this shard's contract tests, which can read the real parquet.
🤖 Generated with Claude Code
refs/pr/109 ref