Geoparsing von spaCy auf Haiku umgestellt
- geoparsing.py: Komplett-Rewrite (spaCy NER + Nominatim -> Haiku + geonamescache) - orchestrator.py: incident_context an geoparse_articles, category in INSERT - incidents.py: incident_context aus DB laden und an Geoparsing uebergeben - public_api.py: Locations aggregiert im Lagebild-Endpoint - components.js: response-Kategorie neben retaliation (beide akzeptiert) - requirements.txt: spaCy und geopy entfernt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -108,6 +108,23 @@ async def get_lagebild(db=Depends(db_dependency)):
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
sources_json = []
|
||||
|
||||
# Locations aggregiert nach normalisierten Ortsnamen
|
||||
cursor = await db.execute(
|
||||
f"""SELECT
|
||||
al.location_name_normalized as name,
|
||||
al.latitude as lat,
|
||||
al.longitude as lon,
|
||||
al.country_code,
|
||||
al.category,
|
||||
COUNT(*) as article_count,
|
||||
MAX(al.confidence) as confidence
|
||||
FROM article_locations al
|
||||
WHERE al.incident_id IN ({ids})
|
||||
GROUP BY al.location_name_normalized
|
||||
ORDER BY article_count DESC"""
|
||||
)
|
||||
locations = [dict(r) for r in await cursor.fetchall()]
|
||||
|
||||
return {
|
||||
"generated_at": datetime.now(TIMEZONE).isoformat(),
|
||||
"incident": {
|
||||
@@ -130,6 +147,7 @@ async def get_lagebild(db=Depends(db_dependency)):
|
||||
"articles": articles,
|
||||
"fact_checks": fact_checks,
|
||||
"available_snapshots": available_snapshots,
|
||||
"locations": locations,
|
||||
}
|
||||
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren