Update qdrant_points.py, ingestion_processor.py, and import_markdown.py to version 4.1.0: Enhance edge ID generation by incorporating target_section for improved multigraph support and symmetry integrity. Update documentation and logging for clarity, ensuring consistent ID generation across phases and compatibility with the ingestion workflow.

This commit is contained in:
Lars committed 2026-01-10 17:03:44 +01:00
1 parent 2da98e8e37
commit be2bed9927
3 files changed
+78 -24

No files matched your search

+11 -7
View File
@@ -2,7 +2,7 @@
FILE: app/core/database/qdrant_points.py
DESCRIPTION: Object-Mapper für Qdrant. Konvertiert JSON-Payloads (Notes, Chunks, Edges)
in PointStructs und generiert deterministische UUIDs.
VERSION: 4.0.0 (WP-24c: Gold-Standard Identity - 4-Parameter-ID)
VERSION: 4.1.0 (WP-24c: Gold-Standard Identity v4.1.0 - target_section Support)
STATUS: Active
DEPENDENCIES: qdrant_client, uuid, os, app.core.graph.graph_utils
LAST_ANALYSIS: 2026-01-10
@@ -95,11 +95,12 @@ def _normalize_edge_payload(pl: dict) -> dict:
def points_for_edges(prefix: str, edge_payloads: List[dict]) -> Tuple[str, List[rest.PointStruct]]:
"""
Konvertiert Kanten-Payloads in PointStructs.
WP-24c v4.0.0: Nutzt die zentrale _mk_edge_id Funktion aus graph_utils.
WP-24c v4.1.0: Nutzt die zentrale _mk_edge_id Funktion aus graph_utils.
Dies eliminiert den ID-Drift zwischen manuellen und virtuellen Kanten.
GOLD-STANDARD v4.0.0: Die ID-Generierung verwendet STRICT nur die 4 Parameter
(kind, source_id, target_id, scope). rule_id und variant werden ignoriert.
GOLD-STANDARD v4.1.0: Die ID-Generierung verwendet 4 Parameter + optional target_section
(kind, source_id, target_id, scope, target_section).
rule_id und variant werden ignoriert, target_section fließt ein (Multigraph-Support).
"""
_, _, edges_col = _names(prefix)
points: List[rest.PointStruct] = []
@@ -107,23 +108,26 @@ def points_for_edges(prefix: str, edge_payloads: List[dict]) -> Tuple[str, List[
for raw in edge_payloads:
pl = _normalize_edge_payload(raw)
# Extraktion der Identitäts-Parameter (GOLD-STANDARD v4.0.0: nur 4 Parameter)
# Extraktion der Identitäts-Parameter (GOLD-STANDARD v4.1.0)
kind = pl.get("kind", "edge")
s = pl.get("source_id", "unknown-src")
t = pl.get("target_id", "unknown-tgt")
scope = pl.get("scope", "note")
target_section = pl.get("target_section") # WP-24c v4.1.0: target_section für Section-Links
# Hinweis: rule_id und variant werden im Payload gespeichert,
# fließen aber NICHT in die ID-Generierung ein (v4.0.0 Standard)
# target_section fließt in die ID ein (v4.1.0: Multigraph-Support für Section-Links)
try:
# Aufruf der Single-Source-of-Truth für IDs
# GOLD-STANDARD v4.0.0: Nur 4 Parameter werden verwendet
# GOLD-STANDARD v4.1.0: 4 Parameter + optional target_section
point_id = _mk_edge_id(
kind=kind,
s=s,
t=t,
scope=scope
scope=scope,
target_section=target_section
)
# Synchronisierung des Payloads mit der berechneten ID