diff --git a/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_components/RiskDataSources.tsx b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_components/RiskDataSources.tsx new file mode 100644 index 00000000..5cfad826 --- /dev/null +++ b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_components/RiskDataSources.tsx @@ -0,0 +1,59 @@ +'use client' + +import { useState } from 'react' +import { RiskDataSources as RiskDataSourcesData } from '../_hooks/useRiskDataSources' + +/** + * Collapsible evidence panel: the real public-statistics figures (Eurostat ESAW + * 2023) that anchor the W/S tiers, with license + ready-to-print attribution. + * Confidence-aware tonality — informs the source, does not alarm. + */ +export function RiskDataSources({ data }: { data: RiskDataSourcesData }) { + const [open, setOpen] = useState(false) + if (!data.evidence?.length) return null + + return ( +
+ + {open && ( +
+

{data.note}

+
+ + + + + + + + + + + {data.evidence.map((e) => ( + + + + + + + ))} + +
KontaktmodusBelegte QuoteQuelleLizenz
{e.label}{e.stat}{e.source}{e.license}
+
+

+ {data.evidence[0]?.attribution} · Tiers verankern die Quoten-Ordnung; die Werte sind an + BreakPilot-Ground-Truth kalibriert (keine Norm-Tabelle reproduziert). +

+
+ )} +
+ ) +} diff --git a/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_hooks/useRiskDataSources.ts b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_hooks/useRiskDataSources.ts new file mode 100644 index 00000000..239ea160 --- /dev/null +++ b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/_hooks/useRiskDataSources.ts @@ -0,0 +1,47 @@ +'use client' + +import { useEffect, useState } from 'react' + +export interface RiskEvidence { + mode: string + label: string + stat: string + source: string + license: string + attribution: string + retrieved: string +} + +export interface RiskDataSources { + note: string + evidence: RiskEvidence[] +} + +/** + * Loads the license-tagged public-statistics evidence behind the risk-frequency + * anchors (Eurostat ESAW hsw_ph3_08, 2023). Global, not per project — so an + * auditor can see WHERE the W/S tiers come from and the source is cited. + */ +export function useRiskDataSources() { + const [data, setData] = useState(null) + + useEffect(() => { + let cancelled = false + async function load() { + try { + const res = await fetch('/api/sdk/v1/iace/risk-data-sources') + if (!res.ok) return + const json = (await res.json()) as RiskDataSources + if (!cancelled) setData(json) + } catch (err) { + console.error('Failed to load risk data sources:', err) + } + } + load() + return () => { + cancelled = true + } + }, []) + + return { data } +} diff --git a/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/page.tsx b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/page.tsx index c8ee5ecf..44d17c5a 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/page.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/risikobewertung/page.tsx @@ -3,14 +3,17 @@ import { useParams } from 'next/navigation' import { useRiskAssessment } from './_hooks/useRiskAssessment' import { useRiskMatrix } from './_hooks/useRiskMatrix' +import { useRiskDataSources } from './_hooks/useRiskDataSources' import { RiskModelCard } from './_components/RiskModelCard' import { RiskMatrix } from './_components/RiskMatrix' +import { RiskDataSources } from './_components/RiskDataSources' export default function RisikobewertungPage() { const params = useParams<{ projectId: string }>() const projectId = params.projectId const { hazards, suggestions, loading } = useRiskAssessment(projectId) const { data: matrix } = useRiskMatrix(projectId) + const { data: dataSources } = useRiskDataSources() return (
@@ -26,6 +29,8 @@ export default function RisikobewertungPage() { {matrix && matrix.total > 0 && } + {dataSources && } + {loading && (
Lade Gefaehrdungen…
)}