GWÖ-Antragsprüfer: Automatische Gemeinwohl-Bilanzierung von Parlamentsanträgen nach der GWÖ-Matrix 2.0
Go to file
Dotty Dotter 278d74ff97 Phase I: HB PARiSHBAdapter (#21/#33) — Bremen aktiv
Schließt #21 (HB-Scraper) und #33 (UI-Aktivierung). Eigenständige
``PARiSHBAdapter``-Klasse für paris.bremische-buergerschaft.de.

Backend (HAR-Trace TEMP/paris.bremische-buergerschaft.de.har):

- Single-POST gegen ``/starweb/paris/servlet.starweb`` mit
  form-urlencoded Body
- ``path=paris/LISSHFL.web``, ``format=LISSH_BrowseVorgang_Report``
- ``01_LISSHFL_Themen=<query>`` (Volltext-Thesaurus)
- ``02_LISSHFL_PARL=S OR L`` (Stadt + Landtag in einem Rutsch)
- ``03_LISSHFL_WP=21`` (aktuelle Wahlperiode; Multi-WP-Range
  timeout-t den Server bei 60s)
- Wildcards (``*``) timeout-en ebenfalls — bei leerer Query verwenden
  wir das hochfrequente Stoppwort ``"der"`` als Catch-all

Hit-Format aus dem Single-Page-HTML:

- ``<tbody name="RecordRepeater"><tr name="Repeat_TYP">``
- Title in ``<h2><a>``
- ``Drs <b>21/730 S</b>`` mit S/L-Suffix für Stadtbürgerschaft vs
  Landtag — Drucksachen-IDs werden als ``21/730S`` (ohne Space)
  gespeichert
- ``Änderungsantrag vom 23.02.2026`` (Typ + Datum)
- Fraktionen-Liste nach ``<br/>``
- PDF-Link mit ``target="new"`` auf bremische-buergerschaft.de

Pipeline:

- ``search()`` mit client-side ``"antrag"``-Filter (analog #61),
  fängt ``"Antrag"``, ``"Änderungsantrag"`` etc.
- ``get_document()`` linearer Lookup
- ``download_text()`` PDF-via-fitz

BL-Eintrag in ``bundeslaender.py``:

- ``HB.aktiv = True``
- ``doku_system="PARiS"`` (statt der alten Klassifikation "StarWeb" —
  PARiS ist eine deutlich abweichende Servlet-Variante, kein eUI)
- ``drucksache_format="21/1234S"``
- Test ``test_hb_is_starweb_not_paris`` umbenannt in
  ``test_hb_is_paris_starweb_variant``, prüft jetzt auf "PARiS"

Live-Probe:

```
21/730S  2026-02-23 | [SPD,GRÜNE,LINKE] | Änderungsantrag | Haushaltsgesetze ...
21/1449  2025-11-05 | [SPD,GRÜNE,LINKE] | Antrag         | Finanzierung der Bremischen Häfen
21/555S  2025-06-17 | [CDU]              | Antrag         | Clima-Campus zügig beantworten
```

176 Unit-Tests grün, Live-Verifikation Sub-A im Container nach Deploy.

Refs: #21, #33, #59 (Phase I)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 14:21:49 +02:00
app Phase I: HB PARiSHBAdapter (#21/#33) — Bremen aktiv 2026-04-09 14:21:49 +02:00
tests Phase I: HB PARiSHBAdapter (#21/#33) — Bremen aktiv 2026-04-09 14:21:49 +02:00
.dockerignore Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
.env.example Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
.gitignore Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
.tarignore Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
docker-compose.yml Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
Dockerfile Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
LICENSE Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
pytest.ini Add E2E functional acceptance test suite (#50, #51, #52, #53, #54) 2026-04-09 10:00:20 +02:00
README.md Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
requirements-dev.txt Add pytest suite + fix two regex bugs uncovered by it (#46) 2026-04-08 23:26:06 +02:00
requirements.txt Security hotfixes #1, #2, #6 from audit (#57) 2026-04-09 10:45:43 +02:00

GWÖ-Antragsprüfer

Automatische Gemeinwohl-Bilanzierung von Parlamentsanträgen nach der GWÖ-Matrix 2.0 für Gemeinden

Python FastAPI License

🎯 Was ist das?

Der GWÖ-Antragsprüfer analysiert Anträge aus Landesparlamenten (aktuell NRW) und bewertet sie nach den Kriterien der Gemeinwohl-Ökonomie (GWÖ):

  • GWÖ-Score (0-10): Wie gut entspricht der Antrag den GWÖ-Werten?
  • Matrix-Zuordnung: Welche Felder der GWÖ-Matrix werden adressiert?
  • Programmtreue: Passt der Antrag zu Wahl- und Parteiprogrammen?
  • Verbesserungsvorschläge: Konkrete Textänderungen mit GWÖ-Begründung

Features

  • 🔍 Landtag-Suche: Direkte Anbindung an OPAL (NRW Parlamentsdokumentation)
  • 📊 GWÖ-Matrix-Visualisierung: 5×5-Tabelle mit Bewertungssymbolen
  • 🏷️ Tag-Wolke: Filter nach Themen mit Multi-Select
  • 🎯 Partei-Filter: Durchschnittswerte pro Fraktion
  • 📄 PDF-Export: Professionelle Berichte im GWÖ-Design
  • 🔒 Security: CSP, CORS, Rate Limiting

🚀 Schnellstart

Voraussetzungen

  • Python 3.12+
  • Docker & Docker Compose
  • DashScope API-Key (Qwen LLM)

Installation

# Repository klonen
git clone https://github.com/tobiasroedel/gwoe-antragspruefer.git
cd gwoe-antragspruefer

# Environment-Variablen
cp .env.example .env
# DASHSCOPE_API_KEY eintragen

# Mit Docker starten
docker compose up -d

# Oder lokal entwickeln
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload

Die App läuft auf http://localhost:8000

📁 Projektstruktur

webapp/
├── app/
│   ├── main.py           # FastAPI-Endpoints
│   ├── analyzer.py       # LLM-Analyse-Logik
│   ├── database.py       # SQLite-Persistenz
│   ├── models.py         # Pydantic-Modelle
│   ├── parlamente.py     # Landtag-Adapter (OPAL)
│   ├── report.py         # PDF-Generierung
│   ├── config.py         # Settings
│   ├── kontext/          # GWÖ-Matrix, Wahlprogramme
│   ├── templates/        # Jinja2-HTML
│   └── static/           # CSS, JS, Assets
├── data/                 # SQLite-DBs (Volume)
├── reports/              # Generierte PDFs (Volume)
├── docker-compose.yml
├── Dockerfile
└── requirements.txt

🔧 Konfiguration

Environment-Variablen

Variable Beschreibung Default
DASHSCOPE_API_KEY Alibaba DashScope API-Key (required)
LLM_MODEL_DEFAULT Standard-Modell qwen-plus-latest
LLM_MODEL_PREMIUM Premium-Modell qwen-max

Unterstützte Bundesländer

Code Name Status
NRW Nordrhein-Westfalen Aktiv
BY Bayern 🔜 Geplant
BW Baden-Württemberg 🔜 Geplant

📊 API-Endpoints

Methode Pfad Beschreibung
GET / Web-UI
GET /api/assessments Alle Bewertungen
GET /api/assessment?drucksache=18/12345 Einzelne Bewertung
POST /api/analyze-drucksache Neue Analyse starten
GET /api/search?q=Klima Interne Suche
GET /api/search-landtag?q=Klima Landtag-Suche
GET /api/assessment/pdf?drucksache=18/12345 PDF-Download

🧠 GWÖ-Prompt (v5)

Der Analyse-Prompt basiert auf:

  • GWÖ-Matrix 2.0 für Gemeinden (Arbeitsbuch)
  • ECOnGOOD Corporate Design Manual 2024
  • Wahlprogramme der NRW-Landtagsparteien 2022

Ausgabe-Format:

  • GWÖ-Score mit Matrix-Feldern und Symbolen (++/+/○//)
  • Wahlprogramm- und Parteiprogrammtreue
  • Verbesserungsvorschläge im Redline-Format (Original → Vorschlag → Begründung)
  • Themen-Tags für Kategorisierung

🛠️ Entwicklung

# Tests ausführen
pytest

# Linting
ruff check app/

# Type-Checking
mypy app/

📝 Lizenz

MIT License - siehe LICENSE

🙏 Credits


Entwickelt von Tobias Rödel · tobiasroedel.de