From f543d07819f9df09d7caeb0606e189c5c34797f9 Mon Sep 17 00:00:00 2001 From: tushar1977 Date: Wed, 29 Oct 2025 19:16:15 +0530 Subject: [PATCH 1/2] Converts raw data to json --- backend/app/database/face_clusters.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/app/database/face_clusters.py b/backend/app/database/face_clusters.py index dc8c97334..828ecec17 100644 --- a/backend/app/database/face_clusters.py +++ b/backend/app/database/face_clusters.py @@ -205,9 +205,9 @@ def db_delete_all_clusters() -> int: conn.close() -def db_get_all_clusters_with_face_counts() -> ( - List[Dict[str, Union[str, Optional[str], int]]] -): +def db_get_all_clusters_with_face_counts() -> List[ + Dict[str, Union[str, Optional[str], int]] +]: """ Retrieve all clusters with their face counts and stored face images. @@ -299,11 +299,12 @@ def db_get_images_by_cluster_id( bbox_json, ) = row + import json + + metadata_dict = json.loads(metadata) if metadata else None # Parse bbox JSON if it exists bbox = None if bbox_json: - import json - bbox = json.loads(bbox_json) images.append( @@ -311,7 +312,7 @@ def db_get_images_by_cluster_id( "image_id": image_id, "image_path": image_path, "thumbnail_path": thumbnail_path, - "metadata": metadata, + "metadata": metadata_dict, "face_id": face_id, "confidence": confidence, "bbox": bbox, From 9482f8eea09cac104bd8b7ecf4299bce7455317d Mon Sep 17 00:00:00 2001 From: tushar1977 Date: Wed, 29 Oct 2025 19:22:20 +0530 Subject: [PATCH 2/2] reverted the brackets --- backend/app/database/face_clusters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/database/face_clusters.py b/backend/app/database/face_clusters.py index 828ecec17..033b9b984 100644 --- a/backend/app/database/face_clusters.py +++ b/backend/app/database/face_clusters.py @@ -205,9 +205,9 @@ def db_delete_all_clusters() -> int: conn.close() -def db_get_all_clusters_with_face_counts() -> List[ - Dict[str, Union[str, Optional[str], int]] -]: +def db_get_all_clusters_with_face_counts() -> ( + List[Dict[str, Union[str, Optional[str], int]]] +): """ Retrieve all clusters with their face counts and stored face images.