Skip to main content

videre_api/
types.rs

1use serde::Serialize;
2
3/// One labeled person: their confirmed faces plus a representative face id
4/// (the primary, or lowest id) used as the card thumbnail.
5#[derive(Serialize, Clone)]
6pub struct PersonData {
7    pub label: String,
8    pub face_ids: Vec<i64>,
9    pub representative_id: i64,
10    pub hashes: Vec<String>,
11}
12
13/// One unassigned cluster (green section in the labeling UI).
14#[derive(Serialize, Clone)]
15pub struct ClusterData {
16    pub cluster_id: i64,
17    pub face_ids: Vec<i64>,
18    pub hashes: Vec<String>,
19}
20
21/// One unclustered, unassigned face (orange section).
22#[derive(Serialize, Clone)]
23pub struct SingletonData {
24    pub face_id: i64,
25    pub hash: String,
26}
27
28/// Top-level payload for the labeling page.
29#[derive(Serialize, Clone)]
30pub struct FacesData {
31    pub people: Vec<PersonData>,
32    pub clusters: Vec<ClusterData>,
33    pub singletons: Vec<SingletonData>,
34}
35
36/// One face row on a cluster detail page.
37#[derive(Serialize, Clone)]
38pub struct ClusterFaceData {
39    pub face_id: i64,
40    pub hash: String,
41    pub path: String,
42}
43
44/// Cluster detail: every face in one unassigned cluster.
45#[derive(Serialize, Clone)]
46pub struct ClusterDetail {
47    pub cluster_id: i64,
48    pub faces: Vec<ClusterFaceData>,
49}
50
51/// One face row on a person detail page. `is_primary` marks the current
52/// default photo (the person's thumbnail on the labeling page).
53#[derive(Serialize, Clone)]
54pub struct PersonFaceData {
55    pub face_id: i64,
56    pub hash: String,
57    pub path: String,
58    pub is_primary: bool,
59}
60
61/// Person detail: every confirmed face for one person.
62#[derive(Serialize, Clone)]
63pub struct PersonDetail {
64    pub label: String,
65    pub faces: Vec<PersonFaceData>,
66}