sejm_api: state the contributor snapshot in provenance (v0.2.6, v2#57)

#69
by ppuzio - opened

What and why

Provenance wording for sejm_api (released in v0.2.5), from the rights audit and slayerlabs/polish-dynaword-v2#57. The audit found that the text comes from the Hugging Face snapshot PiotrSty/sejm-speeches-corpus@v1.0.1 (commit 124557799608), not from the live API, and that source_url is only a day-level /videos/ listing. The registry said "Direct official Sejm API records" and the card said "speech-level provenance". Both were inaccurate.

Wording only. No row, no schema, no licence field changes. One follow-up commit (25e6ecc) removes a stale sentence from the card; see Changes.

Before -> after

before after
documents 38,812 38,812
characters 96,596,566 96,596,566
tokens (cl100k_base proxy) 36,335,587 36,335,587
data/sejm_api/sejm_api.parquet sha256 56f7b03483488dec8f0fa145c6d26746926175d83096e9d1931e535aa81cf161 same (the parquet is not in the diff)

Changes

  • src/sources.py: sejm_api.provenance now reads "Sejm API data via contributor snapshot: text from the PiotrSty/sejm-speeches-corpus v1.0.1 Hugging Face snapshot (commit 1245577), not fetched from the live API by SlayerLab. Speaker attribution preserved; source_url is a day-level api.sejm.gov.pl /videos/ listing, not a per-speech URL." The release stays "0.2.5".
  • data/sejm_api/sejm_api.md: new "Data route" bullet; the "speech-level provenance" line now says the URLs are day-level.
  • data/sejm_api/NOTICE.md: credits Kancelaria Sejmu RP "obtained via the contributor snapshot"; "full source URL" became "day-level source URL".
  • src/fetch_sejm_api.py: the same three texts in its templates, so a rebuild does not bring back the old wording.
  • src/test_sejm_api_contract.py: asserts that the registry and card carry the new wording, that the fetch template's registry entry equals the shipped one, and that all 38,812 sidecar source_url values match https://api.sejm.gov.pl/sejm/term{N}/videos/{date}.
  • artifacts/source_findings.md: entry appended.
  • Follow-up commit 25e6ecc: the card's "Temporal novelty" paragraph, and its template in src/fetch_sejm_api.py, no longer say that parlamint_pl is registered (it left the registry in #54 and never shipped data). The paragraph now names only parliamentary (ends 2019-12-31) and the contribution's start date. artifacts/source_findings.md notes the fix.
  • sejm_api.license-evidence.json is unchanged: it already names the pinned snapshot and does not repeat the old wording (its sha256 is recorded in the ontology manifest).

Rules applied

None. No rows were filtered.

Provenance and licence summary

The licence basis is unchanged (Copyright Act art. 4(2), Open Data Act reuse, LicenseRef-Polish-Official-Documents). The audit notes the API documents no licence and that the reach of the www.sejm.gov.pl terms to API output is unverified. This PR does not touch that.

Live-API spot check (20 rows)

Result: 1 match, 19 mismatch, 0 not found. The API needed no key and showed no terms prompt.

Method. Read-only GETs on https://api.sejm.gov.pl, 0.4 s apart, run on 2026-10-06. Rows: random.Random(20261006).sample(range(38812), 20) over the parquet this PR leaves unchanged (38,812 rows, file order); speaker and date from the attribution sidecar. Term mix: 6 rows are from term 9 (2023) and 14 from term 10 (2024-2026); the 38,812 rows are all dated 2023 or later. Per row: /sejm/term{N}/proceedings gives the proceeding that lists the date, .../proceedings/{p}/{date}/transcripts lists its statements, .../transcripts/{num} returns one statement as HTML. Candidates were tried in this order: statements with the same speaker name, the chair ("Marszałek"), then every statement of the day. API text = the <p> paragraphs of the page without the agenda title (p.punkt-tytul) and p.marsz label paragraphs. Normalisation: Unicode NFC, whitespace collapsed, redaction tokens such as [EMAIL] treated as wildcards (none of the 20 rows has one). match = our whole text occurs verbatim in an API statement; mismatch = it does not (the best-overlapping statement is reported); not found = no statement of that day overlaps. The scripts are scratch files, not in the repository.

Rows. API statement = term/proceeding/statement number, URL https://api.sejm.gov.pl/sejm/term{N}/proceedings/{proceeding}/{date}/transcripts/{num}.

row date speaker chars API statement result note
752 2023-01-25 Kazimierz Plocke 4,053 term9/71/132 mismatch trailer; text before it = whole statement
2105 2023-03-08 Grzegorz Rusiecki 3,830 term9/73/112 mismatch trailer; text before it = whole statement
5266 2023-06-15 Agnieszka Hanajczyk 471 term9/77/327 mismatch trailer; text before it = one segment of statement
5329 2023-06-16 Tomasz Zimoch 2,870 term9/77/12 mismatch trailer; text before it = whole statement
7060 2023-07-13 Sprawozdawca Piotr Uruski 1,319 term9/79/204 mismatch trailer; text before it = whole statement
7634 2023-08-17 Katarzyna Lubnauer 654 term9/81/61 mismatch trailer; plus API has '(Oklaski)' that our text lacks
12919 2024-04-11 Marcin Józefaciuk 2,043 term10/9/148 mismatch trailer; text before it = one segment of statement
15282 2025-04-23 Weronika Smarduch 1,282 term10/33/110 mismatch trailer; text before it = whole statement
15422 2025-04-24 Łukasz Osmalak 1,433 term10/33/32 mismatch trailer; text before it = whole statement
16865 2025-06-03 Klaudia Jachira 1,823 term10/36/123 mismatch trailer; text before it = whole statement
18781 2025-07-08 Teresa Pamuła 1,589 term10/38/321 mismatch trailer; text before it = whole statement
18919 2025-07-09 Anna Gembicka 1,488 term10/38/59 mismatch trailer; text before it = whole statement
30257 2026-02-12 Roman Fritz 1,157 term10/51/168 mismatch trailer; text before it = whole statement
32427 2026-03-26 Marek Matuszewski 1,087 term10/54/180 mismatch trailer; text before it = whole statement
33411 2026-04-28 Małgorzata Pępek 1,314 term10/56/142 mismatch trailer; text before it = whole statement
34309 2026-05-13 Jarosław Sachajko 747 term10/57/167 mismatch trailer; text before it = whole statement
34388 2026-05-13 Jarosław Sachajko 2,517 term10/57/254 mismatch trailer; text before it = whole statement
35711 2026-05-29 Urszula Rusecka 813 term10/58/84 match verbatim segment of the API statement (no trailer)
36637 2026-06-17 Jarosław Sachajko 2,711 term10/60/211 mismatch trailer; text before it = whole statement
37714 2026-07-02 Włodzimierz Skalik 1,130 term10/61/191 mismatch trailer; text before it = whole statement

What the mismatches are. All 19 share one cause: our text ends with a trailer that the API statement does not contain. The trailer starts with "Przebieg posiedzenia" (the text of the page's <a class="przebieg"> link) and continues with the name, page title, date and agenda-item title of the next statement; in all 19 rows the name is the speaker of statement num+1 in the API listing. With the trailer cut off, our text equals the whole API statement in 16 rows and is one verbatim segment of it in 2 rows (a statement page can hold several speakers' paragraphs, introduced by label paragraphs such as "Wicemarszałek Ryszard Terlecki:"; a row is one segment without its label). In 1 row (row 7634) the API statement also has one "(Oklaski)" that our text lacks, directly before another parenthetical; I cannot tell whether the snapshot lost it or the API changed after the snapshot. The 1 matching row is a non-final segment of a multi-speaker statement (a further segment follows in the API statement); it carries no trailer, which is why it matches.

How common the trailer is. A regex over the whole parquet ("Przebieg posiedzenia", then up to 300 characters, then "N. kadencja, M. posiedzenie, K. dzień") matches in 34,828 of 38,812 rows (89.7%). The text from the marker to the end of the row is 23,447,650 of 96,596,566 characters (24.3%). In 1,984 rows it is over 1,000 characters (largest 51,739); in the one long example I read, it continues from the agenda title into what reads as speech text, and I did not check whether that text is also another row.

What this PR does about it. Nothing: no row changes here, so the trailer is still in the text. The card does not mention it. Stripping it changes the parquet and its sha256, so it needs its own decision.

Per-speech URLs. The API has them (the pattern above). source_url in the data is the day-level /sejm/term{N}/videos/{date} listing, which carries no proceeding or statement number, so the 20 rows could only be mapped to a statement by text search; one statement can hold several rows (segments). No row or URL is changed here.

Limits. 20 rows per source is a spot check; it does not bound a rate. The API was read in October 2026 and the snapshot is v1.0.1, so a difference can be a later API edit as well as a snapshot artefact.

Not done

  • "Use per-speech URLs if the API offers them": the API does (see the spot check), but source_url stays day-level. No row changes in this PR.
  • parlamint_pl is still named in code and data that the card fix did not touch: src/fetch_sejm_api.py (the temporal-novelty check iterates ("parliamentary", "parlamint_pl"), and the registry-entry insertion looks for the "parlamint_pl": { marker; by reading the code, a rerun against the current registry fails there), the fixtures in src/test_sejm_api_contract.py, artifacts/sejm_api_ontology_manifest.json (lines 125 and 176) and the historical ParlaMint section of artifacts/source_findings.md. Left alone on purpose.
  • README.md (l. 75, 173), CHANGELOG.md (l. 112) and src/make_docs.py (l. 285, 383) still say "from the official Sejm API". Left for the release commit.

pytest

python -m pytest -q from the repository root, in this worktree:

  • before: 24 failed, 258 passed, 7 errors
  • after: 24 failed, 261 passed, 7 errors
  • after the follow-up commit 25e6ecc: 24 failed, 261 passed, 7 errors; the failing set is the same 31 ids.

The failing set is identical before and after (31 test ids, diffed). They fail because LFS parquet files are pointers in this checkout (pyarrow ... Parquet magic bytes not found), not because of this change. The three new tests pass, and src/test_sejm_api_contract.py is 15 passed.

Sample

python3 src/render_sample.py data/sejm_api/sejm_api.parquet -n 3

id: sejm_api_55ed7a540f95508075480d3f6bc8790cd57068c8d041997d211d66f0368027bc
source: sejm_api
added: 2026-08-22
created: 2023-04-12
token_count: 625
license: public-domain (official documents)
author: Mirosław Suchoń

Bardzo dziękuję. Panie Marszałku! Wysoka Izbo! Wszyscy jesteśmy świadkami potężnej afery, którą wykreowali, którą spowodowali ludzie związani z Prawem i Sprawiedliwością. Po pierwsze, PiS wpuścił rolników w zbożowy kanał, bo tak trzeba nazwać sytuację z cenami skupu zboża. Przypomnę, że pan minister Kowalczyk, wicepremier, który w czerwcu 2022 r. był ministrem, 21 czerwca tamtego roku zachęcał rolników, aby nie sprzedawali zboża. Twierdził, że to zboże nie dosyć, że nie będzie tanieć, to jeszcze cena może rosnąć. A jaka była prawda? W tym dniu, w którym pan minister Kowalczyk zachęcał rolników, żeby trzymali zboże, średnia cena pszenicy konsumpcyjnej w Polsce wynosiła ok. 1730 zł. Natomiast 30 marca 2023 r. - 1080 zł. Pytanie, czy taki był cel ministra Kowalczyka z Prawa i […]
id: sejm_api_b69a434f04fe796865f6cfa6d6b8941a01d71d24460bf1cbb7fea358420cfc0c
source: sejm_api
added: 2026-08-22
created: 2025-11-18
token_count: 418
license: public-domain (official documents)
author: Andrzej Kryj

Szanowna Pani Marszałek! Wysoka Izbo! Pani Minister! Zgadzam się z tymi krytycznymi uwagami, które zostały tutaj wyrażone przez pana posła Piontkowskiego, przez moje koleżanki i kolegów z klubu Prawo i Sprawiedliwość, które były podnoszone także przez Koalicję na Rzecz Ocalenia Polskiej Szkoły. Ze względu na ograniczony czas nie będę się już do nich odnosił. Mam natomiast pytanie dotyczące systemu teleinformatycznego w młodzieżowych ośrodkach wychowawczych. Będą tam gromadzone bardzo wrażliwe dane dotyczące zarówno wychowanków, jak i ich rodziców. Czy pani minister nie obawia się, że te dane mogą po prostu wyciekać z tego systemu? Czy będą odpowiednio zabezpieczane? Jest to niezwykle istotna sprawa. (Oklaski) Przebieg posiedzenia Krzysztof Grabczuk: 10. kadencja,  45. posiedzenie, 1. […]
id: sejm_api_c8c122b743d47cd008cd1ec56797573a7cf588f90bfe0d6a7380235097516a4a
source: sejm_api
added: 2026-08-22
created: 2025-12-17
token_count: 593
license: public-domain (official documents)
author: Marcin Józefaciuk

Szanowna Pani Marszałek! Wysoka Izbo! Swoje stanowisko już przedstawiłem. Chciałbym zadać kilka pytań i chciałbym uzyskać wszystkie odpowiedzi na piśmie, panie ministrze. Czy projekt ustawy wprowadza obowiązek trzymania psów w kojcach lub nakazuje ich budowę? Czy zawetowana ustawa narzuca jeden model utrzymywania psa, czy dopuszcza różne formy opieki, w tym przebywanie zwierzęcia w domu lub na bezpiecznym, ogrodzonym terenie? Dlaczego w argumentacji prezydent posługuje się porównaniem kojców do kawalerek miejskich? Dlaczego prezydent obraża lokatorów takich powierzchni, podając ich jako przykład czegoś gorszego czy też niewystarczającego? Na jakiej podstawie prezydent uważa, że ludzie zaczną porzucać psy oraz przestaną adoptować zwierzęta? Czy jest to poparte analizą, doświadczeniem […]

🤖 Generated with Claude Code

ppuzio changed pull request status to open
ppuzio changed pull request status to merged
ppuzio deleted the refs/pr/69 ref

Sign up or log in to comment