577ceae4e6
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>
47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
'use client'
|
|
|
|
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">
|
|
<div>
|
|
<h1 className="text-2xl font-bold text-gray-900 dark:text-gray-100">Risikobewertung</h1>
|
|
<p className="text-sm text-gray-500 dark:text-gray-400 max-w-3xl mt-1">
|
|
Zwei Modelle pro Gefaehrdung: <strong>EN-62061-Stil</strong> (F/W/P/S) und{' '}
|
|
<strong>Fine-Kinney</strong> (P/E/C, US-anerkannt). BreakPilot schlaegt begruendete
|
|
Werte aus oeffentlichen Datenquellen vor (ESAW/NIOSH/OSHA) — passen Sie sie nach Ihrer
|
|
Erfahrung bzw. Ihren eigenen Normdaten an; das Tool rechnet die Formel live aus.
|
|
</p>
|
|
</div>
|
|
|
|
{matrix && matrix.total > 0 && <RiskMatrix data={matrix} />}
|
|
|
|
{loading && (
|
|
<div className="text-sm text-gray-500 dark:text-gray-400">Lade Gefaehrdungen…</div>
|
|
)}
|
|
|
|
{!loading && hazards.length === 0 && (
|
|
<div className="rounded-xl border border-dashed border-gray-300 dark:border-gray-700 p-6 text-sm text-gray-500">
|
|
Keine Gefaehrdungen vorhanden. Bitte zuerst im <strong>Hazard Log</strong> erzeugen.
|
|
</div>
|
|
)}
|
|
|
|
<div className="space-y-4">
|
|
{hazards.map((h) => (
|
|
<RiskModelCard key={h.id} hazard={h} suggestion={suggestions[h.id]} />
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|