Datasets:
sejm_api: credit split rows to the name in the header, not the label minus its first word
Browse filesThe snapshot's speaker convention (label minus its first word) is right for "Poseł Jan
Kowalski" but turns "Podsekretarz Stanu w Ministerstwie Zdrowia Janusz Cieszyński" into
"Stanu w Ministerstwie Zdrowia Janusz Cieszyński". split_trailers now returns the header's
own name ("Przebieg posiedzenia <name>:") and split_release_rows credits it. 2,193
published split rows change author (2,052 office fragments, 129 "(tekst niewygłoszony)"
suffixes, 12 "Sprawozdawca" prefixes) and therefore id; text, counts and stats.json are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
artifacts/source_findings.md
CHANGED
|
@@ -2225,15 +2225,22 @@ are 23,485,670 characters (24% of the source), released in v0.2.5 (Hub PR 16).
|
|
| 2225 |
|
| 2226 |
**Fix** — `src/clean_sejm_api.py` (inputs pinned by SHA-256 to the pre-cut files at
|
| 2227 |
`262df1b`, unchanged since v0.2.5) cuts every trailer with `sejm_api_common.split_trailers` and emits each
|
| 2228 |
-
appended statement as a row of its own (`split_release_rows`): speaker
|
| 2229 |
-
|
| 2230 |
-
121,342 of 121,353 headers across both sejm sources), date and term of the parent row,
|
| 2231 |
`split_from` = parent id, `has_events: null`. Rows under 200 characters after the cut
|
| 2232 |
(1,318 parents, 53 split rows) and 8 new exact duplicates are dropped. 38,812 → 39,899
|
| 2233 |
documents, 36,335,587 → 30,860,439 tokens. Same-speaker follow-ups (373) are kept as
|
| 2234 |
separate rows; agenda titles ("N. punkt porządku dziennego: …", "Oświadczenia.") before a
|
| 2235 |
follow-up are dropped.
|
| 2236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2237 |
**Upstream quirk** — the snapshot labels the 11th sitting of term 10 (2024-05-08/09/15)
|
| 2238 |
"11. kadencja" in 696 headers. The split keeps the parent's term; a trailer dated on
|
| 2239 |
another day than its parent fails closed (none occur).
|
|
|
|
| 2225 |
|
| 2226 |
**Fix** — `src/clean_sejm_api.py` (inputs pinned by SHA-256 to the pre-cut files at
|
| 2227 |
`262df1b`, unchanged since v0.2.5) cuts every trailer with `sejm_api_common.split_trailers` and emits each
|
| 2228 |
+
appended statement as a row of its own (`split_release_rows`): speaker = the name the
|
| 2229 |
+
header gives ("Przebieg posiedzenia {name}:"), date and term of the parent row,
|
|
|
|
| 2230 |
`split_from` = parent id, `has_events: null`. Rows under 200 characters after the cut
|
| 2231 |
(1,318 parents, 53 split rows) and 8 new exact duplicates are dropped. 38,812 → 39,899
|
| 2232 |
documents, 36,335,587 → 30,860,439 tokens. Same-speaker follow-ups (373) are kept as
|
| 2233 |
separate rows; agenda titles ("N. punkt porządku dziennego: …", "Oświadczenia.") before a
|
| 2234 |
follow-up are dropped.
|
| 2235 |
|
| 2236 |
+
**Author of a split row** — the first push of this PR credited split rows in the snapshot's own
|
| 2237 |
+
`speaker` convention, the header label minus its first word. That is right for "Poseł Jan
|
| 2238 |
+
Kowalski" but leaves an office fragment for officials ("Podsekretarz Stanu w Ministerstwie
|
| 2239 |
+
Zdrowia Janusz Cieszyński" -> "Stanu w Ministerstwie Zdrowia Janusz Cieszyński"). The header's
|
| 2240 |
+
name fixes 2,052 published split rows; 129 more lose a "(tekst niewygłoszony)" suffix and 12 a
|
| 2241 |
+
"Sprawozdawca" prefix that the snapshot keeps on its own rows. Text, counts and stats are
|
| 2242 |
+
unchanged; the ids of these 2,193 rows change, since the id hashes the speaker.
|
| 2243 |
+
|
| 2244 |
**Upstream quirk** — the snapshot labels the 11th sitting of term 10 (2024-05-08/09/15)
|
| 2245 |
"11. kadencja" in 696 headers. The split keeps the parent's term; a trailer dated on
|
| 2246 |
another day than its parent fails closed (none occur).
|
data/sejm_api/sejm_api.attribution.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:47d87542492629791df1112455ad4f5754fc74cd11ef620d7559ee4a243e80b1
|
| 3 |
+
size 19448386
|
data/sejm_api/sejm_api.md
CHANGED
|
@@ -71,8 +71,8 @@ appends to 34,980 of the 38,812 fetched speeches a "Przebieg posiedzenia" header
|
|
| 71 |
of a later statement of the same sitting day, and sometimes that statement's
|
| 72 |
text. `src/clean_sejm_api.py` cuts every trailer (23,485,670 characters). An
|
| 73 |
appended statement with text becomes a row of its own (2,466 rows), credited to
|
| 74 |
-
the
|
| 75 |
-
|
| 76 |
of the row it was cut from: the snapshot labels the 11th sitting of term 10
|
| 77 |
(2024-05-08, 2024-05-09, 2024-05-15) "11. kadencja" in 696 headers. A split row's
|
| 78 |
id hashes its date, term, speaker and text like every other row; its sidecar
|
|
|
|
| 71 |
of a later statement of the same sitting day, and sometimes that statement's
|
| 72 |
text. `src/clean_sejm_api.py` cuts every trailer (23,485,670 characters). An
|
| 73 |
appended statement with text becomes a row of its own (2,466 rows), credited to
|
| 74 |
+
the speaker the header names ("Przebieg posiedzenia Janusz Kowalski: …"), without
|
| 75 |
+
the office in its label. Its date and term are those
|
| 76 |
of the row it was cut from: the snapshot labels the 11th sitting of term 10
|
| 77 |
(2024-05-08, 2024-05-09, 2024-05-15) "11. kadencja" in 696 headers. A split row's
|
| 78 |
id hashes its date, term, speaker and text like every other row; its sidecar
|
data/sejm_api/sejm_api.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba2daa20d2d2753c09e8bdd477839f43c82170f44caeadc634cb2295362c9c3b
|
| 3 |
+
size 34336428
|
src/sejm_api_common.py
CHANGED
|
@@ -54,10 +54,10 @@ def split_trailers(text: str, author: str) -> tuple[str, list[dict[str, str]]]:
|
|
| 54 |
|
| 55 |
A trailer's `text` is what follows its "<label>: " line. Without that line it is what follows
|
| 56 |
the agenda title when the trailer names the row's own speaker (a follow-up of theirs), else ""
|
| 57 |
-
(the header of a statement that has a row of its own). `date` is ISO. `
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
"""
|
| 62 |
end = TRUNCATED_TRAILER.search(text)
|
| 63 |
stop = end.start() if end else len(text)
|
|
@@ -74,7 +74,7 @@ def split_trailers(text: str, author: str) -> tuple[str, list[dict[str, str]]]:
|
|
| 74 |
else:
|
| 75 |
body = ""
|
| 76 |
day, month, year = head["date"].split("-")
|
| 77 |
-
trailers.append({"name": head["name"], "
|
| 78 |
"date": f"{year}-{month}-{day}", "text": body.strip()})
|
| 79 |
return own, trailers
|
| 80 |
|
|
@@ -132,9 +132,9 @@ def split_release_rows(rows: list[dict[str, Any]], sidecar: list[dict[str, Any]]
|
|
| 132 |
raise ValueError(f"{row['id']}: a trailer from another sitting day: {trailer['date']}")
|
| 133 |
counts["split_rows"] += 1
|
| 134 |
new_id = stable_document_id({"date": trailer["date"], "term": line["term"],
|
| 135 |
-
"speaker": trailer["
|
| 136 |
-
new_row, new_line = with_text({**row, "id": new_id, "author": trailer["
|
| 137 |
-
{**line, "id": new_id, "speaker": trailer["
|
| 138 |
"has_events": None, "split_from": row["id"]}, trailer["text"])
|
| 139 |
emit(new_row, new_line, True)
|
| 140 |
return out_rows, out_sidecar, counts
|
|
|
|
| 54 |
|
| 55 |
A trailer's `text` is what follows its "<label>: " line. Without that line it is what follows
|
| 56 |
the agenda title when the trailer names the row's own speaker (a follow-up of theirs), else ""
|
| 57 |
+
(the header of a statement that has a row of its own). `date` is ISO. `name` is the header's
|
| 58 |
+
own speaker name; the label prefixes it with an office ("Podsekretarz Stanu w Ministerstwie
|
| 59 |
+
Zdrowia Janusz Cieszyński"), which the snapshot's `speaker` convention (the label without its
|
| 60 |
+
first word) would garble.
|
| 61 |
"""
|
| 62 |
end = TRUNCATED_TRAILER.search(text)
|
| 63 |
stop = end.start() if end else len(text)
|
|
|
|
| 74 |
else:
|
| 75 |
body = ""
|
| 76 |
day, month, year = head["date"].split("-")
|
| 77 |
+
trailers.append({"name": head["name"], "term": head["term"],
|
| 78 |
"date": f"{year}-{month}-{day}", "text": body.strip()})
|
| 79 |
return own, trailers
|
| 80 |
|
|
|
|
| 132 |
raise ValueError(f"{row['id']}: a trailer from another sitting day: {trailer['date']}")
|
| 133 |
counts["split_rows"] += 1
|
| 134 |
new_id = stable_document_id({"date": trailer["date"], "term": line["term"],
|
| 135 |
+
"speaker": trailer["name"], "text": trailer["text"]}, row["source"])
|
| 136 |
+
new_row, new_line = with_text({**row, "id": new_id, "author": trailer["name"]},
|
| 137 |
+
{**line, "id": new_id, "speaker": trailer["name"],
|
| 138 |
"has_events": None, "split_from": row["id"]}, trailer["text"])
|
| 139 |
emit(new_row, new_line, True)
|
| 140 |
return out_rows, out_sidecar, counts
|
src/test_sejm_api_contract.py
CHANGED
|
@@ -246,7 +246,7 @@ class TrailerSplitTests(unittest.TestCase):
|
|
| 246 |
own = "Komisja Ochrony Środowiska, Zasobów Naturalnych i Leśnictwa - godz. 17. Dziękuję."
|
| 247 |
text = own + " " + header("Krzysztof Paszyk", "Poseł Krzysztof Paszyk", "11-01-2023")
|
| 248 |
self.assertEqual(split_trailers(text, "Ryszard Terlecki"), (own, [{
|
| 249 |
-
"name": "Krzysztof Paszyk", "
|
| 250 |
"date": "2023-01-11", "text": ""}]))
|
| 251 |
|
| 252 |
def test_appended_statement_after_its_label_line_is_kept(self) -> None:
|
|
@@ -259,8 +259,8 @@ class TrailerSplitTests(unittest.TestCase):
|
|
| 259 |
self.assertEqual(own, "Co zamierzacie zrobić w najbliższym czasie? Dziękuję.")
|
| 260 |
self.assertEqual(len(trailers), 1)
|
| 261 |
self.assertEqual(trailers[0]["text"], speech)
|
| 262 |
-
# The
|
| 263 |
-
self.assertEqual(trailers[0]["
|
| 264 |
|
| 265 |
def test_term_7_follow_up_of_the_same_speaker_and_a_later_header(self) -> None:
|
| 266 |
follow_up = ("Mój wniosek formalny jest taki, żeby pani marszałek odpowiedziała Wysokiej Izbie. "
|
|
|
|
| 246 |
own = "Komisja Ochrony Środowiska, Zasobów Naturalnych i Leśnictwa - godz. 17. Dziękuję."
|
| 247 |
text = own + " " + header("Krzysztof Paszyk", "Poseł Krzysztof Paszyk", "11-01-2023")
|
| 248 |
self.assertEqual(split_trailers(text, "Ryszard Terlecki"), (own, [{
|
| 249 |
+
"name": "Krzysztof Paszyk", "term": "9",
|
| 250 |
"date": "2023-01-11", "text": ""}]))
|
| 251 |
|
| 252 |
def test_appended_statement_after_its_label_line_is_kept(self) -> None:
|
|
|
|
| 259 |
self.assertEqual(own, "Co zamierzacie zrobić w najbliższym czasie? Dziękuję.")
|
| 260 |
self.assertEqual(len(trailers), 1)
|
| 261 |
self.assertEqual(trailers[0]["text"], speech)
|
| 262 |
+
# The header's name, not the label minus its first word ("Stanu w Ministerstwie ...").
|
| 263 |
+
self.assertEqual(trailers[0]["name"], "Janusz Kowalski")
|
| 264 |
|
| 265 |
def test_term_7_follow_up_of_the_same_speaker_and_a_later_header(self) -> None:
|
| 266 |
follow_up = ("Mój wniosek formalny jest taki, żeby pani marszałek odpowiedziała Wysokiej Izbie. "
|