feat: Implement excluded and identified filters in FacesMaintenance component
This commit adds functionality to filter faces based on their excluded and identified statuses in the FacesMaintenance component. New state variables and API parameters are introduced to manage these filters, enhancing the user experience. The UI is updated with dropdowns for selecting filter options, and the backend is modified to support these filters in the face listing API. Documentation has been updated to reflect these changes.
This commit is contained in:
@@ -861,6 +861,8 @@ def list_all_faces(
|
||||
page_size: int = Query(50, ge=1, le=2000),
|
||||
min_quality: float = Query(0.0, ge=0.0, le=1.0),
|
||||
max_quality: float = Query(1.0, ge=0.0, le=1.0),
|
||||
excluded_filter: str = Query("all", description="Filter by excluded status: all, excluded, included"),
|
||||
identified_filter: str = Query("all", description="Filter by identified status: all, identified, unidentified"),
|
||||
db: Session = Depends(get_db),
|
||||
) -> MaintenanceFacesResponse:
|
||||
"""List all faces with person info and file path for maintenance.
|
||||
@@ -877,6 +879,20 @@ def list_all_faces(
|
||||
.filter(Face.quality_score <= max_quality)
|
||||
)
|
||||
|
||||
# Filter by excluded status
|
||||
if excluded_filter == "excluded":
|
||||
query = query.filter(Face.excluded.is_(True))
|
||||
elif excluded_filter == "included":
|
||||
query = query.filter(Face.excluded.is_(False))
|
||||
# "all" means no additional filter
|
||||
|
||||
# Filter by identified status
|
||||
if identified_filter == "identified":
|
||||
query = query.filter(Face.person_id.isnot(None))
|
||||
elif identified_filter == "unidentified":
|
||||
query = query.filter(Face.person_id.is_(None))
|
||||
# "all" means no additional filter
|
||||
|
||||
# Get total count
|
||||
total = query.count()
|
||||
|
||||
@@ -910,6 +926,7 @@ def list_all_faces(
|
||||
quality_score=float(face.quality_score),
|
||||
person_id=face.person_id,
|
||||
person_name=person_name,
|
||||
excluded=face.excluded,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -318,6 +318,7 @@ class MaintenanceFaceItem(BaseModel):
|
||||
quality_score: float
|
||||
person_id: Optional[int] = None
|
||||
person_name: Optional[str] = None # Full name if identified
|
||||
excluded: bool
|
||||
|
||||
|
||||
class MaintenanceFacesResponse(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user