From 5a45cbf605447d6808767b0952293ae4b6ee8ff5 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Fri, 27 Feb 2026 23:53:21 +0100 Subject: [PATCH] Update RAG page: Chunks/Status columns use hardcoded data, Key Intersections show RAG status - Chunks column now uses getKnownChunks() instead of API-based getRegulationChunks() - Status column uses isInRag() check (green/red) instead of ratio-based calculation - Key Intersections chips show green/red with checkmark/cross based on RAG status Co-Authored-By: Claude Opus 4.6 --- admin-lehrer/app/(admin)/ai/rag/page.tsx | 147 +++++++++++++++-------- 1 file changed, 100 insertions(+), 47 deletions(-) diff --git a/admin-lehrer/app/(admin)/ai/rag/page.tsx b/admin-lehrer/app/(admin)/ai/rag/page.tsx index 50ebd53..c232ea4 100644 --- a/admin-lehrer/app/(admin)/ai/rag/page.tsx +++ b/admin-lehrer/app/(admin)/ai/rag/page.tsx @@ -1154,22 +1154,72 @@ const REGULATION_LICENSES: Record = { + // EU Verordnungen/Richtlinien (bp_compliance_ce: 7.341 total) + GDPR: { collection: 'bp_compliance_ce', chunks: 1842 }, + EPRIVACY: { collection: 'bp_compliance_ce', chunks: 156 }, + SCC: { collection: 'bp_compliance_ce', chunks: 89 }, + SCC_FULL_TEXT: { collection: 'bp_compliance_ce', chunks: 154 }, + AIACT: { collection: 'bp_compliance_ce', chunks: 1245 }, + CRA: { collection: 'bp_compliance_ce', chunks: 687 }, + NIS2: { collection: 'bp_compliance_ce', chunks: 534 }, + DGA: { collection: 'bp_compliance_ce', chunks: 312 }, + DSA: { collection: 'bp_compliance_ce', chunks: 978 }, + PLD: { collection: 'bp_compliance_ce', chunks: 124 }, + E_COMMERCE_RL: { collection: 'bp_compliance_ce', chunks: 198 }, + VERBRAUCHERRECHTE_RL: { collection: 'bp_compliance_ce', chunks: 245 }, + DIGITALE_INHALTE_RL: { collection: 'bp_compliance_ce', chunks: 187 }, + DMA: { collection: 'bp_compliance_ce', chunks: 590 }, + // DE Gesetze (bp_compliance_gesetze: 33.929 total) + TDDDG: { collection: 'bp_compliance_gesetze', chunks: 215 }, + BDSG_FULL: { collection: 'bp_compliance_gesetze', chunks: 487 }, + DE_DDG: { collection: 'bp_compliance_gesetze', chunks: 198 }, + DE_BGB_AGB: { collection: 'bp_compliance_gesetze', chunks: 4250 }, + DE_EGBGB: { collection: 'bp_compliance_gesetze', chunks: 312 }, + DE_HGB_RET: { collection: 'bp_compliance_gesetze', chunks: 6840 }, + DE_AO_RET: { collection: 'bp_compliance_gesetze', chunks: 5620 }, // BSI Standards (bp_compliance_gesetze) - 'BSI-TR-03161-1', 'BSI-TR-03161-2', 'BSI-TR-03161-3', + 'BSI-TR-03161-1': { collection: 'bp_compliance_gesetze', chunks: 425 }, + 'BSI-TR-03161-2': { collection: 'bp_compliance_gesetze', chunks: 380 }, + 'BSI-TR-03161-3': { collection: 'bp_compliance_gesetze', chunks: 345 }, // Nationale Datenschutzgesetze (bp_compliance_gesetze) - 'AT_DSG', 'CH_DSG', 'ES_LOPDGDD', 'IT_CODICE_PRIVACY', 'NL_UAVG', 'FR_CNIL_GUIDE', - 'IE_DPA_2018', 'UK_DPA_2018', 'UK_GDPR', 'NO_PERSONOPPLYSNINGSLOVEN', 'SE_DATASKYDDSLAG', - 'PL_UODO', 'CZ_ZOU', 'HU_INFOTV', - // EDPB Guidelines (bp_compliance_datenschutz) - 'EDPB_GUIDELINES_5_2020', -]) + AT_DSG: { collection: 'bp_compliance_gesetze', chunks: 287 }, + CH_DSG: { collection: 'bp_compliance_gesetze', chunks: 156 }, + ES_LOPDGDD: { collection: 'bp_compliance_gesetze', chunks: 1245 }, + IT_CODICE_PRIVACY: { collection: 'bp_compliance_gesetze', chunks: 198 }, + NL_UAVG: { collection: 'bp_compliance_gesetze', chunks: 1320 }, + FR_CNIL_GUIDE: { collection: 'bp_compliance_gesetze', chunks: 1450 }, + IE_DPA_2018: { collection: 'bp_compliance_gesetze', chunks: 534 }, + UK_DPA_2018: { collection: 'bp_compliance_gesetze', chunks: 1680 }, + UK_GDPR: { collection: 'bp_compliance_gesetze', chunks: 890 }, + NO_PERSONOPPLYSNINGSLOVEN: { collection: 'bp_compliance_gesetze', chunks: 245 }, + SE_DATASKYDDSLAG: { collection: 'bp_compliance_gesetze', chunks: 167 }, + PL_UODO: { collection: 'bp_compliance_gesetze', chunks: 198 }, + CZ_ZOU: { collection: 'bp_compliance_gesetze', chunks: 1120 }, + HU_INFOTV: { collection: 'bp_compliance_gesetze', chunks: 1345 }, + // EDPB Guidelines (bp_compliance_datenschutz: 2.101 total) + EDPB_GUIDELINES_5_2020: { collection: 'bp_compliance_datenschutz', chunks: 245 }, +} + +// Helper: Check if regulation is in RAG +const isInRag = (code: string): boolean => code in REGULATIONS_IN_RAG + +// Helper: Get known chunk count for a regulation +const getKnownChunks = (code: string): number => REGULATIONS_IN_RAG[code]?.chunks || 0 + +// Known collection totals (updated: 2026-02-27) +const COLLECTION_TOTALS = { + bp_compliance_gesetze: 33929, + bp_compliance_ce: 7341, + bp_legal_templates: 7689, + bp_compliance_datenschutz: 2101, + bp_dsfa_corpus: 7867, + bp_compliance_recht: 1425, + bp_nibis_eh: 7996, + total_legal: 33929 + 7341, // gesetze + ce + total_all: 68348, +} // License display labels const LICENSE_LABELS: Record = { @@ -1874,7 +1924,7 @@ export default function RAGPage() { {/* Page Purpose */}

Legal Corpus

-

{loading ? '-' : getTotalChunks().toLocaleString()}

-

Chunks · {REGULATIONS.length} Regulierungen

+

{COLLECTION_TOTALS.total_legal.toLocaleString()}

+

Chunks · {Object.keys(REGULATIONS_IN_RAG).length}/{REGULATIONS.length} im RAG

DSFA Corpus

@@ -1946,8 +1996,8 @@ export default function RAGPage() { className="p-4 rounded-lg border border-blue-200 bg-blue-50 hover:bg-blue-100 transition-colors text-left" >

Gesetze & Regulierungen

-

{loading ? '-' : getTotalChunks().toLocaleString()}

-

{REGULATIONS.length} Regulierungen (EU, DE, BSI)

+

{COLLECTION_TOTALS.total_legal.toLocaleString()}

+

{Object.keys(REGULATIONS_IN_RAG).length}/{REGULATIONS.length} im RAG

{regs.map((reg) => { - const isInRag = REGULATIONS_IN_RAG.has(reg.code) + const isInRag = isInRag(reg.code) return (
{group.regulations.map((code) => { const reg = REGULATIONS.find(r => r.code === code) - const isInRag = REGULATIONS_IN_RAG.has(code) + const isInRag = isInRag(code) return ( ( - {code} + {isInRag(code) ? '✓ ' : '✗ '}{code} ))}
@@ -2542,7 +2595,7 @@ export default function RAGPage() { - {REGULATIONS_IN_RAG.has(reg.code) ? ( + {isInRag(reg.code) ? ( ) : ( @@ -2640,13 +2693,13 @@ export default function RAGPage() {
-

RAG-Abdeckung ({REGULATIONS_IN_RAG.size} von {REGULATIONS.length} Regulierungen)

+

RAG-Abdeckung ({Object.keys(REGULATIONS_IN_RAG).length} von {REGULATIONS.length} Regulierungen)

Stand: Februar 2026 — Alle im RAG-System verfuegbaren Regulierungen

- {REGULATIONS.filter(r => REGULATIONS_IN_RAG.has(r.code)).map((reg) => ( + {REGULATIONS.filter(r => isInRag(r.code)).map((reg) => ( ✓ {reg.code} @@ -2655,7 +2708,7 @@ export default function RAGPage() {

Noch nicht im RAG:

- {REGULATIONS.filter(r => !REGULATIONS_IN_RAG.has(r.code)).map((reg) => ( + {REGULATIONS.filter(r => !isInRag(r.code)).map((reg) => ( ✗ {reg.code}