ppuzio commited on
Commit
e56f0c3
·
1 Parent(s): f55d9ea

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

Browse files

- sejm_api: state the contributor snapshot in provenance (v0.2.6, v2#57) (95e01b92b8929107be2c381e8e47302b0417f9b6)
- sejm_api: drop the stale parlamint_pl sentence from the card and its template (25e6ecc2481c998e41a8d88566628dd1f9baa90b)
- Merge origin/main (PRs 67, 70, 68) into sejm_api provenance (c9a2d80bcbf0e08cbdfef39f00e98d195c669bf4)

artifacts/source_findings.md CHANGED
@@ -1655,3 +1655,31 @@ the previous parquet: only `wikipedia_833396` and `wikipedia_1126780` removed, n
1655
  or changed, same in the attribution sidecar. Row order differs between builds
1656
  (`build_dynaword.py` uses `imap_unordered`); content per id is identical. The copyright
1657
  sample keeps its population (the previous build) and records the two dropped ids.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1655
  or changed, same in the attribution sidecar. Row order differs between builds
1656
  (`build_dynaword.py` uses `imap_unordered`); content per id is identical. The copyright
1657
  sample keeps its population (the previous build) and records the two dropped ids.
1658
+
1659
+ ## sejm_api — provenance relabelled (2026-10-06)
1660
+
1661
+ **Verdict** — kept, rows unchanged: 38,812 documents, 36,335,587 tokens, parquet
1662
+ sha256 `56f7b03483488dec8f0fa145c6d26746926175d83096e9d1931e535aa81cf161` as in v0.2.5.
1663
+ Registry, card and NOTICE now say "Sejm API data via contributor snapshot" instead of
1664
+ "Direct official Sejm API records". The text is the Hugging Face dataset
1665
+ `PiotrSty/sejm-speeches-corpus@v1.0.1` (commit `124557799608`); SlayerLab did not
1666
+ fetch it from the API.
1667
+
1668
+ **Reason** — all 38,812 `source_url` values in the sidecar match
1669
+ `https://api.sejm.gov.pl/sejm/term{N}/videos/{date}`: one URL per sitting day, so
1670
+ the "speech-level provenance" line in the card was wrong. That is now a test in
1671
+ `src/test_sejm_api_contract.py`.
1672
+
1673
+ ### Not established
1674
+
1675
+ - Whether the API publishes per-speech URLs, and whether the snapshot text matches
1676
+ the live API (the audit asked for 20 rows to be spot-checked; not done here).
1677
+ - Whether the www.sejm.gov.pl terms reach API output; the API documents no licence.
1678
+ - (Fixed in a follow-up commit: the card's "Temporal novelty" paragraph named
1679
+ `parlamint_pl` as registered; it left the registry in #54.)
1680
+
1681
+ References: polish-dynaword-v2 #57; `rights_audit_2026-10/REVIEW.html` `#sejm_api`;
1682
+ `reports/citations/sejm_sis.md`.
1683
+
1684
+ **Lesson** — a card line that says "speech-level" must be backed by a test on the
1685
+ sidecar, not by the template that wrote it.
data/sejm_api/NOTICE.md CHANGED
@@ -1,8 +1,9 @@
1
  # Source attribution
2
 
3
- Official materials: Kancelaria Sejmu RP, API Sejmu — https://api.sejm.gov.pl/.
 
4
 
5
- Speech attribution is preserved in `author`; the full source URL is in `sejm_api.attribution.jsonl`.
6
 
7
  Corpus preparation and contribution: Piotr Styła (Hugging Face: PiotrSty; GitHub: PiotrStyla).
8
 
 
1
  # Source attribution
2
 
3
+ Official materials: Kancelaria Sejmu RP, API Sejmu — https://api.sejm.gov.pl/,
4
+ obtained via the contributor snapshot `PiotrSty/sejm-speeches-corpus@v1.0.1`.
5
 
6
+ Speech attribution is preserved in `author`; the day-level source URL is in `sejm_api.attribution.jsonl`.
7
 
8
  Corpus preparation and contribution: Piotr Styła (Hugging Face: PiotrSty; GitHub: PiotrStyla).
9
 
data/sejm_api/sejm_api.md CHANGED
@@ -27,19 +27,23 @@ source. No unverified upstream Creative Commons license is asserted.
27
  ## Provenance and reproducibility
28
 
29
  - Official provider: Kancelaria Sejmu RP.
 
 
 
30
  - Immutable source release: `PiotrSty/sejm-speeches-corpus@v1.0.1`.
31
  - Pinned source commit: `124557799608ce4212cf22fa90ca7904618de1b6`.
32
  - Reviewed DynaWord base commit: `8cc48a3c564ac9edabfbbf012842ad11f70a3e5c`.
33
  - Rebuild: `python src/fetch_sejm_api.py --help`.
34
- - Source URLs and speech-level provenance are in `sejm_api.attribution.jsonl`.
 
 
35
  - Slayer contribution digest: `sha256:38e42a791d68d593f82e1125f2bb94cd8f68212433e71d3e3da90f82d78eaf32`.
36
 
37
  ## Temporal novelty and deduplication
38
 
39
- `parliamentary` ends on `2019-12-31` and registered
40
- `parlamint_pl` ends on `2022-12-31`. Every contributed
41
- record is dated on or after `2023-01-01`, so its date range overlaps neither
42
- source. Exact duplicate speech texts within the contribution are removed using
43
  SHA-1 fingerprints; this is not a claim of global cross-domain near-deduplication.
44
 
45
  ## Statistics
 
27
  ## Provenance and reproducibility
28
 
29
  - Official provider: Kancelaria Sejmu RP.
30
+ - Data route: Sejm API data via contributor snapshot. The text comes from the
31
+ Hugging Face dataset `PiotrSty/sejm-speeches-corpus@v1.0.1`, not from the live
32
+ API; SlayerLab did not re-fetch it from api.sejm.gov.pl.
33
  - Immutable source release: `PiotrSty/sejm-speeches-corpus@v1.0.1`.
34
  - Pinned source commit: `124557799608ce4212cf22fa90ca7904618de1b6`.
35
  - Reviewed DynaWord base commit: `8cc48a3c564ac9edabfbbf012842ad11f70a3e5c`.
36
  - Rebuild: `python src/fetch_sejm_api.py --help`.
37
+ - Speaker attribution and source URLs are in `sejm_api.attribution.jsonl`. Each
38
+ `source_url` is a day-level listing (`https://api.sejm.gov.pl/sejm/term{N}/videos/{date}`),
39
+ not a per-speech URL.
40
  - Slayer contribution digest: `sha256:38e42a791d68d593f82e1125f2bb94cd8f68212433e71d3e3da90f82d78eaf32`.
41
 
42
  ## Temporal novelty and deduplication
43
 
44
+ `parliamentary` ends on `2019-12-31`. Every contributed
45
+ record is dated on or after `2023-01-01`, so its date range does not overlap it.
46
+ Exact duplicate speech texts within the contribution are removed using
 
47
  SHA-1 fingerprints; this is not a claim of global cross-domain near-deduplication.
48
 
49
  ## Statistics
src/fetch_sejm_api.py CHANGED
@@ -153,9 +153,11 @@ def insert_source_registry_entry(registry: str, *, end_date: str) -> str:
153
  ' "under Polish Copyright Act art. 4(2); reusable under "\n'
154
  ' "the Polish Open Data Act arts. 2(12), 5, 14 and 17.",\n'
155
  ' "upstream": "https://api.sejm.gov.pl/",\n'
156
- ' "provenance": "Direct official Sejm API records, preserved with speaker "\n'
157
- ' "attribution and immutable PiotrSty/sejm-speeches-corpus "\n'
158
- ' "v1.0.1 source provenance.",\n'
 
 
159
  ' "domain": "political/spoken",\n'
160
  f' "created": "{START_DATE}, {end_date}",\n'
161
  ' "is_ocr": False,\n'
@@ -213,19 +215,23 @@ source. No unverified upstream Creative Commons license is asserted.
213
  ## Provenance and reproducibility
214
 
215
  - Official provider: Kancelaria Sejmu RP.
 
 
 
216
  - Immutable source release: `{SOURCE_REPOSITORY}@{SOURCE_RELEASE}`.
217
  - Pinned source commit: `{source_revision}`.
218
  - Reviewed DynaWord base commit: `{target_revision}`.
219
  - Rebuild: `python src/fetch_sejm_api.py --help`.
220
- - Source URLs and speech-level provenance are in `sejm_api.attribution.jsonl`.
 
 
221
  - Slayer contribution digest: `sha256:{contribution_digest}`.
222
 
223
  ## Temporal novelty and deduplication
224
 
225
- `parliamentary` ends on `{prior_sources['parliamentary']}` and registered
226
- `parlamint_pl` ends on `{prior_sources['parlamint_pl']}`. Every contributed
227
- record is dated on or after `{START_DATE}`, so its date range overlaps neither
228
- source. Exact duplicate speech texts within the contribution are removed using
229
  SHA-1 fingerprints; this is not a claim of global cross-domain near-deduplication.
230
 
231
  ## Statistics
@@ -503,8 +509,9 @@ def build_contribution(
503
  )
504
  (data_dir / "NOTICE.md").write_text(
505
  "# Source attribution\n\n"
506
- "Official materials: Kancelaria Sejmu RP, API Sejmu — https://api.sejm.gov.pl/.\n\n"
507
- "Speech attribution is preserved in `author`; the full source URL is in "
 
508
  "`sejm_api.attribution.jsonl`.\n\n"
509
  "Corpus preparation and contribution: Piotr Styła (Hugging Face: PiotrSty; "
510
  "GitHub: PiotrStyla).\n\n"
 
153
  ' "under Polish Copyright Act art. 4(2); reusable under "\n'
154
  ' "the Polish Open Data Act arts. 2(12), 5, 14 and 17.",\n'
155
  ' "upstream": "https://api.sejm.gov.pl/",\n'
156
+ ' "provenance": "Sejm API data via contributor snapshot: text from the "\n'
157
+ ' "PiotrSty/sejm-speeches-corpus v1.0.1 Hugging Face snapshot "\n'
158
+ ' "(commit 1245577), not fetched from the live API by SlayerLab. "\n'
159
+ ' "Speaker attribution preserved; source_url is a day-level "\n'
160
+ ' "api.sejm.gov.pl /videos/ listing, not a per-speech URL.",\n'
161
  ' "domain": "political/spoken",\n'
162
  f' "created": "{START_DATE}, {end_date}",\n'
163
  ' "is_ocr": False,\n'
 
215
  ## Provenance and reproducibility
216
 
217
  - Official provider: Kancelaria Sejmu RP.
218
+ - Data route: Sejm API data via contributor snapshot. The text comes from the
219
+ Hugging Face dataset `PiotrSty/sejm-speeches-corpus@v1.0.1`, not from the live
220
+ API; SlayerLab did not re-fetch it from api.sejm.gov.pl.
221
  - Immutable source release: `{SOURCE_REPOSITORY}@{SOURCE_RELEASE}`.
222
  - Pinned source commit: `{source_revision}`.
223
  - Reviewed DynaWord base commit: `{target_revision}`.
224
  - Rebuild: `python src/fetch_sejm_api.py --help`.
225
+ - Speaker attribution and source URLs are in `sejm_api.attribution.jsonl`. Each
226
+ `source_url` is a day-level listing (`https://api.sejm.gov.pl/sejm/term{{N}}/videos/{{date}}`),
227
+ not a per-speech URL.
228
  - Slayer contribution digest: `sha256:{contribution_digest}`.
229
 
230
  ## Temporal novelty and deduplication
231
 
232
+ `parliamentary` ends on `{prior_sources['parliamentary']}`. Every contributed
233
+ record is dated on or after `{START_DATE}`, so its date range does not overlap it.
234
+ Exact duplicate speech texts within the contribution are removed using
 
235
  SHA-1 fingerprints; this is not a claim of global cross-domain near-deduplication.
236
 
237
  ## Statistics
 
509
  )
510
  (data_dir / "NOTICE.md").write_text(
511
  "# Source attribution\n\n"
512
+ "Official materials: Kancelaria Sejmu RP, API Sejmu — https://api.sejm.gov.pl/,\n"
513
+ "obtained via the contributor snapshot `PiotrSty/sejm-speeches-corpus@v1.0.1`.\n\n"
514
+ "Speech attribution is preserved in `author`; the day-level source URL is in "
515
  "`sejm_api.attribution.jsonl`.\n\n"
516
  "Corpus preparation and contribution: Piotr Styła (Hugging Face: PiotrSty; "
517
  "GitHub: PiotrStyla).\n\n"
src/sources.py CHANGED
@@ -267,9 +267,11 @@ SOURCES = {
267
  "under Polish Copyright Act art. 4(2); reusable under "
268
  "the Polish Open Data Act arts. 2(12), 5, 14 and 17.",
269
  "upstream": "https://api.sejm.gov.pl/",
270
- "provenance": "Direct official Sejm API records, preserved with speaker "
271
- "attribution and immutable PiotrSty/sejm-speeches-corpus "
272
- "v1.0.1 source provenance.",
 
 
273
  "domain": "political/spoken",
274
  "created": "2023-01-01, 2026-07-03",
275
  "is_ocr": False,
 
267
  "under Polish Copyright Act art. 4(2); reusable under "
268
  "the Polish Open Data Act arts. 2(12), 5, 14 and 17.",
269
  "upstream": "https://api.sejm.gov.pl/",
270
+ "provenance": "Sejm API data via contributor snapshot: text from the "
271
+ "PiotrSty/sejm-speeches-corpus v1.0.1 Hugging Face snapshot "
272
+ "(commit 1245577), not fetched from the live API by SlayerLab. "
273
+ "Speaker attribution preserved; source_url is a day-level "
274
+ "api.sejm.gov.pl /videos/ listing, not a per-speech URL.",
275
  "domain": "political/spoken",
276
  "created": "2023-01-01, 2026-07-03",
277
  "is_ocr": False,
src/test_sejm_api_contract.py CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
3
  import ast
4
  import json
5
  import pathlib
 
6
  import sys
7
  import tempfile
8
  import unittest
@@ -27,6 +28,10 @@ except ImportError:
27
  legal_evidence, normalize_source_row, stable_document_id, text_fingerprint,
28
  )
29
 
 
 
 
 
30
 
31
  REGISTRY = '''SOURCES = {
32
  "parliamentary": {
@@ -133,6 +138,11 @@ class DynawordContractTests(unittest.TestCase):
133
  self.assertIn('"parlamint_pl": {', updated)
134
  self.assertIn('"created": "2023-01-01, 2026-07-03"', updated)
135
 
 
 
 
 
 
136
  def test_legal_evidence_contains_official_sources_and_no_fake_cc(self) -> None:
137
  evidence = legal_evidence(source_revision="a" * 40, target_revision="b" * 40)
138
  self.assertEqual(evidence["dataset_record_license"], SOURCE_LICENSE)
@@ -140,6 +150,24 @@ class DynawordContractTests(unittest.TestCase):
140
  self.assertIn("no upstream Creative Commons grant is asserted", evidence["limitations"])
141
 
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  class DynawordParquetIntegrationTests(unittest.TestCase):
144
  def test_end_to_end_candidate_preserves_ontology_and_attribution(self) -> None:
145
  try:
 
3
  import ast
4
  import json
5
  import pathlib
6
+ import re
7
  import sys
8
  import tempfile
9
  import unittest
 
28
  legal_evidence, normalize_source_row, stable_document_id, text_fingerprint,
29
  )
30
 
31
+ from sources import SOURCES # noqa: E402 (src/ is on sys.path above)
32
+
33
+ ROOT = pathlib.Path(__file__).resolve().parents[1]
34
+ DAY_LEVEL_URL = re.compile(r"https://api\.sejm\.gov\.pl/sejm/term\d+/videos/\d{4}-\d{2}-\d{2}")
35
 
36
  REGISTRY = '''SOURCES = {
37
  "parliamentary": {
 
138
  self.assertIn('"parlamint_pl": {', updated)
139
  self.assertIn('"created": "2023-01-01, 2026-07-03"', updated)
140
 
141
+ def test_registry_template_matches_the_shipped_provenance(self) -> None:
142
+ updated = insert_source_registry_entry(REGISTRY, end_date="2026-07-03")
143
+ template = ast.literal_eval(updated.split("=", 1)[1])["sejm_api"]
144
+ self.assertEqual(template["provenance"], SOURCES["sejm_api"]["provenance"])
145
+
146
  def test_legal_evidence_contains_official_sources_and_no_fake_cc(self) -> None:
147
  evidence = legal_evidence(source_revision="a" * 40, target_revision="b" * 40)
148
  self.assertEqual(evidence["dataset_record_license"], SOURCE_LICENSE)
 
150
  self.assertIn("no upstream Creative Commons grant is asserted", evidence["limitations"])
151
 
152
 
153
+ class ProvenanceWordingTests(unittest.TestCase):
154
+ """v2#57: the text is a contributor snapshot, and source_url is day-level."""
155
+
156
+ def test_registry_and_card_state_the_contributor_snapshot(self) -> None:
157
+ card = (ROOT / "data" / "sejm_api" / "sejm_api.md").read_text(encoding="utf-8")
158
+ for text in (SOURCES["sejm_api"]["provenance"], card):
159
+ self.assertIn("contributor snapshot", text)
160
+ self.assertNotIn("Direct official", text)
161
+ self.assertNotIn("speech-level", text)
162
+
163
+ def test_every_source_url_is_a_day_level_listing(self) -> None:
164
+ sidecar = ROOT / "data" / "sejm_api" / "sejm_api.attribution.jsonl"
165
+ with sidecar.open(encoding="utf-8") as stream:
166
+ urls = [json.loads(line)["source_url"] for line in stream]
167
+ self.assertTrue(urls)
168
+ self.assertEqual([url for url in urls if not DAY_LEVEL_URL.fullmatch(url)], [])
169
+
170
+
171
  class DynawordParquetIntegrationTests(unittest.TestCase):
172
  def test_end_to_end_candidate_preserves_ontology_and_attribution(self) -> None:
173
  try: