feat: Netzwerkanalyse-Feature (Wissensgraph)
Neues Feature zur Visualisierung von Entitäten und Beziehungen aus ausgewählten Lagen als interaktiver d3.js-Netzwerkgraph. - Haiku extrahiert Entitäten (Person, Organisation, Ort, Ereignis, Militär) - Opus analysiert Beziehungen und korrigiert Haiku-Fehler - 6 neue DB-Tabellen (network_analyses, _entities, _relations, etc.) - REST-API: CRUD + Generierung + Export (JSON/CSV) - d3.js Force-Directed Graph mit Zoom, Filter, Suche, Export - WebSocket-Events für Live-Progress während Generierung - Sidebar-Integration mit Netzwerkanalysen-Sektion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
59
src/models_network.py
Normale Datei
59
src/models_network.py
Normale Datei
@@ -0,0 +1,59 @@
|
||||
"""Pydantic Models für Netzwerkanalyse Request/Response Schemas."""
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class NetworkAnalysisCreate(BaseModel):
|
||||
name: str = Field(min_length=1, max_length=200)
|
||||
incident_ids: list[int] = Field(min_length=1)
|
||||
|
||||
|
||||
class NetworkAnalysisUpdate(BaseModel):
|
||||
name: Optional[str] = Field(default=None, max_length=200)
|
||||
incident_ids: Optional[list[int]] = None
|
||||
|
||||
|
||||
class NetworkEntityResponse(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
name_normalized: str
|
||||
entity_type: str
|
||||
description: str = ""
|
||||
aliases: list[str] = []
|
||||
mention_count: int = 0
|
||||
corrected_by_opus: bool = False
|
||||
metadata: dict = {}
|
||||
|
||||
|
||||
class NetworkRelationResponse(BaseModel):
|
||||
id: int
|
||||
source_entity_id: int
|
||||
target_entity_id: int
|
||||
category: str
|
||||
label: str
|
||||
description: str = ""
|
||||
weight: int = 1
|
||||
status: str = ""
|
||||
evidence: list[str] = []
|
||||
|
||||
|
||||
class NetworkAnalysisResponse(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
status: str
|
||||
entity_count: int = 0
|
||||
relation_count: int = 0
|
||||
has_update: bool = False
|
||||
incident_ids: list[int] = []
|
||||
incident_titles: list[str] = []
|
||||
data_hash: Optional[str] = None
|
||||
last_generated_at: Optional[str] = None
|
||||
created_by: int = 0
|
||||
created_by_username: str = ""
|
||||
created_at: str = ""
|
||||
|
||||
|
||||
class NetworkGraphResponse(BaseModel):
|
||||
analysis: NetworkAnalysisResponse
|
||||
entities: list[NetworkEntityResponse] = []
|
||||
relations: list[NetworkRelationResponse] = []
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren