Compare commits

...

3 Commits

Author SHA1 Message Date
Benjamin Admin 0599c72cc1 Fix IPA continuation: don't replace normal text with IPA
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 41s
CI / test-go-edu-search (push) Successful in 43s
CI / test-python-klausur (push) Failing after 2m39s
CI / test-python-agent-core (push) Successful in 35s
CI / test-nodejs-website (push) Successful in 19s
Text like "Betonung auf der 1. Silbe: profit ['profit]" was
incorrectly detected as garbled IPA and replaced with generated
IPA transcription of the previous row's example sentence.

Added guard: if the cell text contains >=3 recognizable words
(3+ letter alpha tokens), it's normal text, not garbled IPA.
Garbled IPA is typically short and has no real dictionary words.

Fixes: Row 13 C3 showing IPA instead of pronunciation hint text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 22:28:58 +02:00
Benjamin Admin 5fad2d420d test+docs(rag): Tests und Entwicklerdoku fuer RAG Landkarte
- 44 Vitest-Tests: JSON-Struktur, Branchen-Zuordnung, Applicability
  Notes, Dokumenttyp-Verteilung, keine Duplikate
- MkDocs-Seite: Architektur, 10 Branchen, Zuordnungslogik,
  Integration in andere Projekte, Datenquellen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 20:47:54 +02:00
Benjamin Admin c8e5e498b5 feat(rag): Applicability Notes UI + Branchen-Review
- Matrix-Zeilen aufklappbar: Klick zeigt Branchenrelevanz-Erklaerung,
  Beschreibung und Gueltigkeitsdatum
- 27 Branchen-Zuordnungen korrigiert:
  - OWASP/NIST/CISA/SBOM-Standards → alle (Kunden entwickeln Software)
  - BSI-TR-03161 → leer (DiGA, nicht Zielmarkt)
  - BSI 200-4, ENISA Supply Chain → alle (CRA/NIS2-Pflicht)
  - EAA/BFSG → +automotive (digitale Interfaces)
