feat(iace): add data-driven Architektur & Datenfluss explainer tab
Adds an auditor-facing view of the IACE engine: a clickable 10-stage pipeline flow (Grenzen-Formular → ParseNarrative → Pattern-Gates → Relevanz → Caps → Gefährdungen → Maßnahmen → Risiko → Normen → Matrix), plus live library counts, the data-source/license register (incl. the DIN/Beuth + DGUV exclusions), and the norm-matching logic that reconciles DIN/ISO/OSHA machine-type vocabulary via canonicalMachineType folding. Backend: BuildArchitecture() with LIVE counts so the diagram can never drift; GET /iace/architecture; collectAllNorms() extracted from SuggestNorms as the single source of truth for the norm-library count. Frontend: useArchitecture hook + page + new IACE nav tab. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
export interface ArchStage {
|
||||
id: string
|
||||
title: string
|
||||
summary: string
|
||||
input: string
|
||||
logic: string
|
||||
data_source: string
|
||||
example: string
|
||||
}
|
||||
|
||||
export interface ArchLibrary {
|
||||
name: string
|
||||
count: number
|
||||
source_file: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface ArchDataSource {
|
||||
name: string
|
||||
license: string
|
||||
usage: string
|
||||
status: string // "verwendet" | "ausgeschlossen"
|
||||
}
|
||||
|
||||
export interface RiskEvidence {
|
||||
mode: string
|
||||
label: string
|
||||
stat: string
|
||||
source: string
|
||||
license: string
|
||||
attribution: string
|
||||
retrieved: string
|
||||
}
|
||||
|
||||
export interface Architecture {
|
||||
stages: ArchStage[]
|
||||
libraries: ArchLibrary[]
|
||||
data_sources: ArchDataSource[]
|
||||
norm_matching: string[]
|
||||
evidence: RiskEvidence[]
|
||||
}
|
||||
|
||||
/** Loads the data-driven IACE engine self-description (global, not per project). */
|
||||
export function useArchitecture() {
|
||||
const [data, setData] = useState<Architecture | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
async function load() {
|
||||
setLoading(true)
|
||||
try {
|
||||
const res = await fetch('/api/sdk/v1/iace/architecture')
|
||||
const json = res.ok ? ((await res.json()) as Architecture) : null
|
||||
if (!cancelled) setData(json)
|
||||
} catch (err) {
|
||||
console.error('Failed to load IACE architecture:', err)
|
||||
} finally {
|
||||
if (!cancelled) setLoading(false)
|
||||
}
|
||||
}
|
||||
load()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [])
|
||||
|
||||
return { data, loading }
|
||||
}
|
||||
Reference in New Issue
Block a user