Vollständige Pipeline zur Analyse kommunaler Vorlagen aus ALLRIS: - OParl-Import: 20.149 Vorlagen - PDF-Extraktion: 10.045 Volltexte (adaptives Throttling) - KI-Zusammenfassungen: 10.026 via Qwen Plus (parallelisiert) - Beratungsfolge-Scraper: Beschlusstexte + Wortprotokolle - Abstimmungs-Analyse mit Koalitionsmatrix - Georeferenzierung (Nominatim) Stack: FastAPI + SvelteKit + SQLite Deployment: Docker + Traefik auf VServer Daten (DB, Logs) nicht im Repo — siehe Restic-Backup. Repo-Setup: scripts/setup.sh für Neuaufbau aus OParl-API.
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""FastAPI application for Antragstracker Hagen."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
from tracker.api.routes import abstimmungen, ketten, orte, stats, vorlagen
|
|
|
|
app = FastAPI(
|
|
title="Antragstracker Hagen",
|
|
description="API zur Nachverfolgung kommunaler Anträge und Anfragen",
|
|
version="0.1.0",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_methods=["GET"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(vorlagen.router, prefix="/api")
|
|
app.include_router(ketten.router, prefix="/api")
|
|
app.include_router(stats.router, prefix="/api")
|
|
app.include_router(abstimmungen.router, prefix="/api")
|
|
app.include_router(orte.router, prefix="/api")
|
|
|
|
|
|
@app.get("/api/health")
|
|
def health():
|
|
return {"status": "ok"}
|
|
|
|
|
|
# Serve static frontend files in production
|
|
# Try multiple paths (Docker vs local dev)
|
|
for static_path in ["/app/static", Path(__file__).parent.parent.parent.parent / "static"]:
|
|
static_dir = Path(static_path)
|
|
if static_dir.exists() and (static_dir / "index.html").exists():
|
|
app.mount("/", StaticFiles(directory=str(static_dir), html=True), name="static")
|
|
break
|