This commit is contained in:
Josh Hawkins 2025-03-12 12:02:50 -05:00
parent a3b37f79fa
commit c62cf01cc0
4 changed files with 32 additions and 1 deletions

View File

@ -333,6 +333,18 @@ function ObjectDetailsTab({
}
}, [search]);
const identifierScore = useMemo(() => {
if (!search) {
return undefined;
}
if (search.data.identifier && search.data?.identifier_score) {
return Math.round((search.data?.identifier_score ?? 0) * 100);
} else {
return undefined;
}
}, [search]);
const averageEstimatedSpeed = useMemo(() => {
if (!search || !search.data?.average_estimated_speed) {
return undefined;
@ -538,6 +550,17 @@ function ObjectDetailsTab({
</Tooltip>
</div>
</div>
{search?.data.identifier && (
<div className="flex flex-col gap-1.5">
<div className="text-sm text-primary/40">Identifier</div>
<div className="flex flex-col space-y-0.5 text-sm">
<div className="flex flex-row items-center gap-2">
{search.data.identifier}{" "}
{identifierScore && ` (${identifierScore}%)`}
</div>
</div>
</div>
)}
<div className="flex flex-col gap-1.5">
<div className="text-sm text-primary/40">
<div className="flex flex-row items-center gap-1">

View File

@ -105,6 +105,7 @@ export default function Explore() {
cameras: searchSearchParams["cameras"],
labels: searchSearchParams["labels"],
sub_labels: searchSearchParams["sub_labels"],
identifier: searchSearchParams["identifier"],
zones: searchSearchParams["zones"],
before: searchSearchParams["before"],
after: searchSearchParams["after"],
@ -140,6 +141,7 @@ export default function Explore() {
cameras: searchSearchParams["cameras"],
labels: searchSearchParams["labels"],
sub_labels: searchSearchParams["sub_labels"],
identifier: searchSearchParams["identifier"],
zones: searchSearchParams["zones"],
before: searchSearchParams["before"],
after: searchSearchParams["after"],

View File

@ -58,6 +58,8 @@ export type SearchResult = {
average_estimated_speed: number;
velocity_angle: number;
path_data: [number[], number][];
identifier?: string;
identifier_score?: number;
};
};
@ -66,6 +68,7 @@ export type SearchFilter = {
cameras?: string[];
labels?: string[];
sub_labels?: string[];
identifier?: string[];
zones?: string[];
before?: number;
after?: number;
@ -89,6 +92,7 @@ export type SearchQueryParams = {
cameras?: string[];
labels?: string[];
sub_labels?: string[];
identifier?: string[];
zones?: string[];
before?: string;
after?: string;

View File

@ -121,6 +121,7 @@ export default function SearchView({
}, [config, searchFilter]);
const { data: allSubLabels } = useSWR("sub_labels");
const { data: allIdentifiers } = useSWR("identifiers");
const allZones = useMemo<string[]>(() => {
if (!config) {
@ -160,12 +161,13 @@ export default function SearchView({
max_score: ["100"],
min_speed: ["1"],
max_speed: ["150"],
identifier: allIdentifiers,
has_clip: ["yes", "no"],
has_snapshot: ["yes", "no"],
...(config?.plus?.enabled &&
searchFilter?.has_snapshot && { is_submitted: ["yes", "no"] }),
}),
[config, allLabels, allZones, allSubLabels, searchFilter],
[config, allLabels, allZones, allSubLabels, allIdentifiers, searchFilter],
);
// remove duplicate event ids