Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
""" Wahlprogramm-Referenzsystem mit Zitaten und Seitenreferenzen.
Bundesland - bewusst seit Issue #5: ``WAHLPROGRAMME[bundesland][partei]`` statt
flach . Konsumiert ` ` BUNDESLAENDER ` ` aus ` ` bundeslaender . py ` ` für die
Regierungsfraktionen - Lookup und für Plausibilitätsprüfungen .
Verantwortlich für die schlüsselwortbasierte Fallback - Suche in den
paged - Textversionen der Wahlprogramme . Die semantische Suche lebt in
` ` embeddings . py ` ` .
"""
2026-03-28 22:30:24 +01:00
import re
from pathlib import Path
from typing import Optional
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
from . bundeslaender import BUNDESLAENDER
# WAHLPROGRAMME[bundesland][partei] -> Metadaten
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
#
# Pflichtfelder: file, titel, partei, jahr, seiten
# Geltungsdaten: regierungsbildung (ISO YYYY-MM-DD) — Tag der Vereidigung der
# Regierung, die nach der Wahl aus diesem Programm hervorging.
# NICHT das Wahldatum: das Programm wird mit der Regierungs-
# bildung wirksam (Koalitionsvertrag, Kabinett vereidigt).
# regierungsende (ISO YYYY-MM-DD oder None) — Ende der
# Regierungs-Geltung. ``None`` = aktuell laufende Regierung.
#
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
# Beim Hinzufügen eines neuen Bundeslands: Eintrag hier UND parallel
# in WAHLPROGRAMM_KONTEXT_FILES.
WAHLPROGRAMME : dict [ str , dict [ str , dict ] ] = {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# NRW — LTW 15.05.2022. Kabinett Wüst II (CDU+GRÜNE) vereidigt 29.06.2022.
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
" NRW " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-nrw-2022.pdf " , " titel " : " Machen, worauf es ankommt " , " partei " : " CDU NRW " , " jahr " : 2022 , " seiten " : 109 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-nrw-2022.pdf " , " titel " : " Unser Land von morgen " , " partei " : " SPD NRW " , " jahr " : 2022 , " seiten " : 116 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-nrw-2022.pdf " , " titel " : " Von hier an Zukunft " , " partei " : " BÜNDNIS 90/DIE GRÜNEN NRW " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-nrw-2022.pdf " , " titel " : " Nie gab es mehr zu tun " , " partei " : " FDP NRW " , " jahr " : 2022 , " seiten " : 96 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-nrw-2022.pdf " , " titel " : " Wer sonst. " , " partei " : " AfD NRW " , " jahr " : 2022 , " seiten " : 68 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
2026-03-28 22:30:24 +01:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Sachsen-Anhalt — LTW 06.06.2021. Kabinett Haseloff III (CDU+SPD+FDP) vereidigt 16.09.2021.
Activate LSA: Wahlprogramme + ingest + frontend (#2)
Brings Sachsen-Anhalt online as the second supported Bundesland after
NRW. Closes the gap that issue #2 left open: with the PortalaAdapter
already in place from c7242f8, this commit adds the reference data and
flips the activation switch.
Wahlprogramme (LTW Sachsen-Anhalt 06.06.2021)
- Six PDFs added under app/static/referenzen/{cdu,spd,gruene,fdp,afd,
linke}-lsa-2021.pdf, plus paged plain-text extractions under
app/kontext/*.txt for the keyword fallback search.
- Sources verified by hand:
- CDU "Unsere Heimat. Unsere Verantwortung." (cdulsa.de, 82 pages)
- SPD "Zusammenhalt und neue Chancen" (FES library, 77 pages)
- GRÜNE "Verlässlich für Sachsen-Anhalt" (gruene-lsa.de, 164 pages)
- FDP "Wahlprogramm zur Landtagswahl 2021" (Naumann-Stiftung, 76 pages)
- AfD "Alles für unsere Heimat!" (klimawahlen.de mirror, 64 pages)
- LINKE "Wahlprogramm zur Landtagswahl 2021" (dielinke-sachsen-anhalt.de,
88 pages)
- The CDU PDF was the trickiest: KAS blocks bot downloads via
Cloudflare; the cdulsa.de copy was located by an autonomous web
search and verified to be byte-identical with the official document.
Embeddings indexed (in production container, OpenAI-compatible
DashScope embeddings via the existing index_programm pipeline):
- CDU 134, SPD 145, GRÜNE 183, FDP 100, AfD 64, LINKE 143 chunks
- Total LSA: 769 new chunks alongside the existing 775 NRW chunks
and 335 federal Grundsatzprogramm chunks.
wahlprogramme.py
- WAHLPROGRAMME["LSA"] populated with all six parties (canonical fraction
codes, original titles, page counts).
embeddings.py
- PROGRAMME extended with the six new "<partei>-lsa-2021" entries that
the indexer pipeline expects.
bundeslaender.py
- LSA flipped to aktiv=True. The frontend dropdown will now offer
Sachsen-Anhalt as a selectable bundesland and analyzer.get_bundesland_
context() will produce a real LSA prompt block (CDU/SPD/FDP as
governing fractions, all six landtagsfraktionen).
End-to-end smoke test (live in production container before commit)
- Adapter: PortalaAdapter.search() returned current Anträge of März 2026
(LINKE + GRÜNE) with correct titles and PDF URLs.
- Semantic search for an LSA "ÖPNV in der Altmark" sample antrag
matched LINKE S.53, SPD S.68, FDP S.52 — all three with similarity
> 0.6 and topical hits (Regionalisierungsmittel, ÖPNV-Förderprogramm,
Wasserstoffnetz).
Resolves issue #2.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:12:32 +02:00
" LSA " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-lsa-2021.pdf " , " titel " : " Unsere Heimat. Unsere Verantwortung. " , " partei " : " CDU Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 82 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-lsa-2021.pdf " , " titel " : " Zusammenhalt und neue Chancen. Politik fürs ganze Land " , " partei " : " SPD Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 77 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-lsa-2021.pdf " , " titel " : " Verlässlich für Sachsen-Anhalt " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 164 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-lsa-2021.pdf " , " titel " : " Wahlprogramm der FDP Sachsen-Anhalt zur Landtagswahl 2021 " , " partei " : " FDP Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 76 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-lsa-2021.pdf " , " titel " : " Alles für unsere Heimat! Programm der AfD Sachsen-Anhalt zur Landtagswahl 2021 " , " partei " : " AfD Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 64 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-lsa-2021.pdf " , " titel " : " Wahlprogramm zur Landtagswahl 2021 " , " partei " : " DIE LINKE Sachsen-Anhalt " , " jahr " : 2021 , " seiten " : 88 , " regierungsbildung " : " 2021-09-16 " , " regierungsende " : None } ,
Activate LSA: Wahlprogramme + ingest + frontend (#2)
Brings Sachsen-Anhalt online as the second supported Bundesland after
NRW. Closes the gap that issue #2 left open: with the PortalaAdapter
already in place from c7242f8, this commit adds the reference data and
flips the activation switch.
Wahlprogramme (LTW Sachsen-Anhalt 06.06.2021)
- Six PDFs added under app/static/referenzen/{cdu,spd,gruene,fdp,afd,
linke}-lsa-2021.pdf, plus paged plain-text extractions under
app/kontext/*.txt for the keyword fallback search.
- Sources verified by hand:
- CDU "Unsere Heimat. Unsere Verantwortung." (cdulsa.de, 82 pages)
- SPD "Zusammenhalt und neue Chancen" (FES library, 77 pages)
- GRÜNE "Verlässlich für Sachsen-Anhalt" (gruene-lsa.de, 164 pages)
- FDP "Wahlprogramm zur Landtagswahl 2021" (Naumann-Stiftung, 76 pages)
- AfD "Alles für unsere Heimat!" (klimawahlen.de mirror, 64 pages)
- LINKE "Wahlprogramm zur Landtagswahl 2021" (dielinke-sachsen-anhalt.de,
88 pages)
- The CDU PDF was the trickiest: KAS blocks bot downloads via
Cloudflare; the cdulsa.de copy was located by an autonomous web
search and verified to be byte-identical with the official document.
Embeddings indexed (in production container, OpenAI-compatible
DashScope embeddings via the existing index_programm pipeline):
- CDU 134, SPD 145, GRÜNE 183, FDP 100, AfD 64, LINKE 143 chunks
- Total LSA: 769 new chunks alongside the existing 775 NRW chunks
and 335 federal Grundsatzprogramm chunks.
wahlprogramme.py
- WAHLPROGRAMME["LSA"] populated with all six parties (canonical fraction
codes, original titles, page counts).
embeddings.py
- PROGRAMME extended with the six new "<partei>-lsa-2021" entries that
the indexer pipeline expects.
bundeslaender.py
- LSA flipped to aktiv=True. The frontend dropdown will now offer
Sachsen-Anhalt as a selectable bundesland and analyzer.get_bundesland_
context() will produce a real LSA prompt block (CDU/SPD/FDP as
governing fractions, all six landtagsfraktionen).
End-to-end smoke test (live in production container before commit)
- Adapter: PortalaAdapter.search() returned current Anträge of März 2026
(LINKE + GRÜNE) with correct titles and PDF URLs.
- Semantic search for an LSA "ÖPNV in der Altmark" sample antrag
matched LINKE S.53, SPD S.68, FDP S.52 — all three with similarity
> 0.6 and topical hits (Regionalisierungsmittel, ÖPNV-Förderprogramm,
Wasserstoffnetz).
Resolves issue #2.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:12:32 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Mecklenburg-Vorpommern — LTW 26.09.2021. Kabinett Schwesig II (SPD+LINKE) vereidigt 15.11.2021.
Add MV+BE Wahlprogramme zur jeweils laufenden Legislatur (#4, #10)
11 PDFs in app/static/referenzen/ + Einträge in WAHLPROGRAMME
und embeddings.PROGRAMME für die beiden bisher nur per
föderalem Grundsatzprogramm-Fallback abgedeckten Landtage:
- **MV** (WP 8, seit 26.10.2021): CDU, SPD, GRÜNE, FDP, AfD, LINKE
Wahlprogramme zur LTW 26.09.2021. Issue #4.
- **BE** (WP 19, konstituiert nach Wiederholungswahl 12.02.2023):
CDU, SPD, GRÜNE, LINKE, AfD Programme zur AGH-Wahl 26.09.2021.
Die Wiederholungswahl 2023 nutzte dieselben Programme wie die
Originalwahl, daher die "be-2023.pdf"-Benennung mit Programm-
jahr 2021. Issue #10.
Quellen: abgeordnetenwatch.de Mirror für 9 PDFs, library.fes.de
für SPD MV, cdu-mv.de direkt für CDU MV, fdp-mv.de direkt für
FDP MV. Alle PDFs verifiziert via pdftotext gegen das im Programm
genannte Wahldatum, um zu vermeiden, dass aktuellere
Wahlkampf-Entwürfe (z.B. das CDU "Berlin-Plan 2026") als
Legislatur-Programm fehlinterpretiert werden.
Indexierung in die embeddings-DB ist NICHT Teil dieses Commits —
sie muss separat im prod-Container ausgeführt werden:
docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path('/app/static/referenzen')
for pid in ['cdu-mv-2021','spd-mv-2021','gruene-mv-2021',
'fdp-mv-2021','afd-mv-2021','linke-mv-2021',
'cdu-be-2023','spd-be-2023','gruene-be-2023',
'linke-be-2023','afd-be-2023']:
index_programm(pid, d)
"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 08:24:33 +02:00
" MV " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-mv-2021.pdf " , " titel " : " Zusammen. Den Blick nach vorn. Gemeinsam die Zukunft meistern " , " partei " : " CDU Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 56 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-mv-2021.pdf " , " titel " : " Verantwortung für heute und morgen — Regierungsprogramm 2021– 2026 " , " partei " : " SPD Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 95 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-mv-2021.pdf " , " titel " : " Für Klima, Land und ein besseres Miteinander " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 88 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-mv-2021.pdf " , " titel " : " Wahlprogramm der Freien Demokraten Mecklenburg-Vorpommern zur Landtagswahl 2021 " , " partei " : " FDP Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 120 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-mv-2021.pdf " , " titel " : " Landeswahlprogramm der AfD Mecklenburg-Vorpommern 2021 " , " partei " : " AfD Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 84 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-mv-2021.pdf " , " titel " : " Das ist links! — Zukunftsprogramm für Mecklenburg-Vorpommern " , " partei " : " DIE LINKE Mecklenburg-Vorpommern " , " jahr " : 2021 , " seiten " : 82 , " regierungsbildung " : " 2021-11-15 " , " regierungsende " : None } ,
Add MV+BE Wahlprogramme zur jeweils laufenden Legislatur (#4, #10)
11 PDFs in app/static/referenzen/ + Einträge in WAHLPROGRAMME
und embeddings.PROGRAMME für die beiden bisher nur per
föderalem Grundsatzprogramm-Fallback abgedeckten Landtage:
- **MV** (WP 8, seit 26.10.2021): CDU, SPD, GRÜNE, FDP, AfD, LINKE
Wahlprogramme zur LTW 26.09.2021. Issue #4.
- **BE** (WP 19, konstituiert nach Wiederholungswahl 12.02.2023):
CDU, SPD, GRÜNE, LINKE, AfD Programme zur AGH-Wahl 26.09.2021.
Die Wiederholungswahl 2023 nutzte dieselben Programme wie die
Originalwahl, daher die "be-2023.pdf"-Benennung mit Programm-
jahr 2021. Issue #10.
Quellen: abgeordnetenwatch.de Mirror für 9 PDFs, library.fes.de
für SPD MV, cdu-mv.de direkt für CDU MV, fdp-mv.de direkt für
FDP MV. Alle PDFs verifiziert via pdftotext gegen das im Programm
genannte Wahldatum, um zu vermeiden, dass aktuellere
Wahlkampf-Entwürfe (z.B. das CDU "Berlin-Plan 2026") als
Legislatur-Programm fehlinterpretiert werden.
Indexierung in die embeddings-DB ist NICHT Teil dieses Commits —
sie muss separat im prod-Container ausgeführt werden:
docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path('/app/static/referenzen')
for pid in ['cdu-mv-2021','spd-mv-2021','gruene-mv-2021',
'fdp-mv-2021','afd-mv-2021','linke-mv-2021',
'cdu-be-2023','spd-be-2023','gruene-be-2023',
'linke-be-2023','afd-be-2023']:
index_programm(pid, d)
"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 08:24:33 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Berlin — AGH-Wahl 26.09.2021, Wiederholungswahl 12.02.2023. Senat Wegner I (CDU+SPD) vereidigt 27.04.2023.
Add MV+BE Wahlprogramme zur jeweils laufenden Legislatur (#4, #10)
11 PDFs in app/static/referenzen/ + Einträge in WAHLPROGRAMME
und embeddings.PROGRAMME für die beiden bisher nur per
föderalem Grundsatzprogramm-Fallback abgedeckten Landtage:
- **MV** (WP 8, seit 26.10.2021): CDU, SPD, GRÜNE, FDP, AfD, LINKE
Wahlprogramme zur LTW 26.09.2021. Issue #4.
- **BE** (WP 19, konstituiert nach Wiederholungswahl 12.02.2023):
CDU, SPD, GRÜNE, LINKE, AfD Programme zur AGH-Wahl 26.09.2021.
Die Wiederholungswahl 2023 nutzte dieselben Programme wie die
Originalwahl, daher die "be-2023.pdf"-Benennung mit Programm-
jahr 2021. Issue #10.
Quellen: abgeordnetenwatch.de Mirror für 9 PDFs, library.fes.de
für SPD MV, cdu-mv.de direkt für CDU MV, fdp-mv.de direkt für
FDP MV. Alle PDFs verifiziert via pdftotext gegen das im Programm
genannte Wahldatum, um zu vermeiden, dass aktuellere
Wahlkampf-Entwürfe (z.B. das CDU "Berlin-Plan 2026") als
Legislatur-Programm fehlinterpretiert werden.
Indexierung in die embeddings-DB ist NICHT Teil dieses Commits —
sie muss separat im prod-Container ausgeführt werden:
docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path('/app/static/referenzen')
for pid in ['cdu-mv-2021','spd-mv-2021','gruene-mv-2021',
'fdp-mv-2021','afd-mv-2021','linke-mv-2021',
'cdu-be-2023','spd-be-2023','gruene-be-2023',
'linke-be-2023','afd-be-2023']:
index_programm(pid, d)
"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 08:24:33 +02:00
" BE " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-be-2023.pdf " , " titel " : " Unser Berlin. Mehr geht nur gemeinsam. — Berlin-Plan der CDU Berlin 2021– 2026 " , " partei " : " CDU Berlin " , " jahr " : 2021 , " seiten " : 135 , " regierungsbildung " : " 2023-04-27 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-be-2023.pdf " , " titel " : " Ganz sicher Berlin — Wahlprogramm der SPD Berlin zur Abgeordnetenhauswahl 2021 " , " partei " : " SPD Berlin " , " jahr " : 2021 , " seiten " : 86 , " regierungsbildung " : " 2023-04-27 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-be-2023.pdf " , " titel " : " Unser Plan für Berlin — Landeswahlprogramm BÜNDNIS 90/DIE GRÜNEN Berlin 2021 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Berlin " , " jahr " : 2021 , " seiten " : 280 , " regierungsbildung " : " 2023-04-27 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-be-2023.pdf " , " titel " : " rot. radikal. realistisch. — Unser Programm für die soziale Stadt " , " partei " : " DIE LINKE Berlin " , " jahr " : 2021 , " seiten " : 130 , " regierungsbildung " : " 2023-04-27 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-be-2023.pdf " , " titel " : " Wahlprogramm der AfD Berlin für die Wahl des Abgeordnetenhauses am 26. September 2021 " , " partei " : " AfD Berlin " , " jahr " : 2021 , " seiten " : 166 , " regierungsbildung " : " 2023-04-27 " , " regierungsende " : None } ,
Add MV+BE Wahlprogramme zur jeweils laufenden Legislatur (#4, #10)
11 PDFs in app/static/referenzen/ + Einträge in WAHLPROGRAMME
und embeddings.PROGRAMME für die beiden bisher nur per
föderalem Grundsatzprogramm-Fallback abgedeckten Landtage:
- **MV** (WP 8, seit 26.10.2021): CDU, SPD, GRÜNE, FDP, AfD, LINKE
Wahlprogramme zur LTW 26.09.2021. Issue #4.
- **BE** (WP 19, konstituiert nach Wiederholungswahl 12.02.2023):
CDU, SPD, GRÜNE, LINKE, AfD Programme zur AGH-Wahl 26.09.2021.
Die Wiederholungswahl 2023 nutzte dieselben Programme wie die
Originalwahl, daher die "be-2023.pdf"-Benennung mit Programm-
jahr 2021. Issue #10.
Quellen: abgeordnetenwatch.de Mirror für 9 PDFs, library.fes.de
für SPD MV, cdu-mv.de direkt für CDU MV, fdp-mv.de direkt für
FDP MV. Alle PDFs verifiziert via pdftotext gegen das im Programm
genannte Wahldatum, um zu vermeiden, dass aktuellere
Wahlkampf-Entwürfe (z.B. das CDU "Berlin-Plan 2026") als
Legislatur-Programm fehlinterpretiert werden.
Indexierung in die embeddings-DB ist NICHT Teil dieses Commits —
sie muss separat im prod-Container ausgeführt werden:
docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path('/app/static/referenzen')
for pid in ['cdu-mv-2021','spd-mv-2021','gruene-mv-2021',
'fdp-mv-2021','afd-mv-2021','linke-mv-2021',
'cdu-be-2023','spd-be-2023','gruene-be-2023',
'linke-be-2023','afd-be-2023']:
index_programm(pid, d)
"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 08:24:33 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Thüringen — LTW 01.09.2024. Kabinett Voigt I (CDU+BSW+SPD, Brombeer) vereidigt 12.12.2024.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" TH " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-th-2024.pdf " , " titel " : " Wahlprogramm der CDU Thüringen 2024 " , " partei " : " CDU Thüringen " , " jahr " : 2024 , " seiten " : 83 , " regierungsbildung " : " 2024-12-12 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-th-2024.pdf " , " titel " : " AfD Thüringen Landtagswahlprogramm 2024 " , " partei " : " AfD Thüringen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-12 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-th-2024.pdf " , " titel " : " DIE LINKE Thüringen Wahlprogramm 2024 " , " partei " : " DIE LINKE Thüringen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-12 " , " regierungsende " : None } ,
" BSW " : { " file " : " bsw-th-2024.pdf " , " titel " : " BSW Thüringen Wahlprogramm 2024 " , " partei " : " BSW Thüringen " , " jahr " : 2024 , " seiten " : 50 , " regierungsbildung " : " 2024-12-12 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-th-2024.pdf " , " titel " : " SPD Thüringen Wahlprogramm 2024 " , " partei " : " SPD Thüringen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-12 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Brandenburg — LTW 22.09.2024. Kabinett Woidke III (SPD+BSW) vereidigt 11.12.2024.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" BB " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" SPD " : { " file " : " spd-bb-2024.pdf " , " titel " : " SPD Brandenburg Wahlprogramm 2024 " , " partei " : " SPD Brandenburg " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-11 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-bb-2024.pdf " , " titel " : " AfD Brandenburg Wahlprogramm 2024 " , " partei " : " AfD Brandenburg " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-11 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-bb-2024.pdf " , " titel " : " CDU Brandenburg Wahlprogramm 2024 " , " partei " : " CDU Brandenburg " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-11 " , " regierungsende " : None } ,
" BSW " : { " file " : " bsw-bb-2024.pdf " , " titel " : " BSW Brandenburg Wahlprogramm 2024 " , " partei " : " BSW Brandenburg " , " jahr " : 2024 , " seiten " : 50 , " regierungsbildung " : " 2024-12-11 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Hamburg — Bürgerschaftswahl 02.03.2025. Senat Tschentscher III (SPD+GRÜNE) vereidigt 07.05.2025.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" HH " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" SPD " : { " file " : " spd-hh-2025.pdf " , " titel " : " SPD Hamburg Wahlprogramm Bürgerschaftswahl 2025 " , " partei " : " SPD Hamburg " , " jahr " : 2025 , " seiten " : 100 , " regierungsbildung " : " 2025-05-07 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-hh-2025.pdf " , " titel " : " CDU Hamburg Wahlprogramm Bürgerschaftswahl 2025 " , " partei " : " CDU Hamburg " , " jahr " : 2025 , " seiten " : 100 , " regierungsbildung " : " 2025-05-07 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-hh-2025.pdf " , " titel " : " Gute Gründe für Grün — Regierungsprogramm BÜNDNIS 90/DIE GRÜNEN Hamburg 2025 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Hamburg " , " jahr " : 2025 , " seiten " : 100 , " regierungsbildung " : " 2025-05-07 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-hh-2025.pdf " , " titel " : " DIE LINKE Hamburg Wahlprogramm Bürgerschaftswahl 2025 " , " partei " : " DIE LINKE Hamburg " , " jahr " : 2025 , " seiten " : 100 , " regierungsbildung " : " 2025-05-07 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-hh-2025.pdf " , " titel " : " AfD Hamburg Wahlprogramm Bürgerschaftswahl 2025 " , " partei " : " AfD Hamburg " , " jahr " : 2025 , " seiten " : 100 , " regierungsbildung " : " 2025-05-07 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Schleswig-Holstein — LTW 08.05.2022. Kabinett Günther II (CDU+GRÜNE) vereidigt 29.06.2022.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" SH " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" CDU " : { " file " : " cdu-sh-2022.pdf " , " titel " : " CDU Schleswig-Holstein Wahlprogramm 2022 " , " partei " : " CDU Schleswig-Holstein " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-sh-2022.pdf " , " titel " : " SPD Schleswig-Holstein Wahlprogramm 2022 " , " partei " : " SPD Schleswig-Holstein " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-sh-2022.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Schleswig-Holstein Wahlprogramm 2022 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Schleswig-Holstein " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-sh-2022.pdf " , " titel " : " FDP Schleswig-Holstein Wahlprogramm 2022 " , " partei " : " FDP Schleswig-Holstein " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
" SSW " : { " file " : " ssw-sh-2022.pdf " , " titel " : " SSW Schleswig-Holstein Wahlprogramm 2022 " , " partei " : " SSW " , " jahr " : 2022 , " seiten " : 80 , " regierungsbildung " : " 2022-06-29 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Baden-Württemberg — LTW 14.03.2021. Kabinett Kretschmann III (GRÜNE+CDU) vereidigt 12.05.2021.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" BW " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" GRÜNE " : { " file " : " gruene-bw-2021.pdf " , " titel " : " Wachsen wir über uns hinaus — Landtagswahlprogramm BÜNDNIS 90/DIE GRÜNEN Baden-Württemberg 2021 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Baden-Württemberg " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-12 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-bw-2021.pdf " , " titel " : " Neue Ideen für eine neue Zeit — Regierungsprogramm der CDU Baden-Württemberg zur Landtagswahl 2021 " , " partei " : " CDU Baden-Württemberg " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-12 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-bw-2021.pdf " , " titel " : " AfD Baden-Württemberg Landtagswahlprogramm 2021 " , " partei " : " AfD Baden-Württemberg " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-12 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-bw-2021.pdf " , " titel " : " SPD Baden-Württemberg Wahlprogramm zur Landtagswahl 2021 " , " partei " : " SPD Baden-Württemberg " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-12 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-bw-2021.pdf " , " titel " : " FDP Baden-Württemberg Landtagswahlprogramm 2021 " , " partei " : " FDP Baden-Württemberg " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-12 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
# Rheinland-Pfalz — LTW 14.03.2021. Kabinett Dreyer III (SPD+GRÜNE+FDP) vereidigt 18.05.2021;
# seit 10.07.2024 fortgeführt als Schweitzer I in derselben WP18.
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
" RP " : {
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" SPD " : { " file " : " spd-rp-2021.pdf " , " titel " : " Wir mit Ihr — Regierungsprogramm der SPD Rheinland-Pfalz 2021– 2026 " , " partei " : " SPD Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-rp-2021.pdf " , " titel " : " Regierungsprogramm der CDU RLP 2021– 26 " , " partei " : " CDU Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-rp-2021.pdf " , " titel " : " AfD Rheinland-Pfalz Wahlprogramm 2021 " , " partei " : " AfD Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-rp-2021.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Rheinland-Pfalz Landtagswahlprogramm 2021 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
" FREIE WÄHLER " : { " file " : " fw-rp-2021.pdf " , " titel " : " FREIE WÄHLER Rheinland-Pfalz Wahlprogramm 2021 " , " partei " : " FREIE WÄHLER Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 80 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-rp-2021.pdf " , " titel " : " FDP Rheinland-Pfalz Landtagswahlprogramm 2021 " , " partei " : " FDP Rheinland-Pfalz " , " jahr " : 2021 , " seiten " : 100 , " regierungsbildung " : " 2021-05-18 " , " regierungsende " : None } ,
} ,
# Bayern — LTW 08.10.2023. Kabinett Söder III (CSU+FREIE WÄHLER) vereidigt 07.11.2023.
" BY " : {
" CSU " : { " file " : " csu-by-2023.pdf " , " titel " : " CSU Bayern Bayernplan 2023 " , " partei " : " CSU Bayern " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-11-07 " , " regierungsende " : None } ,
" FREIE WÄHLER " : { " file " : " fw-by-2023.pdf " , " titel " : " FREIE WÄHLER Bayern Wahlprogramm 2023 " , " partei " : " FREIE WÄHLER Bayern " , " jahr " : 2023 , " seiten " : 80 , " regierungsbildung " : " 2023-11-07 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-by-2023.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Bayern Regierungsprogramm 2023 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Bayern " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-11-07 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-by-2023.pdf " , " titel " : " SPD Bayern Zukunftsprogramm 2023 " , " partei " : " SPD Bayern " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-11-07 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-by-2023.pdf " , " titel " : " AfD Bayern Wahlprogramm 2023 " , " partei " : " AfD Bayern " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-11-07 " , " regierungsende " : None } ,
} ,
2026-05-08 14:25:35 +02:00
# Bremen — Bürgerschaftswahl 14.05.2023. Senat Bovenschulte II (SPD+GRÜNE+LINKE) vereidigt 05.07.2023.
2026-05-08 14:18:41 +02:00
# AfD war wegen Listenstreit nicht zur Wahl zugelassen — stattdessen ist
# BIW (Bürger in Wut) als 6. Fraktion in der 21. Bürgerschaft.
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
" HB " : {
2026-05-08 14:25:35 +02:00
" SPD " : { " file " : " spd-hb-2023.pdf " , " titel " : " SPD Bremen Wahlprogramm Bürgerschaftswahl 2023 " , " partei " : " SPD Bremen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-07-05 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-hb-2023.pdf " , " titel " : " CDU Bremen Wahlprogramm Bürgerschaftswahl 2023 " , " partei " : " CDU Bremen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-07-05 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-hb-2023.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Bremen Wahlprogramm 2023 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Bremen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-07-05 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-hb-2023.pdf " , " titel " : " DIE LINKE Bremen Wahlprogramm Bürgerschaftswahl 2023 " , " partei " : " DIE LINKE Bremen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2023-07-05 " , " regierungsende " : None } ,
2026-05-08 14:28:12 +02:00
" BiW " : { " file " : " biw-hb-2023.pdf " , " titel " : " BÜRGER IN WUT — Programm für die Bürgerschaftswahl 2023 " , " partei " : " BiW Bremen " , " jahr " : 2023 , " seiten " : 26 , " regierungsbildung " : " 2023-07-05 " , " regierungsende " : None } ,
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
} ,
# Hessen — LTW 08.10.2023. Kabinett Rhein II (CDU+SPD) vereidigt 18.01.2024.
" HE " : {
" CDU " : { " file " : " cdu-he-2023.pdf " , " titel " : " CDU Hessen Regierungsprogramm 2023 " , " partei " : " CDU Hessen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2024-01-18 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-he-2023.pdf " , " titel " : " SPD Hessen Wahlprogramm 2023 " , " partei " : " SPD Hessen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2024-01-18 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-he-2023.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Hessen Wahlprogramm 2023 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Hessen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2024-01-18 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-he-2023.pdf " , " titel " : " FDP Hessen Wahlprogramm 2023 " , " partei " : " FDP Hessen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2024-01-18 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-he-2023.pdf " , " titel " : " AfD Hessen Wahlprogramm 2023 " , " partei " : " AfD Hessen " , " jahr " : 2023 , " seiten " : 100 , " regierungsbildung " : " 2024-01-18 " , " regierungsende " : None } ,
} ,
# Niedersachsen — LTW 09.10.2022. Kabinett Weil III (SPD+GRÜNE) vereidigt 08.11.2022.
" NI " : {
" SPD " : { " file " : " spd-ni-2022.pdf " , " titel " : " SPD Niedersachsen Regierungsprogramm 2022 " , " partei " : " SPD Niedersachsen " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-11-08 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-ni-2022.pdf " , " titel " : " CDU Niedersachsen Regierungsprogramm 2022 " , " partei " : " CDU Niedersachsen " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-11-08 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-ni-2022.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Niedersachsen Wahlprogramm 2022 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Niedersachsen " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-11-08 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-ni-2022.pdf " , " titel " : " AfD Niedersachsen Wahlprogramm 2022 " , " partei " : " AfD Niedersachsen " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-11-08 " , " regierungsende " : None } ,
} ,
# Saarland — LTW 27.03.2022. Kabinett Rehlinger I (SPD-Alleinregierung) vereidigt 25.04.2022.
" SL " : {
" SPD " : { " file " : " spd-sl-2022.pdf " , " titel " : " SPD Saarland Regierungsprogramm 2022 " , " partei " : " SPD Saarland " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-04-25 " , " regierungsende " : None } ,
" CDU " : { " file " : " cdu-sl-2022.pdf " , " titel " : " CDU Saarland Wahlprogramm 2022 " , " partei " : " CDU Saarland " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-04-25 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-sl-2022.pdf " , " titel " : " AfD Saarland Wahlprogramm 2022 " , " partei " : " AfD Saarland " , " jahr " : 2022 , " seiten " : 100 , " regierungsbildung " : " 2022-04-25 " , " regierungsende " : None } ,
} ,
# Sachsen — LTW 01.09.2024. Kabinett Kretschmer III (CDU+SPD, Minderheit) vereidigt 18.12.2024.
" SN " : {
" CDU " : { " file " : " cdu-sn-2024.pdf " , " titel " : " CDU Sachsen Wahlprogramm 2024 " , " partei " : " CDU Sachsen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-sn-2024.pdf " , " titel " : " SPD Sachsen Wahlprogramm 2024 " , " partei " : " SPD Sachsen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-sn-2024.pdf " , " titel " : " AfD Sachsen Wahlprogramm 2024 " , " partei " : " AfD Sachsen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
" BSW " : { " file " : " bsw-sn-2024.pdf " , " titel " : " BSW Sachsen Wahlprogramm 2024 " , " partei " : " BSW Sachsen " , " jahr " : 2024 , " seiten " : 50 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-sn-2024.pdf " , " titel " : " DIE LINKE Sachsen Wahlprogramm 2024 " , " partei " : " DIE LINKE Sachsen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-sn-2024.pdf " , " titel " : " BÜNDNIS 90/DIE GRÜNEN Sachsen Wahlprogramm 2024 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN Sachsen " , " jahr " : 2024 , " seiten " : 100 , " regierungsbildung " : " 2024-12-18 " , " regierungsende " : None } ,
} ,
# Bundestag — BTW 23.02.2025. Kabinett Merz I (CDU+CSU+SPD) vereidigt 06.05.2025.
# Aktiv die BTW-2025-Wahlprogramme aller acht im 21. Bundestag relevanten
# Parteien. Grundsatzprogramme bleiben in embeddings.PROGRAMME als
# zweite Referenz erhalten.
" BUND " : {
" CDU " : { " file " : " cdu-bund-2025.pdf " , " titel " : " Politikwechsel für Deutschland — Wahlprogramm CDU/CSU BTW 2025 " , " partei " : " CDU " , " jahr " : 2025 , " seiten " : 82 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" CSU " : { " file " : " csu-bund-2025.pdf " , " titel " : " Politikwechsel für Deutschland — Wahlprogramm CDU/CSU BTW 2025 (CSU) " , " partei " : " CSU " , " jahr " : 2025 , " seiten " : 81 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" SPD " : { " file " : " spd-bund-2025.pdf " , " titel " : " Mehr für Dich. Besser für Deutschland. — SPD Regierungsprogramm BTW 2025 " , " partei " : " SPD " , " jahr " : 2025 , " seiten " : 68 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" GRÜNE " : { " file " : " gruene-bund-2025.pdf " , " titel " : " Zusammen wachsen — Regierungsprogramm BÜNDNIS 90/DIE GRÜNEN BTW 2025 " , " partei " : " BÜNDNIS 90/DIE GRÜNEN " , " jahr " : 2025 , " seiten " : 160 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" FDP " : { " file " : " fdp-bund-2025.pdf " , " titel " : " Alles lässt sich ändern — FDP Wahlprogramm BTW 2025 " , " partei " : " FDP " , " jahr " : 2025 , " seiten " : 52 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" AfD " : { " file " : " afd-bund-2025.pdf " , " titel " : " Zeit für Deutschland — AfD Bundestagswahlprogramm 2025 " , " partei " : " AfD " , " jahr " : 2025 , " seiten " : 177 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" LINKE " : { " file " : " linke-bund-2025.pdf " , " titel " : " Alle wollen regieren. Wir wollen verändern. — DIE LINKE Wahlprogramm BTW 2025 " , " partei " : " DIE LINKE " , " jahr " : 2025 , " seiten " : 60 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
" BSW " : { " file " : " bsw-bund-2025.pdf " , " titel " : " Unser Land verdient mehr — BSW Wahlprogramm BTW 2025 " , " partei " : " BSW " , " jahr " : 2025 , " seiten " : 45 , " regierungsbildung " : " 2025-05-06 " , " regierungsende " : None } ,
Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42)
Sechs der zehn aktiven Bundesländer hatten bisher keine Wahlprogramme
indexiert (alle sechs heute neu aktiviert: BW/HH/TH in Phase 1, SH/BB/RP
in Phase 2). Antrag-Analysen für diese BL fielen damit auf föderale
Grundsatzprogramme als Fallback zurück.
Beschafft via abgeordnetenwatch.de für die jeweils laufende WP:
- TH WP8 (LTW 01.09.2024): CDU, AfD, LINKE, BSW, SPD — 5 PDFs
- BB WP8 (LTW 22.09.2024): SPD, AfD, CDU, BSW — 4 PDFs
- HH WP23 (Bürgerschaftswahl 02.03.2025): SPD, CDU, GRÜNE, LINKE, AfD — 5 PDFs
- SH WP20 (LTW 08.05.2022): CDU, SPD, GRÜNE, FDP, SSW — 5 PDFs
- BW WP17 (LTW 14.03.2021): GRÜNE, CDU, AfD, SPD, FDP — 5 PDFs
- RP WP18 (LTW 14.03.2021): SPD, CDU, AfD, GRÜNE, FREIE WÄHLER, FDP — 6 PDFs
Insgesamt 30 PDFs in app/static/referenzen/, plus 30 Einträge in
WAHLPROGRAMME[bl][partei] und embeddings.PROGRAMME.
Naming-Schema wie etabliert: <partei>-<bl>-<jahr>.pdf, also
spd-th-2024.pdf, fw-rp-2021.pdf etc.
Wichtig zu Memory feedback_legislaturprogramme: alle BL nutzen das
Programm der LAUFENDEN Wahlperiode, NICHT Programme aus späteren
Wahlen. BW und RP wählen am 08.03.2026 / 22.03.2026 neu — der
18./19. Landtag konstituiert sich erst, daher sind die 17./18. WP
mit den 2021er Programmen weiterhin laufend bis zur Konstituierung.
Indexierung im prod-Container ist NICHT Teil dieses Commits — muss
separat ausgeführt werden:
ssh vserver 'docker exec gwoe-antragspruefer python -c "
from app.embeddings import index_programm
from pathlib import Path
d = Path(\"/app/app/static/referenzen\")
for pid in [
\"cdu-th-2024\",\"afd-th-2024\",\"linke-th-2024\",\"bsw-th-2024\",\"spd-th-2024\",
\"spd-bb-2024\",\"afd-bb-2024\",\"cdu-bb-2024\",\"bsw-bb-2024\",
\"spd-hh-2025\",\"cdu-hh-2025\",\"gruene-hh-2025\",\"linke-hh-2025\",\"afd-hh-2025\",
\"cdu-sh-2022\",\"spd-sh-2022\",\"gruene-sh-2022\",\"fdp-sh-2022\",\"ssw-sh-2022\",
\"gruene-bw-2021\",\"cdu-bw-2021\",\"afd-bw-2021\",\"spd-bw-2021\",\"fdp-bw-2021\",
\"spd-rp-2021\",\"cdu-rp-2021\",\"afd-rp-2021\",\"gruene-rp-2021\",\"fw-rp-2021\",\"fdp-rp-2021\",
]:
index_programm(pid, d)
"'
77 pytest tests passing — der File-Existenz-Check in test_wahlprogramme.py
hätte einen Tippfehler im PDF-Namen sofort gefangen.
Erledigt UI-Aktivierungs-Issues #37 (TH), #39 (BB), #40 (HH), #32 (SH),
#41 (BW), #42 (RP).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:03:11 +02:00
} ,
2026-03-28 22:30:24 +01:00
}
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
# Pro Bundesland: Markdown-Übersichtsdatei mit Wahlprogramm-Zusammenfassungen,
# wird als Kontext in den LLM-Prompt geladen (nicht für die Suche).
WAHLPROGRAMM_KONTEXT_FILES : dict [ str , str ] = {
" NRW " : " wahlprogramme-nrw-2022.md " ,
}
2026-03-28 22:30:24 +01:00
REFERENZEN_PATH = Path ( __file__ ) . parent / " static " / " referenzen "
KONTEXT_PATH = Path ( __file__ ) . parent / " kontext "
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
def get_wahlprogramm ( bundesland : str , partei : str ) - > Optional [ dict ] :
""" Liefert die Wahlprogramm-Metadaten oder None, wenn keins vorliegt. """
return WAHLPROGRAMME . get ( bundesland , { } ) . get ( partei )
def parteien_mit_wahlprogramm ( bundesland : str ) - > list [ str ] :
""" Liste der Parteien, für die im gegebenen Bundesland ein Wahlprogramm vorliegt. """
return list ( WAHLPROGRAMME . get ( bundesland , { } ) . keys ( ) )
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
def regierungsbildung_for ( bundesland : str ) - > Optional [ str ] :
2026-05-08 14:25:35 +02:00
""" Datum der Regierungsbildung (Vereidigung) der Regierung, die nach der
aktuellen Wahl aus diesem Programm hervorging .
Achtung : NICHT die Vereidigung der gerade amtierenden Regierung — bei
Sukzessionen innerhalb derselben WP ( z . B . RP Dreyer III → Schweitzer I
in WP18 ) bleibt das Datum bei der ersten Regierung der WP . Die
Wahlprogramme bleiben zur Wahl wirksam , auch wenn die MP - Person später
wechselt . Für die " aktuell amtierende " Regierung siehe
` ` legislaturen . aktuelle_regierung ` ` .
"""
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
parteien = WAHLPROGRAMME . get ( bundesland , { } )
for info in parteien . values ( ) :
rb = info . get ( " regierungsbildung " )
if rb is not None :
return rb
return None
def regierungsende_for ( bundesland : str ) - > Optional [ str ] :
2026-05-08 14:25:35 +02:00
""" Datum, ab dem die aus dieser Wahl hervorgegangene Regierungsperiode
endet . ` ` None ` ` solange laufend ( auch nach Sukzession in derselben WP ) .
"""
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
parteien = WAHLPROGRAMME . get ( bundesland , { } )
for info in parteien . values ( ) :
return info . get ( " regierungsende " )
return None
def regierung_aktuell ( bundesland : str ) - > bool :
2026-05-08 14:25:35 +02:00
""" True, wenn die aus dieser Wahl hervorgegangene Regierungsperiode noch
läuft ( bildung gesetzt , ende = None ) . """
feat: regierungsbildung+regierungsende in WAHLPROGRAMME, gueltig_ab in Grundsatzprogrammen
WAHLPROGRAMME erweitert:
- Pflichtfelder regierungsbildung (Vereidigung Kabinett) + regierungsende
(None=laufend) pro Wahlprogramm. Geltung beginnt mit Regierungs-
bildung, NICHT Wahltag.
- 6 fehlende Bundeslaender ergaenzt: BY, HB, HE, NI, SL, SN.
- BUND BTW-2025: 8 Wahlprogramme (CDU, CSU, SPD, GRUENE, FDP, AfD, LINKE,
BSW) ersetzen die bisherigen Grundsatzprogramm-Eintraege. Vereidigung
Merz I 2025-05-06.
- Helper regierungsbildung_for(), regierungsende_for(), regierung_aktuell().
embeddings.PROGRAMME erweitert:
- 6 Grundsatzprogramme (CDU 2024, SPD 2007, GRUENE 2020, FDP 2012,
AfD 2016, LINKE 2011) tragen jetzt Beschluss-Datum als gueltig_ab,
gueltig_bis=None.
- 8 BTW-2025-Wahlprogramme als Indexer-Eintraege.
- FDP-Programm-Name auf den korrekten "Karlsruher Freiheitsthesen 2012"
umgestellt (vorher generisch "FDP Grundsatzprogramm 2012").
Tests: 71 grün (test_wahlprogramme + test_embeddings + test_legislaturen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 23:27:09 +02:00
parteien = WAHLPROGRAMME . get ( bundesland , { } )
if not parteien :
return False
info = next ( iter ( parteien . values ( ) ) )
return info . get ( " regierungsbildung " ) is not None and info . get ( " regierungsende " ) is None
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
def load_wahlprogramm_text ( bundesland : str , partei : str ) - > dict [ int , str ] :
2026-03-28 22:30:24 +01:00
""" Lädt Wahlprogramm-Text mit Seitenzuordnung.
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
Returns :
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
Dict mit Seitennummer - > Text . Leer , wenn kein Wahlprogramm hinterlegt
oder die paged - Textdatei fehlt .
2026-03-28 22:30:24 +01:00
"""
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
info = get_wahlprogramm ( bundesland , partei )
if not info :
2026-03-28 22:30:24 +01:00
return { }
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
# Versuche paged-Textdatei zu laden
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
paged_file = KONTEXT_PATH / info [ ' file ' ] . replace ( ' .pdf ' , ' -paged.txt ' )
2026-03-28 22:30:24 +01:00
if not paged_file . exists ( ) :
# Fallback: Normale Textdatei
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
txt_file = KONTEXT_PATH / info [ ' file ' ] . replace ( ' .pdf ' , ' .txt ' )
2026-03-28 22:30:24 +01:00
if txt_file . exists ( ) :
return { 1 : txt_file . read_text ( ) }
return { }
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
text = paged_file . read_text ( )
pages = { }
current_page = 1
current_text = [ ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
for line in text . split ( ' \n ' ) :
if line . startswith ( ' --- PAGE ' ) :
if current_text :
pages [ current_page ] = ' \n ' . join ( current_text )
match = re . search ( r ' PAGE ( \ d+) ' , line )
if match :
current_page = int ( match . group ( 1 ) )
current_text = [ ]
else :
current_text . append ( line )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
if current_text :
pages [ current_page ] = ' \n ' . join ( current_text )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
return pages
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
def search_wahlprogramm (
bundesland : str ,
partei : str ,
keywords : list [ str ] ,
max_results : int = 3 ,
) - > list [ dict ] :
2026-03-28 22:30:24 +01:00
""" Sucht relevante Passagen in einem Wahlprogramm.
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
Args :
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
bundesland : Bundesland - Code ( NRW , LSA , … )
partei : Partei - Kürzel ( CDU , SPD , GRÜNE , FDP , AfD , … )
2026-03-28 22:30:24 +01:00
keywords : Suchbegriffe
max_results : Maximale Anzahl Ergebnisse
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
Returns :
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
Liste von { bundesland , partei , seite , text , score , url , quelle }
2026-03-28 22:30:24 +01:00
"""
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
info = get_wahlprogramm ( bundesland , partei )
if not info :
return [ ]
pages = load_wahlprogramm_text ( bundesland , partei )
2026-03-28 22:30:24 +01:00
if not pages :
return [ ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
results = [ ]
keywords_lower = [ k . lower ( ) for k in keywords ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
for page_num , text in pages . items ( ) :
text_lower = text . lower ( )
score = sum ( 1 for kw in keywords_lower if kw in text_lower )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
if score > 0 :
paragraphs = text . split ( ' \n \n ' )
relevant_paragraphs = [ ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
for para in paragraphs :
para_clean = para . strip ( )
if len ( para_clean ) < 50 :
continue
para_lower = para_clean . lower ( )
if any ( kw in para_lower for kw in keywords_lower ) :
relevant_paragraphs . append ( para_clean )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
if relevant_paragraphs :
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
best_para = max (
relevant_paragraphs ,
key = lambda p : sum ( 1 for kw in keywords_lower if kw in p . lower ( ) ) ,
)
2026-03-28 22:30:24 +01:00
if len ( best_para ) > 300 :
best_para = best_para [ : 297 ] + " ... "
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
results . append ( {
" partei " : partei ,
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
" bundesland " : bundesland ,
2026-03-28 22:30:24 +01:00
" seite " : page_num ,
" text " : best_para ,
" score " : score ,
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
" url " : f " /static/referenzen/ { info [ ' file ' ] } #page= { page_num } " ,
" quelle " : f " { info [ ' partei ' ] } Wahlprogramm { info [ ' jahr ' ] } , S. { page_num } " ,
2026-03-28 22:30:24 +01:00
} )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
results . sort ( key = lambda x : x [ ' score ' ] , reverse = True )
return results [ : max_results ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
def find_relevant_quotes (
antrag_text : str ,
fraktionen : list [ str ] ,
bundesland : str ,
) - > dict [ str , list [ dict ] ] :
2026-03-28 22:30:24 +01:00
""" Findet relevante Zitate aus Wahlprogrammen für einen Antrag.
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
Args :
antrag_text : Volltext des Antrags
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
fraktionen : Liste der einreichenden Fraktionen
bundesland : Bundesland - Code ( Pflichtparameter ; bestimmt , welche
Wahlprogramme durchsucht werden und welche Regierungsfraktionen
zusätzlich einbezogen werden ) .
2026-03-28 22:30:24 +01:00
Returns :
Dict mit Partei - > Liste von Zitaten
"""
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
if bundesland not in BUNDESLAENDER :
raise ValueError ( f " Unbekanntes Bundesland: { bundesland } " )
2026-03-28 22:30:24 +01:00
# Extrahiere Keywords aus Antrag (einfache Heuristik)
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
stopwords = {
' der ' , ' die ' , ' das ' , ' und ' , ' oder ' , ' für ' , ' mit ' , ' von ' , ' zu ' , ' auf ' ,
' ist ' , ' sind ' , ' wird ' , ' werden ' , ' hat ' , ' haben ' , ' ein ' , ' eine ' , ' einer ' ,
' den ' , ' dem ' , ' des ' , ' im ' , ' in ' , ' an ' , ' bei ' , ' nach ' , ' über ' , ' unter ' ,
' durch ' , ' als ' , ' auch ' , ' nur ' , ' noch ' , ' aber ' , ' wenn ' , ' dass ' , ' sich ' ,
' nicht ' , ' wie ' , ' so ' , ' aus ' , ' zum ' , ' zur ' , ' vom ' , ' beim ' , ' seit ' , ' bis ' ,
}
2026-03-28 22:30:24 +01:00
words = re . findall ( r ' \ b[A-Za-zäöüÄÖÜß] { 4,} \ b ' , antrag_text )
keywords = [ w for w in words if w . lower ( ) not in stopwords ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
word_freq : dict [ str , int ] = { }
2026-03-28 22:30:24 +01:00
for w in keywords :
w_lower = w . lower ( )
word_freq [ w_lower ] = word_freq . get ( w_lower , 0 ) + 1
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
top_keywords = sorted ( word_freq . keys ( ) , key = lambda x : word_freq [ x ] , reverse = True ) [ : 15 ]
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
# Antragsteller + Regierungsfraktionen des Bundeslands
regierungsfraktionen = BUNDESLAENDER [ bundesland ] . regierungsfraktionen
parteien_to_search = set ( fraktionen ) | set ( regierungsfraktionen )
quotes : dict [ str , list [ dict ] ] = { }
2026-03-28 22:30:24 +01:00
for partei in parteien_to_search :
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
if get_wahlprogramm ( bundesland , partei ) :
found = search_wahlprogramm ( bundesland , partei , top_keywords , max_results = 2 )
2026-03-28 22:30:24 +01:00
if found :
quotes [ partei ] = found
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
return quotes
def format_quote_for_prompt ( quotes : dict [ str , list [ dict ] ] ) - > str :
""" Formatiert Zitate für den LLM-Prompt. """
if not quotes :
return " "
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
lines = [ " \n ## Relevante Passagen aus Wahlprogrammen \n " ]
lines . append ( " Nutze diese Originalzitate als Belege in deiner Bewertung: \n " )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
for partei , zitate in quotes . items ( ) :
for z in zitate :
lines . append ( f " ### { z [ ' quelle ' ] } " )
lines . append ( f ' > " { z [ " text " ] } " ' )
lines . append ( " " )
Refactor wahlprogramme/embeddings/analyzer for multi-state (#5)
Atomic refactor of the three modules that previously hardcoded NRW
behaviour. After this commit, every analysis path consults the central
BUNDESLAENDER registry for governing fractions, parliament name, and
state metadata.
wahlprogramme.py
- WAHLPROGRAMME is now nested {bundesland: {partei: meta}}; NRW data
hoisted unchanged under the "NRW" key.
- New WAHLPROGRAMM_KONTEXT_FILES dict maps a state to its overview
markdown file (currently only NRW).
- find_relevant_quotes(text, fraktionen, bundesland) — bundesland is
now a required positional. Governing fractions for the requested
state are merged with the submitting fractions before lookup.
- Helpers get_wahlprogramm() and parteien_mit_wahlprogramm() expose
the new shape to other modules.
- ValueError on unknown bundesland (no silent fallback).
embeddings.py
- Schema migration in init_embeddings_db: adds a `bundesland` column
to the chunks table when missing, plus an index, and backfills
existing rows from the PROGRAMME registry. Grundsatzprogramme
(federal level) keep bundesland NULL by design.
- find_relevant_chunks accepts a bundesland filter that matches state
rows OR NULL — so federal Grundsatzprogramme remain visible to every
analysis.
- get_relevant_quotes_for_antrag(text, fraktionen, bundesland, …) —
bundesland required, governing fractions read from BUNDESLAENDER
instead of hardcoded ["CDU","GRÜNE"]. Order-preserving dedup
replaces the previous set-based merge.
- index_programm now writes the bundesland column on insert.
- Dropped the hardcoded "Wahlprogramm NRW 2022" label in
format_quotes_for_prompt — bundesland context is implicit in the
surrounding prompt block.
analyzer.py
- get_bundesland_context reads parlament_name, regierungsfraktionen,
landtagsfraktionen and the optional WAHLPROGRAMM_KONTEXT_FILES entry
from the central registry. Throws ValueError on unknown OR inactive
bundesland — kills the silent NRW fallback that previously masked
configuration gaps.
- The Antragsteller-detection heuristic now iterates
BUNDESLAENDER[bundesland].landtagsfraktionen instead of
WAHLPROGRAMME.keys(), so we recognise parties for which we don't
yet have a Wahlprogramm PDF.
- Both quote lookups (semantic + keyword fallback) now receive the
bundesland.
Resolves issue #5. Foundation for #2 (LSA), #3 (Berlin), #4 (MV).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 18:48:11 +02:00
2026-03-28 22:30:24 +01:00
return " \n " . join ( lines )