feat: expose face artifact completion counts (trace_profile/key_frame/key_face) in scan + traces APIs
This commit is contained in:
@@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::types::AppState;
|
||||
use crate::core::db::schema;
|
||||
use crate::core::file_profile::{count_face_artifacts, FaceArtifactsCounts};
|
||||
|
||||
/// Comprehensive file stats endpoint — provides all data sources for frontend transparency
|
||||
/// Combines: JSON file status + PostgreSQL counts + Qdrant collections + TKG stats + Identity Agent stats
|
||||
@@ -27,6 +28,8 @@ struct FileStatsResponse {
|
||||
tkg: TkgFileStats,
|
||||
// Face Dedup stats
|
||||
face_dedup: FaceDedupStats,
|
||||
// On-disk face artifact counts (vs expected)
|
||||
face_artifacts: FaceArtifactsCounts,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -1056,6 +1059,19 @@ async fn get_file_stats(
|
||||
consistent: (face_clusters as i64) == face_track_count,
|
||||
};
|
||||
|
||||
// 7. On-disk face artifact counts (trace dirs + key_frame/key_face/profile)
|
||||
let trace_profiles_table = schema::table_name("trace_profiles");
|
||||
let expected_traces: i64 = sqlx::query_scalar(&format!(
|
||||
"SELECT COUNT(*) FROM {} WHERE file_uuid = $1",
|
||||
trace_profiles_table
|
||||
))
|
||||
.bind(&file_uuid)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.unwrap_or(0);
|
||||
let mut face_artifacts = count_face_artifacts(output_dir, &file_uuid);
|
||||
face_artifacts.expected_traces = expected_traces;
|
||||
|
||||
Ok(Json(FileStatsResponse {
|
||||
file_uuid: file_uuid_str,
|
||||
file_name,
|
||||
@@ -1065,6 +1081,7 @@ async fn get_file_stats(
|
||||
qdrant: qdrant_stats,
|
||||
tkg,
|
||||
face_dedup,
|
||||
face_artifacts,
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user