diff --git a/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx b/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx index 303647f9..618a7433 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx @@ -14,14 +14,21 @@ type TabType = 'matched' | 'missing' | 'extra' export function HazardComparisonTable({ matched, missing, extra }: Props) { const [tab, setTab] = useState('matched') - // Compute quality levels for matched pairs - const greenCount = matched.filter(p => p.match_score >= 0.7).length - const yellowCount = matched.filter(p => p.match_score >= 0.4 && p.match_score < 0.7).length + // Split matches: >= 50% are real matches, < 50% are weak (shown separately) + const realMatched = matched.filter(p => p.match_score >= 0.5) + const weakMatched = matched.filter(p => p.match_score < 0.5) + + // Weak matches: GT entries go to "missing", engine entries go to "extra" + const allMissing = [...missing, ...weakMatched.map(w => w.gt_entry)] + const allExtra = [...extra, ...weakMatched.map(w => w.engine_hazard)] + + const greenCount = realMatched.filter(p => p.match_score >= 0.7).length + const yellowCount = realMatched.filter(p => p.match_score >= 0.5 && p.match_score < 0.7).length const tabs: { id: TabType; label: string; count: number; color: string }[] = [ - { id: 'matched', label: `Zugeordnet (${greenCount} exakt, ${yellowCount} aehnlich)`, count: matched.length, color: 'text-green-600' }, - { id: 'missing', label: 'Fehlend', count: missing.length, color: 'text-red-600' }, - { id: 'extra', label: 'Zusaetzlich', count: extra.length, color: 'text-gray-500' }, + { id: 'matched', label: `Zugeordnet (${greenCount} exakt, ${yellowCount} aehnlich)`, count: realMatched.length, color: 'text-green-600' }, + { id: 'missing', label: 'Fehlend', count: allMissing.length, color: 'text-red-600' }, + { id: 'extra', label: 'Engine Findings', count: allExtra.length, color: 'text-blue-500' }, ] return ( @@ -44,9 +51,9 @@ export function HazardComparisonTable({ matched, missing, extra }: Props) {
- {tab === 'matched' && } - {tab === 'missing' && } - {tab === 'extra' && } + {tab === 'matched' && } + {tab === 'missing' && } + {tab === 'extra' && }
) diff --git a/admin-compliance/app/sdk/iace/[projectId]/benchmark/page.tsx b/admin-compliance/app/sdk/iace/[projectId]/benchmark/page.tsx index bbcd99a9..f1f6e03f 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/benchmark/page.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/benchmark/page.tsx @@ -12,7 +12,9 @@ export default function BenchmarkPage() { const { result, gtLoaded, gtEntryCount, loading, error, importGT, runBenchmark } = useBenchmark(projectId) const [gtProjectId, setGtProjectId] = useState('') - const coveragePct = result ? Math.round(result.coverage_score * 100) : 0 + // Only count matches >= 50% as real coverage + const realMatchCount = result ? (result.matched_pairs?.filter(m => m.match_score >= 0.5).length || 0) : 0 + const coveragePct = result ? Math.round(realMatchCount * 100 / Math.max(result.total_gt, 1)) : 0 const measurePct = result ? Math.round(result.measure_coverage * 100) : 0 return ( @@ -74,7 +76,7 @@ export default function BenchmarkPage() { = 50% Match)`} color={coveragePct >= 80 ? 'green' : coveragePct >= 50 ? 'yellow' : 'red'} />