import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import { BrainCircuit, TrendingDown, Users } from 'lucide-react'; import type { PipelineStateResponse, ServiceStatus } from '../../types/labeleval'; import { SectionCard, StatusChip, fmtInt } from './shared'; function findService(pipeline: PipelineStateResponse | null, ...needles: string[]): ServiceStatus | null { if (!pipeline) return null; const lower = needles.map((n) => n.toLowerCase()); return ( pipeline.services.find((s) => { const name = s.service.toLowerCase(); return lower.some((n) => name.includes(n)); }) ?? null ); } function EngineCard({ icon, title, service, description, }: { icon: React.ReactNode; title: string; service: ServiceStatus | null; description: string; }) { return ( {icon} {title} {description} {service ? ( {fmtInt(service.processed)} / {fmtInt(service.total)} processed · {fmtInt(service.process_units)} process units{service.detail ? ` · ${service.detail}` : ''} ) : ( No live status yet. )} ); } export default function LabelEvaluationEngine({ pipeline }: { pipeline: PipelineStateResponse | null }) { return ( Each engine produces independent evidence that feeds the Quality Gate. There is never a single blended score: a label is only verified when every applicable gate passes on its own evidence. } title="ML Anomaly Detection" service={findService(pipeline, 'anomaly')} description="Ensemble of classical + deep detectors scoring every annotation for statistical abnormality relative to the fleet distribution." /> } title="Regression Tracking" service={findService(pipeline, 'regression')} description="Compares the current model's per-class and per-scenario metrics against the baseline; any tolerated-delta breach is evidence." /> } title="Grader Disagreement" service={findService(pipeline, 'grader', 'consensus', 'disagreement')} description="Multiple automated graders vote on class, spatial and temporal correctness; low consensus is evidence of an unreliable label." /> ); }