scripts/edges_full_check.py aktualisiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
This commit is contained in:
parent
e4115e705e
commit
12c600edbe
|
|
@ -1,10 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from app.core.qdrant import QdrantConfig, get_client
|
from app.core.qdrant import QdrantConfig, get_client
|
||||||
|
|
||||||
|
|
||||||
def fetch_all(client, col):
|
def fetch_all(client, col):
|
||||||
points = []
|
points = []
|
||||||
next_offset = None
|
next_offset = None
|
||||||
|
|
@ -17,6 +19,14 @@ def fetch_all(client, col):
|
||||||
break
|
break
|
||||||
return points
|
return points
|
||||||
|
|
||||||
|
|
||||||
|
def is_callout_rule(rule_id: str) -> bool:
|
||||||
|
if not rule_id:
|
||||||
|
return False
|
||||||
|
r = rule_id.lower()
|
||||||
|
return r.startswith("callout:edge:v1") or ("callout" in r)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg = QdrantConfig.from_env()
|
cfg = QdrantConfig.from_env()
|
||||||
cl = get_client(cfg)
|
cl = get_client(cfg)
|
||||||
|
|
@ -35,7 +45,6 @@ def main():
|
||||||
chunks_by_note = Counter([c.payload.get("note_id") for c in chunks])
|
chunks_by_note = Counter([c.payload.get("note_id") for c in chunks])
|
||||||
e_by_kind = Counter([e.payload.get("kind") or e.payload.get("relation") for e in edges])
|
e_by_kind = Counter([e.payload.get("kind") or e.payload.get("relation") for e in edges])
|
||||||
|
|
||||||
# pro Note: belongs_to == #chunks; next == prev == max(chunks-1, 0)
|
|
||||||
belongs_by_note = Counter()
|
belongs_by_note = Counter()
|
||||||
next_by_note = Counter()
|
next_by_note = Counter()
|
||||||
prev_by_note = Counter()
|
prev_by_note = Counter()
|
||||||
|
|
@ -57,14 +66,10 @@ def main():
|
||||||
b = belongs_by_note[nid]
|
b = belongs_by_note[nid]
|
||||||
n = next_by_note[nid]
|
n = next_by_note[nid]
|
||||||
p = prev_by_note[nid]
|
p = prev_by_note[nid]
|
||||||
per_note[nid] = {"chunks": ccount, "belongs_to": b, "next": n, "prev": p, "checks": {
|
per_note[nid] = {"chunks": ccount, "belongs_to": b, "next": n, "prev": p, "checks": {"belongs_to_equals_chunks": (b == ccount), "next_prev_match": (n == p == max(ccount-1, 0))}}
|
||||||
"belongs_to_equals_chunks": (b == ccount),
|
|
||||||
"next_prev_match": (n == p == max(ccount-1, 0)),
|
|
||||||
}}
|
|
||||||
ok_belongs &= (b == ccount)
|
ok_belongs &= (b == ccount)
|
||||||
ok_nextprev &= (n == p == max(ccount-1, 0))
|
ok_nextprev &= (n == p == max(ccount-1, 0))
|
||||||
|
|
||||||
# Rule-Statistiken & Dubletten-Prüfung
|
|
||||||
explicit = defaults = callout = inline = 0
|
explicit = defaults = callout = inline = 0
|
||||||
multi_callout_detected = False
|
multi_callout_detected = False
|
||||||
callout_key_counts = Counter()
|
callout_key_counts = Counter()
|
||||||
|
|
@ -83,7 +88,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
seen.add(key)
|
seen.add(key)
|
||||||
|
|
||||||
if rule.startswith("callout:edge:v1"):
|
if is_callout_rule(rule):
|
||||||
callout += 1
|
callout += 1
|
||||||
callout_key_counts[(cid, kind, rule)] += 1
|
callout_key_counts[(cid, kind, rule)] += 1
|
||||||
if rule.startswith("inline:rel:v1"):
|
if rule.startswith("inline:rel:v1"):
|
||||||
|
|
@ -116,5 +121,6 @@ def main():
|
||||||
}
|
}
|
||||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user