Live-Run von Sub-Issue B im Container hat zwei Test-False-Positives in ground_truth.py aufgedeckt, die nichts mit Adapter-Bugs zu tun haben: - BW: PDF-URL kodiert den Underscore als %5F (`17%5F10323.pdf`), nicht als nacktes `_`. pdf_url_substring auf `17%5f10323` aktualisiert. - RP: PDFs werden von `dokumente.landtag.rlp.de` ausgeliefert (nicht von `opal.rlp.de` — das ist nur das Suchfrontend). Substring auf die Drucksachen-Nummer im Pfad (`11250-18`) umgestellt — robust gegen weiteren URL-Schema-Drift. 176 Unit-Tests bleiben grün. Refs: #52, #59 (Sub-B Live-Verifikation) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
156 lines
7.2 KiB
Python
156 lines
7.2 KiB
Python
"""Manuell kuratierte Drucksachen pro aktivem Bundesland.
|
|
|
|
Pro BL **ein** Drucksachen-Tupel, das aus der jeweiligen Frontend-Suche
|
|
des Landtags stammt. Diese Tupel sind die externe Ground Truth, gegen
|
|
die der Adapter via ``adapter.get_document(...)`` gespiegelt wird
|
|
(siehe ``test_frontend_xref.py``, Sub-Issue B).
|
|
|
|
## Wartung
|
|
|
|
Wenn ein Test in ``test_frontend_xref.py`` rot wird, ist mit hoher
|
|
Wahrscheinlichkeit der Adapter durch eine Backend-Schema-Änderung
|
|
gedriftet. Der Wartende soll dann:
|
|
|
|
1. ``frontend_search_url`` öffnen
|
|
2. Die Drucksache `drucksache` dort suchen
|
|
3. Felder gegen das ``GroundTruth``-Tupel hier abgleichen
|
|
4. Wenn die Felder im Frontend identisch geblieben sind, ist es ein
|
|
echter Adapter-Bug → Adapter fixen
|
|
5. Wenn das Frontend selbst sich geändert hat (z.B. neue URL-Struktur),
|
|
ein neues Sample auswählen und das Tupel hier aktualisieren
|
|
|
|
## Wie Samples ausgewählt werden
|
|
|
|
Ideal: ein klar parteinaher Antrag der letzten 6 Monate, mit eindeutigem
|
|
Title (Substring-Match-Toleranz) und unstrittiger Fraktion. Vermeiden:
|
|
gemeinsame Anträge aller Fraktionen (Fraktionen-Test wird zu strikt),
|
|
Anhörungen oder Berichte (Type-Filter-Test wird zu strikt), sehr alte
|
|
Drucksachen (höhere Wahrscheinlichkeit dass der Adapter die nicht
|
|
mehr im paginierten Window findet).
|
|
"""
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class GroundTruth:
|
|
"""Ein bekanntes Drucksache-Tupel als externe Ground Truth."""
|
|
|
|
bundesland: str
|
|
drucksache: str # z.B. "8/6390"
|
|
title_substring: str # eindeutiger Substring (klein gehalten)
|
|
expected_fraktionen: set[str] = field(default_factory=set)
|
|
datum: str = "" # ISO; leer wenn der Adapter es legitim nicht extrahiert
|
|
pdf_url_substring: str = "" # leer wenn die URL volatil ist
|
|
frontend_search_url: str = "" # Doku, woher das Sample stammt
|
|
|
|
|
|
# Eine Drucksache pro aktivem Bundesland.
|
|
# Stand: 2026-04-09. Bei Drift bitte das Sample ersetzen, nicht löschen.
|
|
GROUND_TRUTH: list[GroundTruth] = [
|
|
# ─── NRW (OPAL) ─────────────────────────────────────────────────────
|
|
# NRW-Drucksachen folgen dem MMD18-XXXXX.pdf-URL-Schema. Substring
|
|
# "MMD18-" matched alle aktuellen Anträge der WP18.
|
|
GroundTruth(
|
|
bundesland="NRW",
|
|
drucksache="18/12345",
|
|
title_substring="", # tbd: ersetzen mit echtem Sample
|
|
frontend_search_url="https://opal.landtag.nrw.de",
|
|
),
|
|
# ─── MV (ParlDok 8.x) ───────────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="MV",
|
|
drucksache="8/6390",
|
|
title_substring="Krisenmechanismus",
|
|
expected_fraktionen={"CDU"},
|
|
datum="2026-03-18",
|
|
pdf_url_substring="dokument/",
|
|
frontend_search_url="https://www.dokumentation.landtag-mv.de/parldok/",
|
|
),
|
|
# ─── BE (PARDOK / portala) ──────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="BE",
|
|
drucksache="19/3107",
|
|
title_substring="Kleingewässerprogramm",
|
|
expected_fraktionen={"CDU", "SPD"},
|
|
datum="", # BE-Card-Parser extrahiert Datum sometimes via "vom"
|
|
pdf_url_substring="pardok.parlament-berlin.de",
|
|
frontend_search_url="https://pardok.parlament-berlin.de/portala/",
|
|
),
|
|
# ─── LSA (PADOKA / portala) ─────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="LSA",
|
|
drucksache="8/6726",
|
|
title_substring="Demokratie beginnt im Klassenzimmer",
|
|
expected_fraktionen={"GRÜNE"},
|
|
datum="2026-03-06",
|
|
pdf_url_substring="d6726",
|
|
frontend_search_url="https://padoka.landtag.sachsen-anhalt.de/portal/",
|
|
),
|
|
# ─── BW (PARLIS / portala-Variante) ─────────────────────────────────
|
|
# BW kodiert den Underscore in der PDF-URL als %5F (z.B.
|
|
# "17%5F10323.pdf"), deshalb ist das URL-Substring-Pattern hier
|
|
# %5F-getrennt — `17_10323` würde nicht matchen.
|
|
GroundTruth(
|
|
bundesland="BW",
|
|
drucksache="17/10323",
|
|
title_substring="Arbeitsbedingungen",
|
|
expected_fraktionen={"GRÜNE"},
|
|
datum="2026-03-16",
|
|
pdf_url_substring="17%5f10323",
|
|
frontend_search_url="https://parlis.landtag-bw.de/parlis/",
|
|
),
|
|
# ─── HH (ParlDok 8.x) ───────────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="HH",
|
|
drucksache="23/3700",
|
|
title_substring="Stadtteilklinik",
|
|
expected_fraktionen={"LINKE"},
|
|
datum="2026-04-08",
|
|
pdf_url_substring="dokument/",
|
|
frontend_search_url="https://www.buergerschaft-hh.de/parldok/",
|
|
),
|
|
# ─── TH (ParlDok 8.x) ───────────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="TH",
|
|
drucksache="8/1594",
|
|
title_substring="Lernmittelbeschaffung",
|
|
expected_fraktionen={"AfD"},
|
|
datum="2026-03-31",
|
|
pdf_url_substring="dokument/",
|
|
frontend_search_url="https://parldok.thueringer-landtag.de/parldok/",
|
|
),
|
|
# ─── SH (Starfinder-CGI) ────────────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="SH",
|
|
drucksache="20/4309",
|
|
title_substring="Gesunde Ernährung",
|
|
expected_fraktionen={"SSW"},
|
|
datum="2026-04-07",
|
|
pdf_url_substring="drucksache-20-04309",
|
|
frontend_search_url="http://lissh.lvn.parlanet.de",
|
|
),
|
|
# ─── BB (parladoku / portala) ───────────────────────────────────────
|
|
GroundTruth(
|
|
bundesland="BB",
|
|
drucksache="8/2",
|
|
title_substring="Geschäftsordnung",
|
|
expected_fraktionen={"BSW"},
|
|
datum="2024-10-17",
|
|
pdf_url_substring="parlamentsdokumentation.brandenburg.de",
|
|
frontend_search_url="https://www.parlamentsdokumentation.brandenburg.de/portal/",
|
|
),
|
|
# ─── RP (OPAL / portala) ────────────────────────────────────────────
|
|
# PDFs werden vom Landtag von `dokumente.landtag.rlp.de` ausgeliefert,
|
|
# nicht von `opal.rlp.de` (das ist nur das Suchfrontend). Substring auf
|
|
# die Drucksache-Nummer im Pfad — robust gegen weitere URL-Drift.
|
|
GroundTruth(
|
|
bundesland="RP",
|
|
drucksache="18/11250",
|
|
title_substring="Bildungschancen",
|
|
expected_fraktionen={"GRÜNE", "SPD", "FDP"},
|
|
datum="2025-01-23",
|
|
pdf_url_substring="11250-18",
|
|
frontend_search_url="https://opal.rlp.de/portal/",
|
|
),
|
|
]
|