- 264 horizontal, 42 sektorspezifisch, 14 nicht zutreffend

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 19:15:01 +02:00
6 changed files with 586 additions and 121 deletions
@@ -0,0 +1,252 @@
import { describe, it, expect } from 'vitest'
import ragData from '../rag-documents.json'
/**
* Tests fuer rag-documents.json — Branchen-Regulierungs-Matrix
*
* Validiert die JSON-Struktur, Branchen-Zuordnung und Datenintegritaet
* der 320 Dokumente fuer die RAG Landkarte.
*/
const VALID_INDUSTRY_IDS = ragData.industries.map((i: any) => i.id)
const VALID_DOC_TYPE_IDS = ragData.doc_types.map((dt: any) => dt.id)
describe('rag-documents.json — Struktur', () => {
it('sollte doc_types, industries und documents enthalten', () => {
expect(ragData).toHaveProperty('doc_types')
expect(ragData).toHaveProperty('industries')
expect(ragData).toHaveProperty('documents')
expect(Array.isArray(ragData.doc_types)).toBe(true)
expect(Array.isArray(ragData.industries)).toBe(true)
expect(Array.isArray(ragData.documents)).toBe(true)
})
it('sollte genau 10 Branchen haben (VDMA/VDA/BDI)', () => {
expect(ragData.industries).toHaveLength(10)
const ids = ragData.industries.map((i: any) => i.id)
expect(ids).toContain('automotive')
expect(ids).toContain('maschinenbau')
expect(ids).toContain('elektrotechnik')
expect(ids).toContain('chemie')
expect(ids).toContain('metall')
expect(ids).toContain('energie')
expect(ids).toContain('transport')
expect(ids).toContain('handel')
expect(ids).toContain('konsumgueter')
expect(ids).toContain('bau')
})
it('sollte keine Pseudo-Branchen enthalten (IoT, KI, HR, KRITIS, etc.)', () => {
const ids = ragData.industries.map((i: any) => i.id)
expect(ids).not.toContain('iot')
expect(ids).not.toContain('ai')
expect(ids).not.toContain('hr')
expect(ids).not.toContain('kritis')
expect(ids).not.toContain('ecommerce')
expect(ids).not.toContain('tech')
expect(ids).not.toContain('media')
expect(ids).not.toContain('public')
})
it('sollte 17 Dokumenttypen haben', () => {
expect(ragData.doc_types.length).toBe(17)
})
it('sollte mindestens 300 Dokumente haben', () => {
expect(ragData.documents.length).toBeGreaterThanOrEqual(300)
})
it('sollte jede Branche name und icon haben', () => {
ragData.industries.forEach((ind: any) => {
expect(ind).toHaveProperty('id')
expect(ind).toHaveProperty('name')
expect(ind).toHaveProperty('icon')
expect(ind.name.length).toBeGreaterThan(0)
})
})
it('sollte jeden doc_type mit id, label, icon und sort haben', () => {
ragData.doc_types.forEach((dt: any) => {
expect(dt).toHaveProperty('id')
expect(dt).toHaveProperty('label')
expect(dt).toHaveProperty('icon')
expect(dt).toHaveProperty('sort')
})
})
})
describe('rag-documents.json — Dokument-Validierung', () => {
it('sollte keine doppelten Codes haben', () => {
const codes = ragData.documents.map((d: any) => d.code)
const unique = new Set(codes)
expect(unique.size).toBe(codes.length)
})
it('sollte Pflichtfelder bei jedem Dokument haben', () => {
ragData.documents.forEach((doc: any) => {
expect(doc).toHaveProperty('code')
expect(doc).toHaveProperty('name')
expect(doc).toHaveProperty('doc_type')
expect(doc).toHaveProperty('industries')
expect(doc).toHaveProperty('in_rag')
expect(doc).toHaveProperty('rag_collection')
expect(doc.code.length).toBeGreaterThan(0)
expect(doc.name.length).toBeGreaterThan(0)
expect(Array.isArray(doc.industries)).toBe(true)
})
})
it('sollte nur gueltige doc_type IDs verwenden', () => {
ragData.documents.forEach((doc: any) => {
expect(VALID_DOC_TYPE_IDS).toContain(doc.doc_type)
})
})
it('sollte nur gueltige industry IDs verwenden (oder "all")', () => {
ragData.documents.forEach((doc: any) => {
doc.industries.forEach((ind: string) => {
if (ind !== 'all') {
expect(VALID_INDUSTRY_IDS).toContain(ind)
}
})
})
})
it('sollte gueltige rag_collection Namen verwenden', () => {
const validCollections = [
'bp_compliance_ce',
'bp_compliance_gesetze',
'bp_compliance_datenschutz',
'bp_dsfa_corpus',
'bp_legal_templates',
'bp_compliance_recht',
'bp_nibis_eh',
]
ragData.documents.forEach((doc: any) => {
expect(validCollections).toContain(doc.rag_collection)
})
})
})
describe('rag-documents.json — Branchen-Zuordnungslogik', () => {
const findDoc = (code: string) => ragData.documents.find((d: any) => d.code === code)
describe('Horizontale Regulierungen (alle Branchen)', () => {
const horizontalCodes = [
'GDPR', 'BDSG_FULL', 'EPRIVACY', 'TDDDG', 'AIACT', 'CRA',
'NIS2', 'GPSR', 'PLD', 'EUCSA', 'DATAACT',
]
horizontalCodes.forEach((code) => {
it(`${code} sollte fuer alle Branchen gelten`, () => {
const doc = findDoc(code)
if (doc) {
expect(doc.industries).toContain('all')
}
})
})
})
describe('Sektorspezifische Regulierungen', () => {
it('Maschinenverordnung sollte Maschinenbau, Automotive, Elektrotechnik enthalten', () => {
const doc = findDoc('MACHINERY_REG')
if (doc) {
expect(doc.industries).toContain('maschinenbau')
expect(doc.industries).toContain('automotive')
expect(doc.industries).toContain('elektrotechnik')
expect(doc.industries).not.toContain('all')
}
})
it('ElektroG sollte Elektrotechnik und Automotive enthalten', () => {
const doc = findDoc('DE_ELEKTROG')
if (doc) {
expect(doc.industries).toContain('elektrotechnik')
expect(doc.industries).toContain('automotive')
}
})
it('BattDG sollte Automotive und Elektrotechnik enthalten', () => {
const doc = findDoc('DE_BATTDG')
if (doc) {
expect(doc.industries).toContain('automotive')
expect(doc.industries).toContain('elektrotechnik')
}
})
it('ENISA ICS/SCADA sollte Energie, Maschinenbau, Chemie enthalten', () => {
const doc = findDoc('ENISA_ICS_SCADA')
if (doc) {
expect(doc.industries).toContain('energie')
expect(doc.industries).toContain('maschinenbau')
expect(doc.industries).toContain('chemie')
}
})
})
describe('Nicht zutreffende Regulierungen (Finanz/Medizin/Plattformen)', () => {
const emptyIndustryCodes = ['DORA', 'PSD2', 'MiCA', 'AMLR', 'EHDS', 'DSA', 'DMA', 'MDR']
emptyIndustryCodes.forEach((code) => {
it(`${code} sollte keine Branchen-Zuordnung haben`, () => {
const doc = findDoc(code)
if (doc) {
expect(doc.industries).toHaveLength(0)
}
})
})
})
describe('BSI-TR-03161 (DiGA) sollte nicht zutreffend sein', () => {
['BSI-TR-03161-1', 'BSI-TR-03161-2', 'BSI-TR-03161-3'].forEach((code) => {
it(`${code} sollte keine Branchen-Zuordnung haben`, () => {
const doc = findDoc(code)
if (doc) {
expect(doc.industries).toHaveLength(0)
}
})
})
})
})
describe('rag-documents.json — Applicability Notes', () => {
it('sollte applicability_note bei Dokumenten mit description haben', () => {
const withDescription = ragData.documents.filter((d: any) => d.description)
const withNote = withDescription.filter((d: any) => d.applicability_note)
// Mindestens 90% der Dokumente mit Beschreibung sollten eine Note haben
expect(withNote.length / withDescription.length).toBeGreaterThan(0.9)
})
it('horizontale Regulierungen sollten "alle Branchen" in der Note erwaehnen', () => {
const gdpr = ragData.documents.find((d: any) => d.code === 'GDPR')
if (gdpr?.applicability_note) {
expect(gdpr.applicability_note.toLowerCase()).toContain('alle branchen')
}
})
it('nicht zutreffende sollten "nicht zutreffend" in der Note erwaehnen', () => {
const dora = ragData.documents.find((d: any) => d.code === 'DORA')
if (dora?.applicability_note) {
expect(dora.applicability_note.toLowerCase()).toContain('nicht zutreffend')
}
})
})
describe('rag-documents.json — Dokumenttyp-Verteilung', () => {
it('sollte Dokumente in jedem doc_type haben', () => {
ragData.doc_types.forEach((dt: any) => {
const count = ragData.documents.filter((d: any) => d.doc_type === dt.id).length
expect(count).toBeGreaterThan(0)
})
})
it('sollte EU-Verordnungen als groesste Kategorie haben (mind. 15)', () => {
const euRegs = ragData.documents.filter((d: any) => d.doc_type === 'eu_regulation')
expect(euRegs.length).toBeGreaterThanOrEqual(15)
})
it('sollte EDPB Leitlinien als umfangreichste Kategorie haben (mind. 40)', () => {
const edpb = ragData.documents.filter((d: any) => d.doc_type === 'edpb_guideline')
expect(edpb.length).toBeGreaterThanOrEqual(40)
})
})
+54 -23
View File
@@ -724,6 +724,7 @@ export default function RAGPage() {
const [autoRefresh, setAutoRefresh] = useState(true)
const [elapsedTime, setElapsedTime] = useState<string>('')
const [expandedDocTypes, setExpandedDocTypes] = useState<string[]>(['eu_regulation', 'eu_directive'])
const [expandedMatrixDoc, setExpandedMatrixDoc] = useState<string | null>(null)
// Chunk browser state is now in ChunkBrowserQA component
@@ -1803,32 +1804,62 @@ export default function RAGPage() {
{/* Documents in this section */}
{isExpanded && docsInType.map((doc: any) => (
<tr key={doc.code} className="hover:bg-slate-50 border-b border-slate-100">
<td className="px-2 py-1.5 font-medium sticky left-0 bg-white">
<span className="flex items-center gap-1">
{isInRag(doc.code) ? (
<span className="text-green-500 text-[10px]"></span>
) : (
<span className="text-red-300 text-[10px]"></span>
)}
<span className="text-teal-600 truncate max-w-[180px]" title={doc.full_name || doc.name}>
{doc.name}
</span>
</span>
</td>
{INDUSTRIES_LIST.filter((i: any) => i.id !== 'all').map((industry: any) => {
const applies = doc.industries.includes(industry.id) || doc.industries.includes('all')
return (
<td key={industry.id} className="px-2 py-1.5 text-center">
{applies ? (
<span className="inline-flex items-center justify-center w-5 h-5 bg-teal-100 text-teal-600 rounded-full"></span>
<React.Fragment key={doc.code}>
<tr
className={`hover:bg-slate-50 border-b border-slate-100 cursor-pointer ${expandedMatrixDoc === doc.code ? 'bg-teal-50' : ''}`}
onClick={() => setExpandedMatrixDoc(expandedMatrixDoc === doc.code ? null : doc.code)}
>
<td className="px-2 py-1.5 font-medium sticky left-0 bg-white">
<span className="flex items-center gap-1">
{isInRag(doc.code) ? (
<span className="text-green-500 text-[10px]"></span>
) : (
<span className="inline-flex items-center justify-center w-5 h-5 text-slate-300"></span>
<span className="text-red-300 text-[10px]"></span>
)}
<span className="text-teal-600 truncate max-w-[180px]" title={doc.full_name || doc.name}>
{doc.name}
</span>
{(doc.applicability_note || doc.description) && (
<span className="text-slate-400 text-[10px] ml-1">{expandedMatrixDoc === doc.code ? '▼' : 'ⓘ'}</span>
)}
</span>
</td>
{INDUSTRIES_LIST.filter((i: any) => i.id !== 'all').map((industry: any) => {
const applies = doc.industries.includes(industry.id) || doc.industries.includes('all')
return (
<td key={industry.id} className="px-2 py-1.5 text-center">
{applies ? (
<span className="inline-flex items-center justify-center w-5 h-5 bg-teal-100 text-teal-600 rounded-full"></span>
) : (
<span className="inline-flex items-center justify-center w-5 h-5 text-slate-300"></span>
)}
</td>
)
})}
</tr>
{expandedMatrixDoc === doc.code && (doc.applicability_note || doc.description) && (
<tr className="bg-teal-50 border-b border-teal-200">
<td colSpan={INDUSTRIES_LIST.length} className="px-4 py-3">
<div className="text-xs space-y-1.5">
{doc.full_name && (
<p className="font-semibold text-slate-700">{doc.full_name}</p>
)}
{doc.applicability_note && (
<p className="text-teal-700 bg-teal-100 px-2 py-1 rounded inline-block">
<span className="font-medium">Branchenrelevanz:</span> {doc.applicability_note}
</p>
)}
{doc.description && (
<p className="text-slate-600">{doc.description}</p>
)}
{doc.effective_date && (
<p className="text-slate-400">In Kraft: {doc.effective_date}</p>
)}
</div>
</td>
)
})}
</tr>
</tr>
)}
</React.Fragment>
))}
</React.Fragment>
)
@@ -484,13 +484,14 @@
"industries": [
"handel",
"konsumgueter",
"elektrotechnik"
"elektrotechnik",
"automotive"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"effective_date": "28. Juni 2025",
"sort_order": 4,
"applicability_note": "Sektorspezifisch: Handel, Konsumgueter, Elektrotechnik. Barrierefreiheitsanforderungen fuer Produkte und digitale Dienstleistungen."
"applicability_note": "Sektorspezifisch: Handel, Konsumgueter, Elektrotechnik, Automotive. Barrierefreiheitsanforderungen fuer Produkte und Dienstleistungen mit digitalen Schnittstellen."
},
{
"code": "E_COMMERCE_RL",
@@ -837,11 +838,13 @@
"industries": [
"handel",
"konsumgueter",
"elektrotechnik"
"elektrotechnik",
"automotive"
],
"in_rag": true,
"rag_collection": "bp_compliance_gesetze",
"sort_order": 7
"sort_order": 7,
"applicability_note": "Sektorspezifisch: Handel, Konsumgueter, Elektrotechnik, Automotive. Deutsches Umsetzungsgesetz des EAA — betrifft Produkte mit digitalen Interfaces."
},
{
"code": "DE_BGB_AGB",
@@ -1767,13 +1770,12 @@
"full_name": "BSI Standard 200-4 Business Continuity Management",
"doc_type": "bsi_standard",
"industries": [
"energie",
"transport",
"chemie"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_gesetze",
"sort_order": 1
"sort_order": 1,
"applicability_note": "Gilt fuer alle Branchen. Business Continuity Management ist fuer jedes produzierende Unternehmen relevant."
},
{
"code": "BSI-TR-03161-1",
@@ -1781,14 +1783,12 @@
"full_name": "BSI TR-03161 Teil 1 — Sicherheitsanforderungen DiGA — Mobile Anwendungen",
"doc_type": "bsi_standard",
"description": "Deutsche Technische Richtlinie fuer die Sicherheit mobiler Gesundheits-Apps (DiGA). Definiert Pruefverfahren und Sicherheitsanforderungen fuer die DiGA-Zulassung.",
"industries": [
"elektrotechnik"
],
"industries": [],
"in_rag": true,
"rag_collection": "bp_compliance_gesetze",
"effective_date": "Version 1.0: 2020",
"sort_order": 2,
"applicability_note": "Sektorspezifisch: Elektrotechnik. Sicherheitsanforderungen fuer mobile Anwendungen anwendbar auf App-Entwicklung in der Digitalindustrie."
"applicability_note": "Nicht zutreffend fuer produzierende Industrie. Spezifisch fuer Digitale Gesundheitsanwendungen (DiGA)."
},
{
"code": "BSI-TR-03161-2",
@@ -1796,14 +1796,12 @@
"full_name": "BSI TR-03161 Teil 2 — Sicherheitsanforderungen DiGA — Web-Anwendungen",
"doc_type": "bsi_standard",
"description": "Technische Richtlinie fuer die Sicherheit von Web-Anwendungen im Gesundheitswesen.",
"industries": [
"elektrotechnik"
],
"industries": [],
"in_rag": true,
"rag_collection": "bp_compliance_gesetze",
"effective_date": "Version 1.0: 2020",
"sort_order": 3,
"applicability_note": "Sektorspezifisch: Elektrotechnik. Sicherheitsanforderungen fuer Web-Anwendungen anwendbar auf die Digitalindustrie."
"applicability_note": "Nicht zutreffend fuer produzierende Industrie. Spezifisch fuer Digitale Gesundheitsanwendungen (DiGA)."
},
{
"code": "BSI-TR-03161-3",
@@ -1811,14 +1809,12 @@
"full_name": "BSI TR-03161 Teil 3 — Sicherheitsanforderungen DiGA — Hintergrundsysteme",
"doc_type": "bsi_standard",
"description": "Technische Richtlinie fuer Backend-Systeme von Gesundheitsanwendungen. Deckt Server, APIs, Datenbanken und Cloud-Infrastruktur ab.",
"industries": [
"elektrotechnik"
],
"industries": [],
"in_rag": true,
"rag_collection": "bp_compliance_gesetze",
"effective_date": "Version 1.0: 2020",
"sort_order": 4,
"applicability_note": "Sektorspezifisch: Elektrotechnik. Sicherheitsanforderungen fuer Backend-Systeme anwendbar auf die Digitalindustrie."
"applicability_note": "Nicht zutreffend fuer produzierende Industrie. Spezifisch fuer Digitale Gesundheitsanwendungen (DiGA)."
},
{
"code": "EDPB_ACCESS_01_2022",
@@ -3525,15 +3521,13 @@
"doc_type": "nist_standard",
"description": "NIST-Framework fuer sichere Softwareentwicklung. Definiert Praktiken und Aufgaben in vier Gruppen: Prepare, Protect, Produce, Respond.",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"effective_date": "3. Februar 2022",
"sort_order": 3,
"applicability_note": "Sektorspezifisch: Automotive, Maschinenbau, Elektrotechnik. Framework fuer sichere Softwareentwicklung relevant fuer Unternehmen mit Software-Produkten."
"applicability_note": "Gilt fuer alle Branchen. Jedes Unternehmen das Software entwickelt — ob Maschinensteuerung, Fahrzeug-Firmware oder Kunden-Portal."
},
{
"code": "NISTIR_8259A",
@@ -3541,13 +3535,12 @@
"full_name": "NISTIR 8259A — IoT Device Cybersecurity Capability Core Baseline",
"doc_type": "nist_standard",
"industries": [
"elektrotechnik",
"maschinenbau",
"automotive"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
"sort_order": 4
"sort_order": 4,
"applicability_note": "Gilt fuer alle Branchen. IoT-Sicherheitsbaseline fuer jeden Hersteller vernetzter Geraete."
},
{
"code": "NIST_AI_RMF",
@@ -3603,13 +3596,17 @@
"full_name": "NIST SP 800-82 Rev. 3 — Guide to OT Security",
"doc_type": "nist_standard",
"industries": [
"energie",
"maschinenbau",
"chemie"
"automotive",
"elektrotechnik",
"chemie",
"energie",
"metall"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 9
"sort_order": 9,
"applicability_note": "Sektorspezifisch: Branchen mit Operational Technology (OT) — Maschinenbau, Automotive, Elektrotechnik, Chemie, Energie, Metall."
},
{
"code": "NIST_SP_800_160",
@@ -3629,13 +3626,12 @@
"full_name": "NIST SP 800-207 — Zero Trust Architecture",
"doc_type": "nist_standard",
"industries": [
"energie",
"maschinenbau",
"chemie"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
"sort_order": 11
"sort_order": 11,
"applicability_note": "Gilt fuer alle Branchen. Zero-Trust-Architektur als Sicherheitskonzept fuer alle Unternehmensnetzwerke."
},
{
"code": "OWASP_TOP10_2021",
@@ -3643,13 +3639,12 @@
"full_name": "OWASP Top 10 (2021)",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
"sort_order": 1
"sort_order": 1,
"applicability_note": "Gilt fuer alle Branchen. Jedes Unternehmen das Webanwendungen oder SaaS-Produkte betreibt muss die OWASP Top 10 beachten."
},
{
"code": "OWASP_API_SECURITY_2023",
@@ -3657,9 +3652,7 @@
"full_name": "OWASP API Security Top 10 (2023)",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
@@ -3671,9 +3664,7 @@
"full_name": "OWASP Application Security Verification Standard (ASVS)",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
@@ -3685,9 +3676,7 @@
"full_name": "OWASP Mobile Application Security Verification Standard (MASVS)",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
@@ -3699,9 +3688,7 @@
"full_name": "OWASP Mobile Top 10",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
@@ -3713,9 +3700,7 @@
"full_name": "OWASP Software Assurance Maturity Model (SAMM)",
"doc_type": "owasp_standard",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_datenschutz",
@@ -3727,13 +3712,12 @@
"full_name": "CISA Secure by Design — Principles and Approaches",
"doc_type": "enisa_guidance",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 1
"sort_order": 1,
"applicability_note": "Gilt fuer alle Branchen. Secure-by-Design-Prinzipien betreffen jeden Hersteller von Produkten mit digitalen Elementen."
},
{
"code": "ENISA_ICS_SCADA",
@@ -3741,14 +3725,17 @@
"full_name": "ENISA ICS/SCADA Kommunikationsnetzwerk-Abhaengigkeiten",
"doc_type": "enisa_guidance",
"industries": [
"energie",
"transport",
"maschinenbau",
"elektrotechnik"
"elektrotechnik",
"automotive",
"chemie",
"energie",
"transport"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 2
"sort_order": 2,
"applicability_note": "Sektorspezifisch: Alle Branchen mit industrieller Steuerungstechnik — Maschinenbau, Elektrotechnik, Automotive, Chemie, Energie, Transport."
},
{
"code": "ENISA_SUPPLY_CHAIN",
@@ -3757,16 +3744,13 @@
"doc_type": "enisa_guidance",
"description": "ENISA-Analyse der Bedrohungslandschaft fuer Supply-Chain-Angriffe. Beschreibt Angriffsvektoren, Taxonomie und Empfehlungen zur Absicherung von Software-Lieferketten.",
"industries": [
"energie",
"transport",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"effective_date": "2021",
"sort_order": 3,
"applicability_note": "Sektorspezifisch: Energie, Transport, Maschinenbau, Elektrotechnik. ENISA-Empfehlungen zur Absicherung von Software-Lieferketten."
"applicability_note": "Gilt fuer alle Branchen. Lieferkettensicherheit ist im Rahmen von CRA und NIS2 fuer alle Hersteller relevant."
},
{
"code": "ENISA_THREAT_LANDSCAPE",
@@ -3774,10 +3758,7 @@
"full_name": "ENISA Threat Landscape fuer Supply Chain Attacks",
"doc_type": "enisa_guidance",
"industries": [
"energie",
"transport",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
@@ -3789,10 +3770,7 @@
"full_name": "ENISA Bericht zum Stand der Cybersicherheit in der EU 2024",
"doc_type": "enisa_guidance",
"industries": [
"energie",
"transport",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
@@ -3804,13 +3782,12 @@
"full_name": "CVSS v4.0 — Common Vulnerability Scoring System",
"doc_type": "international",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 1
"sort_order": 1,
"applicability_note": "Gilt fuer alle Branchen. Schwachstellenbewertung ist Pflicht im Rahmen des CRA fuer alle Hersteller vernetzter Produkte."
},
{
"code": "CYCLONEDX_1_6",
@@ -3818,13 +3795,12 @@
"full_name": "CycloneDX 1.6 — SBOM Standard (ECMA-424)",
"doc_type": "international",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 2
"sort_order": 2,
"applicability_note": "Gilt fuer alle Branchen. SBOM-Standard — der CRA verlangt von allen Herstellern eine Software-Stueckliste."
},
{
"code": "FDA_HFE",
@@ -3858,8 +3834,7 @@
"full_name": "OpenTelemetry Specification — Observability Framework",
"doc_type": "international",
"industries": [
"elektrotechnik",
"automotive"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
@@ -3871,13 +3846,12 @@
"full_name": "SLSA v1.0 — Supply-chain Levels for Software Artifacts",
"doc_type": "international",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 6
"sort_order": 6,
"applicability_note": "Gilt fuer alle Branchen. Supply-Chain-Integritaet fuer alle Unternehmen die Software bauen und ausliefern."
},
{
"code": "SPDX_3",
@@ -3885,13 +3859,12 @@
"full_name": "SPDX 3.0.1 — Software Package Data Exchange",
"doc_type": "international",
"industries": [
"automotive",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"sort_order": 7
"sort_order": 7,
"applicability_note": "Gilt fuer alle Branchen. SBOM-Standard fuer Software-Lizenz- und Abhaengigkeitsdokumentation."
},
{
"code": "BFDI_VVT",
@@ -4347,16 +4320,13 @@
"doc_type": "enisa_guidance",
"description": "ENISA-Leitfaden fuer sichere Softwareentwicklung. Beschreibt Best Practices fuer Security by Design, sichere Entwicklungsprozesse und Schwachstellenmanagement.",
"industries": [
"energie",
"transport",
"maschinenbau",
"elektrotechnik"
"all"
],
"in_rag": true,
"rag_collection": "bp_compliance_ce",
"effective_date": "2023",
"sort_order": 6,
"applicability_note": "Sektorspezifisch: Energie, Transport, Maschinenbau, Elektrotechnik. ENISA-Leitfaden fuer sichere Softwareentwicklung."
"applicability_note": "Gilt fuer alle Branchen. Sichere Softwareentwicklung betrifft jeden Hersteller digitaler Produkte."
}
]
}
@@ -0,0 +1,204 @@
# RAG Landkarte — Branchen-Regulierungs-Matrix
## Uebersicht
Die RAG Landkarte zeigt eine interaktive Matrix aller 320 Compliance-Dokumente im RAG-System, gruppiert nach Dokumenttyp und zugeordnet zu 10 Industriebranchen.
**URL**: `https://macmini:3002/ai/rag` → Tab "Landkarte"
**Letzte Aktualisierung**: 2026-04-15
## Architektur
```
rag-documents.json ← Zentrale Datendatei (320 Dokumente)
├── doc_types[] ← 17 Dokumenttypen (EU-VO, DE-Gesetz, etc.)
├── industries[] ← 10 Branchen (VDMA/VDA/BDI)
└── documents[] ← Alle Dokumente mit Branchen-Mapping
├── code ← Eindeutiger Identifier
├── name ← Anzeigename
├── doc_type ← Verweis auf doc_types.id
├── industries[] ← ["all"] oder ["automotive", "chemie", ...]
├── in_rag ← true (alle im RAG)
├── rag_collection ← Qdrant Collection Name
├── description? ← Beschreibung (fuer ~100 Hauptregulierungen)
├── applicability_note? ← Begruendung der Branchenzuordnung
└── effective_date? ← Gueltigkeitsdatum
rag-constants.ts ← RAG-Metadaten (Chunks, Qdrant-IDs)
page.tsx ← Frontend (importiert aus JSON)
```
## Dateien
| Pfad | Beschreibung |
|------|--------------|
| `admin-lehrer/app/(admin)/ai/rag/rag-documents.json` | Alle 320 Dokumente mit Branchen-Mapping |
| `admin-lehrer/app/(admin)/ai/rag/rag-constants.ts` | REGULATIONS_IN_RAG (Chunk-Counts, Qdrant-IDs) |
| `admin-lehrer/app/(admin)/ai/rag/page.tsx` | Frontend-Rendering |
| `admin-lehrer/app/(admin)/ai/rag/__tests__/rag-documents.test.ts` | 44 Tests fuer JSON-Validierung |
## Branchen (10 Industriesektoren)
Die Branchen orientieren sich an den Mitgliedsverbaenden von VDMA, VDA und BDI:
| ID | Branche | Icon | Typische Kunden |
|----|---------|------|-----------------|
| `automotive` | Automobilindustrie | 🚗 | OEMs, Tier-1/2 Zulieferer |
| `maschinenbau` | Maschinen- & Anlagenbau | ⚙️ | Werkzeugmaschinen, Automatisierung |
| `elektrotechnik` | Elektro- & Digitalindustrie | ⚡ | Embedded Systems, Steuerungstechnik |
| `chemie` | Chemie- & Prozessindustrie | 🧪 | Grundstoffchemie, Spezialchemie |
| `metall` | Metallindustrie | 🔩 | Stahl, Aluminium, Metallverarbeitung |
| `energie` | Energie & Versorgung | 🔋 | Energieerzeugung, Netzbetreiber |
| `transport` | Transport & Logistik | 🚚 | Gueterverkehr, Schiene, Luftfahrt |
| `handel` | Handel | 🏪 | Einzel-/Grosshandel, E-Commerce |
| `konsumgueter` | Konsumgueter & Lebensmittel | 📦 | FMCG, Lebensmittel, Verpackung |
| `bau` | Bauwirtschaft | 🏗️ | Hoch-/Tiefbau, Gebaeudeautomation |
!!! warning "Keine Pseudo-Branchen"
Es werden bewusst **keine** Querschnittsthemen wie IoT, KI, HR, KRITIS oder E-Commerce als "Branchen" gefuehrt. Diese sind Technologien, Abteilungen oder Klassifizierungen — keine Wirtschaftssektoren.
## Zuordnungslogik
### Drei Ebenen
| Ebene | `industries` Wert | Anzahl | Beispiele |
|-------|-------------------|--------|-----------|
| **Horizontal** | `["all"]` | 264 | DSGVO, AI Act, CRA, NIS2, BetrVG |
| **Sektorspezifisch** | `["automotive", "chemie", ...]` | 42 | Maschinenverordnung, ElektroG, BattDG |
| **Nicht zutreffend** | `[]` | 14 | DORA, MiCA, EHDS, DSA |
### Horizontal (alle Branchen)
Regulierungen die **branchenuebergreifend** gelten:
- **Datenschutz**: DSGVO, BDSG, ePrivacy, TDDDG, SCC, DPF
- **KI**: AI Act (jedes Unternehmen das KI einsetzt)
- **Cybersecurity**: CRA (jedes Produkt mit digitalen Elementen), NIS2, EUCSA
- **Produktsicherheit**: GPSR, Produkthaftungs-RL
- **Arbeitsrecht**: BetrVG, AGG, KSchG, ArbSchG, LkSG
- **Handels-/Steuerrecht**: HGB, AO, UStG
- **Software-Security**: OWASP Top 10, NIST SSDF, CISA Secure by Design
- **Supply Chain**: CycloneDX, SPDX, SLSA (CRA verlangt SBOM)
- **Alle Leitlinien**: EDPB, DSK, DSFA-Listen, Gerichtsurteile
### Sektorspezifisch
| Regulierung | Branchen | Begruendung |
|-------------|----------|-------------|
| Maschinenverordnung | Maschinenbau, Automotive, Elektrotechnik, Metall, Bau | Hersteller von Maschinen und zugehoerigen Produkten |
| ElektroG | Elektrotechnik, Automotive, Konsumgueter | Elektro-/Elektronikgeraete |
| BattDG/BattVO | Automotive, Elektrotechnik, Energie | Batterien und Akkumulatoren |
| VerpackG | Konsumgueter, Handel, Chemie | Verpackungspflichtige Produkte |
| PAngV, UWG, VSBG | Handel, Konsumgueter | Verbraucherschutz im Verkauf |
| BSI-KritisV, KRITIS-Dachgesetz | Energie, Transport, Chemie | KRITIS-Sektoren |
| ENISA ICS/SCADA | Maschinenbau, Elektrotechnik, Automotive, Chemie, Energie, Transport | Industrielle Steuerungstechnik |
| NIST SP 800-82 (OT) | Maschinenbau, Automotive, Elektrotechnik, Chemie, Energie, Metall | Operational Technology |
### Nicht zutreffend
Dokumente die **im RAG bleiben** aber fuer keine der 10 Zielbranchen relevant sind:
| Code | Name | Grund |
|------|------|-------|
| DORA | Digital Operational Resilience Act | Finanzsektor |
| PSD2 | Zahlungsdiensterichtlinie | Zahlungsdienstleister |
| MiCA | Markets in Crypto-Assets | Krypto-Maerkte |
| AMLR | AML-Verordnung | Geldwaesche-Bekaempfung |
| EHDS | Europaeischer Gesundheitsdatenraum | Gesundheitswesen |
| DSA | Digital Services Act | Online-Plattformen |
| DMA | Digital Markets Act | Gatekeeper-Plattformen |
| MDR | Medizinprodukteverordnung | Medizintechnik |
| BSI-TR-03161 | DiGA-Sicherheit (3 Teile) | Digitale Gesundheitsanwendungen |
## Dokumenttypen (17)
| doc_type | Label | Anzahl | Beispiele |
|----------|-------|--------|-----------|
| `eu_regulation` | EU-Verordnungen | 22 | DSGVO, AI Act, CRA, DORA |
| `eu_directive` | EU-Richtlinien | 14 | ePrivacy, NIS2, PSD2 |
| `eu_guidance` | EU-Leitfaeden | 9 | Blue Guide, GPAI CoP |
| `de_law` | Deutsche Gesetze | 41 | BDSG, BGB, HGB, BetrVG |
| `at_law` | Oesterreichische Gesetze | 11 | DSG AT, ECG, KSchG |
| `ch_law` | Schweizer Gesetze | 8 | revDSG, DSV, OR |
| `national_law` | Nationale Datenschutzgesetze | 17 | UK DPA, LOPDGDD, UAVG |
| `bsi_standard` | BSI Standards & TR | 4 | BSI 200-4, BSI-TR-03161 |
| `edpb_guideline` | EDPB/WP29 Leitlinien | 50 | Consent, Controller/Processor |
| `dsk_guidance` | DSK Orientierungshilfen | 57 | Kurzpapiere, OH Telemedien |
| `court_decision` | Gerichtsurteile | 20 | BAG M365, BGH Planet49 |
| `dsfa_list` | DSFA Muss-Listen | 20 | Pro Bundesland + DSK |
| `nist_standard` | NIST Standards | 11 | CSF 2.0, SSDF, AI RMF |
| `owasp_standard` | OWASP Standards | 6 | Top 10, ASVS, API Security |
| `enisa_guidance` | ENISA Guidance | 6 | Supply Chain, ICS/SCADA |
| `international` | Internationale Standards | 7 | CVSS, CycloneDX, SPDX |
| `legal_template` | Vorlagen & Muster | 17 | GitHub Policies, VVT-Muster |
## Integration in andere Projekte
### JSON importieren
```typescript
import ragData from './rag-documents.json'
const documents = ragData.documents // 320 Dokumente
const docTypes = ragData.doc_types // 17 Kategorien
const industries = ragData.industries // 10 Branchen
```
### Matrix-Logik
```typescript
// Pruefen ob Dokument fuer Branche gilt
const applies = (doc, industryId) =>
doc.industries.includes(industryId) || doc.industries.includes('all')
// Dokumente nach Typ gruppieren
const grouped = Object.groupBy(documents, d => d.doc_type)
// Nur sektorspezifische Dokumente fuer eine Branche
const forAutomotive = documents.filter(d =>
d.industries.includes('automotive') && !d.industries.includes('all')
)
```
### RAG-Status pruefen
```typescript
import { REGULATIONS_IN_RAG } from './rag-constants'
const isInRag = (code: string) => code in REGULATIONS_IN_RAG
const chunks = REGULATIONS_IN_RAG['GDPR']?.chunks // 423
```
## Datenquellen
| Quelle | Pfad | Beschreibung |
|--------|------|--------------|
| RAG-Inventar | `~/Desktop/RAG-Dokumenten-Inventar.md` | 386 Quelldateien |
| rag-documents.json | `admin-lehrer/.../rag/rag-documents.json` | 320 konsolidierte Dokumente |
| rag-constants.ts | `admin-lehrer/.../rag/rag-constants.ts` | Qdrant-Metadaten |
## Tests
```bash
cd admin-lehrer
npx vitest run app/\(admin\)/ai/rag/__tests__/rag-documents.test.ts
```
44 Tests validieren:
- JSON-Struktur (doc_types, industries, documents)
- 10 echte Branchen (keine Pseudo-Branchen)
- Pflichtfelder und gueltige Referenzen
- Horizontale Regulierungen (DSGVO, AI Act, CRA → "all")
- Sektorspezifische Zuordnungen (Maschinenverordnung, ElektroG)
- Nicht zutreffende Regulierungen (DORA, MiCA → leer)
- Applicability Notes vorhanden und korrekt
## Aenderungshistorie
| Datum | Aenderung |
|-------|-----------|
| 2026-04-15 | Initiale Implementierung: 320 Dokumente, 10 Branchen, 17 Typen |
| 2026-04-15 | Branchen-Review: OWASP/SBOM → alle, BSI-TR-03161 → leer |
| 2026-04-15 | Applicability Notes UI: Aufklappbare Erklaerungen pro Dokument |
@@ -1112,6 +1112,13 @@ async def _build_grid_core(
# Has real IPA symbols → already fixed or valid
if any(c in _REAL_IPA_CHARS for c in cell_text):
continue
# Guard: if text contains multiple real words, it's
# normal text (e.g. "Betonung auf der 1. Silbe:
# profit"), not garbled IPA. Garbled IPA is
# typically short and has no recognizable words.
_words_in_text = re.findall(r'[A-Za-zÄÖÜäöüß]{3,}', cell_text)
if len(_words_in_text) >= 3:
continue
# Find headword in previous row, same column
prev_ri = rows_sorted[idx - 1]["index"]
+1
View File
@@ -77,6 +77,7 @@ nav:
- RAG Admin: services/klausur-service/RAG-Admin-Spec.md
- Worksheet Editor: services/klausur-service/Worksheet-Editor-Architecture.md
- Chunk-Browser: services/klausur-service/Chunk-Browser.md
- RAG Landkarte: services/klausur-service/RAG-Landkarte.md
- Voice-Service:
- Uebersicht: services/voice-service/index.md
- Agent-Core: