Add CPR cross-referencing (related documents)
Clicking any flagged card that contains CPR hits now shows a "Related documents" section in the preview panel, listing other items from the same scan session that share at least one CPR number. Items are ordered by number of shared CPRs; clicking any entry opens it in the preview panel. Works in both live mode and scan history mode. Implementation - GDPRDb.get_related_items() — SQL self-join on the existing cpr_index table using the same symmetric 300 s session window as get_session_items. No new data collection needed. - GET /api/db/related/<item_id>?ref=N — new endpoint in routes/database.py, consistent with the ?ref convention used by /api/db/flagged. - #previewRelated div injected between the metadata block and disposition row in the preview panel. - _loadRelated(f) in results.js fetches and renders the list; window._openRelated() resolves items from the live grid or falls back to the API response for history-mode items. Also - Added keyword/FTS5 search as a deferred idea in SUGGESTIONS.md - Updated CHANGELOG.md, README.md, and CLAUDE.md
This commit is contained in:
1 parent
8b55e9d933
commit
d84e57239a
8 files changed
+118
-1
No files matched your search
@@ -204,6 +204,22 @@ def db_flagged_items():
|
||||
return jsonify(out)
|
||||
|
||||
|
||||
@bp.route("/api/db/related/<item_id>")
|
||||
def db_related_items(item_id):
|
||||
"""Return flagged items from the same session sharing at least one CPR hash."""
|
||||
if not DB_OK:
|
||||
return jsonify([])
|
||||
ref = request.args.get("ref", type=int)
|
||||
import json as _json
|
||||
out = []
|
||||
for row in _get_db().get_related_items(item_id, ref_scan_id=ref):
|
||||
row["special_category"] = _json.loads(row.get("special_category") or "[]") if isinstance(row.get("special_category"), str) else row.get("special_category", [])
|
||||
row["exif"] = _json.loads(row.get("exif_json") or "{}") if isinstance(row.get("exif_json"), str) else row.get("exif", {})
|
||||
row.pop("exif_json", None)
|
||||
out.append(row)
|
||||
return jsonify(out)
|
||||
|
||||
|
||||
@bp.route("/api/db/deletion_log")
|
||||
def db_deletion_log():
|
||||
"""Return the deletion audit log.
|
||||
|
||||
Reference in new issue
Block a user