feat(iace): project-wide risk matrix (Severity × Probability)

Adds GET /projects/:id/risk-matrix — a confidence-aware risk view computed
on read from each hazard's category/scenario/lifecycle using the SAME model
as the GT benchmark (no persistence, so it never goes stale against the
model; the hand-defaulted iace_hazards risk columns stay untouched).

- risk_matrix.go: EstimateHazardRisk (single source of truth for S/F/W/P +
  range + level + confidence) and BuildRiskMatrix (per-hazard list + a 5×5
  Severity×Probability aggregation grid with dominant level per cell).
- Frontend: RiskMatrix grid in the Risikobewertung tab (muted colours per
  the confidence-aware tonality), level counts + tool-confidence summary,
  fed by useRiskMatrix. Shows risk for EVERY project, not only GT ones.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 08:54:47 +02:00
parent 901de1ca97
commit 577ceae4e6
7 changed files with 383 additions and 0 deletions
@@ -2,12 +2,15 @@
import { useParams } from 'next/navigation'
import { useRiskAssessment } from './_hooks/useRiskAssessment'
import { useRiskMatrix } from './_hooks/useRiskMatrix'
import { RiskModelCard } from './_components/RiskModelCard'
import { RiskMatrix } from './_components/RiskMatrix'
export default function RisikobewertungPage() {
const params = useParams<{ projectId: string }>()
const projectId = params.projectId
const { hazards, suggestions, loading } = useRiskAssessment(projectId)
const { data: matrix } = useRiskMatrix(projectId)
return (
<div className="space-y-6">
@@ -21,6 +24,8 @@ export default function RisikobewertungPage() {
</p>
</div>
{matrix && matrix.total > 0 && <RiskMatrix data={matrix} />}
{loading && (
<div className="text-sm text-gray-500 dark:text-gray-400">Lade Gefaehrdungen</div>
)}