fix: identity names now show in all trace tooltips (online + offline)
- Online: remove IDENTITY filter gating on identity_note — always show - Offline: fix id_names scope bug — was overwritten by top10-only dict - Both reports now show 'identity: PERSON_xxx' for all 2000 timeline traces - All 5483 traces have identity mapping (verified in SQLite)
This commit is contained in:
@@ -84,15 +84,15 @@ if IDENTITY is None:
|
|||||||
GROUP BY fd.identity_id, i.name ORDER BY faces DESC LIMIT 10
|
GROUP BY fd.identity_id, i.name ORDER BY faces DESC LIMIT 10
|
||||||
""", (UUID,))
|
""", (UUID,))
|
||||||
top_identities = cur.fetchall()
|
top_identities = cur.fetchall()
|
||||||
else:
|
|
||||||
# Get trace→identity mapping for tooltip enrichment
|
# Always get trace→identity mapping for tooltip enrichment
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
SELECT DISTINCT fd.trace_id, i.name
|
SELECT DISTINCT fd.trace_id, i.name
|
||||||
FROM dev.face_detections fd
|
FROM dev.face_detections fd
|
||||||
LEFT JOIN dev.identities i ON i.id = fd.identity_id
|
LEFT JOIN dev.identities i ON i.id = fd.identity_id
|
||||||
WHERE fd.file_uuid=%s AND fd.identity_id IS NOT NULL
|
WHERE fd.file_uuid=%s AND fd.identity_id IS NOT NULL
|
||||||
""", (UUID,))
|
""", (UUID,))
|
||||||
trace_to_identity = {r[0]: r[1] for r in cur.fetchall()}
|
trace_to_identity = {r[0]: r[1] for r in cur.fetchall()}
|
||||||
|
|
||||||
cur.close(); conn.close()
|
cur.close(); conn.close()
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ def build_html():
|
|||||||
top = i * (bar_h + 1) + 5
|
top = i * (bar_h + 1) + 5
|
||||||
opacity = 1.0 if cnt > 5 else 0.3
|
opacity = 1.0 if cnt > 5 else 0.3
|
||||||
identity_note = ""
|
identity_note = ""
|
||||||
if IDENTITY is not None and tid in trace_to_identity:
|
if tid in trace_to_identity:
|
||||||
identity_note = f", identity: {trace_to_identity[tid]}"
|
identity_note = f", identity: {trace_to_identity[tid]}"
|
||||||
title = f"T{tid}: {t0:.0f}s–{t1:.0f}s, {cnt} faces, f{fn0}–f{fn1}{identity_note}"
|
title = f"T{tid}: {t0:.0f}s–{t1:.0f}s, {cnt} faces, f{fn0}–f{fn1}{identity_note}"
|
||||||
h.append(f'<span class="bar" style="left:{left}px;top:{top}px;width:{width}px;height:{bar_h}px;opacity:{opacity}" title="{title}"></span>')
|
h.append(f'<span class="bar" style="left:{left}px;top:{top}px;width:{width}px;height:{bar_h}px;opacity:{opacity}" title="{title}"></span>')
|
||||||
|
|||||||
@@ -98,13 +98,6 @@ if IDENTITY is not None:
|
|||||||
else:
|
else:
|
||||||
c.execute("SELECT identity_id, COUNT(*) as fc, COUNT(DISTINCT trace_id) as tc FROM face_detections WHERE identity_id IS NOT NULL GROUP BY identity_id ORDER BY fc DESC LIMIT 10")
|
c.execute("SELECT identity_id, COUNT(*) as fc, COUNT(DISTINCT trace_id) as tc FROM face_detections WHERE identity_id IS NOT NULL GROUP BY identity_id ORDER BY fc DESC LIMIT 10")
|
||||||
top_identities = c.fetchall()
|
top_identities = c.fetchall()
|
||||||
# Get identity names
|
|
||||||
id_names = {}
|
|
||||||
if top_identities:
|
|
||||||
ids = [r[0] for r in top_identities]
|
|
||||||
placeholders = ",".join(["?" for _ in ids])
|
|
||||||
c.execute(f"SELECT id, name FROM identities WHERE id IN ({placeholders})", ids)
|
|
||||||
id_names = {r[0]: r[1] for r in c.fetchall()}
|
|
||||||
|
|
||||||
# TKG stats
|
# TKG stats
|
||||||
c.execute("SELECT COUNT(*) FROM tkg_nodes")
|
c.execute("SELECT COUNT(*) FROM tkg_nodes")
|
||||||
|
|||||||
Reference in New Issue
Block a user