# GWÖ-Antragsprüfer **Automatische Gemeinwohl-Bilanzierung von Parlamentsanträgen nach der GWÖ-Matrix 2.0 für Gemeinden** ![Python](https://img.shields.io/badge/Python-3.12-blue) ![FastAPI](https://img.shields.io/badge/FastAPI-0.109-green) ![License](https://img.shields.io/badge/License-MIT-yellow) ## 🎯 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 ```bash # 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 ```bash # Tests ausführen pytest # Linting ruff check app/ # Type-Checking mypy app/ ``` ## 📝 Lizenz MIT License - siehe [LICENSE](LICENSE) ## 🙏 Credits - [Gemeinwohl-Ökonomie](https://econgood.org) - Matrix und Arbeitsbücher - [Alibaba DashScope](https://dashscope.aliyuncs.com) - Qwen LLM API - [Landtag NRW](https://www.landtag.nrw.de) - OPAL-Dokumentation --- **Entwickelt von Tobias Rödel** · [tobiasroedel.de](https://tobiasroedel.de)