Files
breakpilot-lehrer/admin-lehrer/app/(admin)/ai/rag/rag-constants.ts
Benjamin Admin 8c42fefa77 feat(rag): add QA Split-View Chunk-Browser for ingestion verification
New ChunkBrowserQA component replaces inline chunk browser with:
- Document sidebar with live chunk counts per regulation (batched Qdrant count API)
- Sequential chunk navigation with arrow keys (1/N through all chunks of a document)
- Overlap display showing previous/next chunk boundaries (amber-highlighted)
- Split-view with original PDF via iframe (estimated page from chunk index)
- Adjustable chunks-per-page ratio for PDF page estimation

Extracts REGULATIONS_IN_RAG and REGULATION_INFO to shared rag-constants.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:46:11 +01:00

223 lines
13 KiB
TypeScript

/**
* Shared RAG constants used by both page.tsx and ChunkBrowserQA.
* REGULATIONS_IN_RAG maps regulation codes to their Qdrant collection and chunk count.
* REGULATION_INFO provides minimal metadata (code, name, type) for all regulations.
*/
export const REGULATIONS_IN_RAG: Record<string, { collection: string; chunks: number }> = {
// EU Verordnungen/Richtlinien (bp_compliance_ce)
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 },
DPF: { collection: 'bp_compliance_ce', chunks: 1232 },
EUCSA: { collection: 'bp_compliance_ce', chunks: 558 },
DATAACT: { collection: 'bp_compliance_ce', chunks: 809 },
DORA: { collection: 'bp_compliance_ce', chunks: 823 },
PSD2: { collection: 'bp_compliance_ce', chunks: 796 },
AMLR: { collection: 'bp_compliance_ce', chunks: 1182 },
MiCA: { collection: 'bp_compliance_ce', chunks: 1640 },
EHDS: { collection: 'bp_compliance_ce', chunks: 1212 },
EAA: { collection: 'bp_compliance_ce', chunks: 433 },
DSM: { collection: 'bp_compliance_ce', chunks: 416 },
GPSR: { collection: 'bp_compliance_ce', chunks: 509 },
MACHINERY_REG: { collection: 'bp_compliance_ce', chunks: 0 },
BLUE_GUIDE: { collection: 'bp_compliance_ce', chunks: 0 },
EU_IFRS_DE: { collection: 'bp_compliance_ce', chunks: 0 },
EU_IFRS_EN: { collection: 'bp_compliance_ce', chunks: 0 },
// DE Gesetze (bp_compliance_gesetze)
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 },
DE_UWG: { collection: 'bp_compliance_gesetze', chunks: 1 },
DE_TKG: { collection: 'bp_compliance_gesetze', chunks: 1631 },
DE_PANGV: { collection: 'bp_compliance_gesetze', chunks: 1 },
DE_DLINFOV: { collection: 'bp_compliance_gesetze', chunks: 21 },
DE_BETRVG: { collection: 'bp_compliance_gesetze', chunks: 498 },
DE_GESCHGEHG: { collection: 'bp_compliance_gesetze', chunks: 63 },
DE_BSIG: { collection: 'bp_compliance_gesetze', chunks: 1 },
DE_USTG_RET: { collection: 'bp_compliance_gesetze', chunks: 1071 },
// BSI Standards (bp_compliance_gesetze)
'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 },
// AT Gesetze (bp_compliance_gesetze)
AT_DSG: { collection: 'bp_compliance_gesetze', chunks: 287 },
AT_DSG_FULL: { collection: 'bp_compliance_gesetze', chunks: 6 },
AT_ECG: { collection: 'bp_compliance_gesetze', chunks: 120 },
AT_TKG: { collection: 'bp_compliance_gesetze', chunks: 2174 },
AT_KSCHG: { collection: 'bp_compliance_gesetze', chunks: 402 },
AT_FAGG: { collection: 'bp_compliance_gesetze', chunks: 2 },
AT_UGB_RET: { collection: 'bp_compliance_gesetze', chunks: 2828 },
AT_BAO_RET: { collection: 'bp_compliance_gesetze', chunks: 2246 },
AT_MEDIENG: { collection: 'bp_compliance_gesetze', chunks: 571 },
AT_ABGB_AGB: { collection: 'bp_compliance_gesetze', chunks: 2521 },
AT_UWG: { collection: 'bp_compliance_gesetze', chunks: 403 },
// CH Gesetze (bp_compliance_gesetze)
CH_DSG: { collection: 'bp_compliance_gesetze', chunks: 156 },
CH_DSV: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_OR_AGB: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_UWG: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_FMG: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_GEBUV: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_ZERTES: { collection: 'bp_compliance_gesetze', chunks: 5 },
CH_ZGB_PERS: { collection: 'bp_compliance_gesetze', chunks: 5 },
// LI
LI_DSG: { collection: 'bp_compliance_gesetze', chunks: 2 },
// Nationale DSG (andere EU)
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 },
BE_DPA_LAW: { collection: 'bp_compliance_gesetze', chunks: 3 },
FI_TIETOSUOJALAKI: { collection: 'bp_compliance_gesetze', chunks: 2 },
DK_DATABESKYTTELSESLOVEN: { collection: 'bp_compliance_gesetze', chunks: 2 },
LU_DPA_LAW: { collection: 'bp_compliance_gesetze', chunks: 2 },
// EDPB Guidelines (bp_compliance_datenschutz)
EDPB_GUIDELINES_5_2020: { collection: 'bp_compliance_datenschutz', chunks: 245 },
EDPB_GUIDELINES_7_2020: { collection: 'bp_compliance_datenschutz', chunks: 347 },
// Frameworks (bp_compliance_datenschutz)
ENISA_SECURE_BY_DESIGN: { collection: 'bp_compliance_datenschutz', chunks: 0 },
ENISA_SUPPLY_CHAIN: { collection: 'bp_compliance_datenschutz', chunks: 0 },
NIST_SSDF: { collection: 'bp_compliance_datenschutz', chunks: 0 },
NIST_CSF_2: { collection: 'bp_compliance_datenschutz', chunks: 0 },
OECD_AI_PRINCIPLES: { collection: 'bp_compliance_datenschutz', chunks: 0 },
EFRAG_ENDORSEMENT: { collection: 'bp_compliance_datenschutz', chunks: 0 },
}
/**
* Minimal regulation info for sidebar display.
* Full REGULATIONS array with descriptions remains in page.tsx.
*/
export interface RegulationInfo {
code: string
name: string
type: string
}
export const REGULATION_INFO: RegulationInfo[] = [
// EU Verordnungen
{ code: 'GDPR', name: 'DSGVO', type: 'eu_regulation' },
{ code: 'EPRIVACY', name: 'ePrivacy-Richtlinie', type: 'eu_directive' },
{ code: 'SCC', name: 'Standardvertragsklauseln', type: 'eu_regulation' },
{ code: 'SCC_FULL_TEXT', name: 'SCC Volltext', type: 'eu_regulation' },
{ code: 'DPF', name: 'EU-US Data Privacy Framework', type: 'eu_regulation' },
{ code: 'AIACT', name: 'EU AI Act', type: 'eu_regulation' },
{ code: 'CRA', name: 'Cyber Resilience Act', type: 'eu_regulation' },
{ code: 'NIS2', name: 'NIS2-Richtlinie', type: 'eu_directive' },
{ code: 'EUCSA', name: 'EU Cybersecurity Act', type: 'eu_regulation' },
{ code: 'DATAACT', name: 'Data Act', type: 'eu_regulation' },
{ code: 'DGA', name: 'Data Governance Act', type: 'eu_regulation' },
{ code: 'DSA', name: 'Digital Services Act', type: 'eu_regulation' },
{ code: 'DMA', name: 'Digital Markets Act', type: 'eu_regulation' },
{ code: 'EAA', name: 'European Accessibility Act', type: 'eu_directive' },
{ code: 'DSM', name: 'DSM-Urheberrechtsrichtlinie', type: 'eu_directive' },
{ code: 'PLD', name: 'Produkthaftungsrichtlinie', type: 'eu_directive' },
{ code: 'GPSR', name: 'General Product Safety', type: 'eu_regulation' },
{ code: 'E_COMMERCE_RL', name: 'E-Commerce-Richtlinie', type: 'eu_directive' },
{ code: 'VERBRAUCHERRECHTE_RL', name: 'Verbraucherrechte-RL', type: 'eu_directive' },
{ code: 'DIGITALE_INHALTE_RL', name: 'Digitale-Inhalte-RL', type: 'eu_directive' },
// Financial
{ code: 'DORA', name: 'DORA', type: 'eu_regulation' },
{ code: 'PSD2', name: 'PSD2', type: 'eu_directive' },
{ code: 'AMLR', name: 'AML-Verordnung', type: 'eu_regulation' },
{ code: 'MiCA', name: 'MiCA', type: 'eu_regulation' },
{ code: 'EHDS', name: 'EHDS', type: 'eu_regulation' },
{ code: 'MACHINERY_REG', name: 'Maschinenverordnung', type: 'eu_regulation' },
{ code: 'BLUE_GUIDE', name: 'Blue Guide', type: 'eu_regulation' },
{ code: 'EU_IFRS_DE', name: 'EU-IFRS (DE)', type: 'eu_regulation' },
{ code: 'EU_IFRS_EN', name: 'EU-IFRS (EN)', type: 'eu_regulation' },
// DE Gesetze
{ code: 'TDDDG', name: 'TDDDG', type: 'de_law' },
{ code: 'BDSG_FULL', name: 'BDSG', type: 'de_law' },
{ code: 'DE_DDG', name: 'DDG', type: 'de_law' },
{ code: 'DE_BGB_AGB', name: 'BGB/AGB', type: 'de_law' },
{ code: 'DE_EGBGB', name: 'EGBGB', type: 'de_law' },
{ code: 'DE_HGB_RET', name: 'HGB', type: 'de_law' },
{ code: 'DE_AO_RET', name: 'AO', type: 'de_law' },
{ code: 'DE_UWG', name: 'UWG', type: 'de_law' },
{ code: 'DE_TKG', name: 'TKG', type: 'de_law' },
{ code: 'DE_PANGV', name: 'PAngV', type: 'de_law' },
{ code: 'DE_DLINFOV', name: 'DL-InfoV', type: 'de_law' },
{ code: 'DE_BETRVG', name: 'BetrVG', type: 'de_law' },
{ code: 'DE_GESCHGEHG', name: 'GeschGehG', type: 'de_law' },
{ code: 'DE_BSIG', name: 'BSIG', type: 'de_law' },
{ code: 'DE_USTG_RET', name: 'UStG', type: 'de_law' },
// BSI
{ code: 'BSI-TR-03161-1', name: 'BSI-TR Teil 1', type: 'bsi_standard' },
{ code: 'BSI-TR-03161-2', name: 'BSI-TR Teil 2', type: 'bsi_standard' },
{ code: 'BSI-TR-03161-3', name: 'BSI-TR Teil 3', type: 'bsi_standard' },
// AT
{ code: 'AT_DSG', name: 'DSG Oesterreich', type: 'at_law' },
{ code: 'AT_DSG_FULL', name: 'DSG Volltext', type: 'at_law' },
{ code: 'AT_ECG', name: 'ECG', type: 'at_law' },
{ code: 'AT_TKG', name: 'TKG AT', type: 'at_law' },
{ code: 'AT_KSCHG', name: 'KSchG', type: 'at_law' },
{ code: 'AT_FAGG', name: 'FAGG', type: 'at_law' },
{ code: 'AT_UGB_RET', name: 'UGB', type: 'at_law' },
{ code: 'AT_BAO_RET', name: 'BAO', type: 'at_law' },
{ code: 'AT_MEDIENG', name: 'MedienG', type: 'at_law' },
{ code: 'AT_ABGB_AGB', name: 'ABGB/AGB', type: 'at_law' },
{ code: 'AT_UWG', name: 'UWG AT', type: 'at_law' },
// CH
{ code: 'CH_DSG', name: 'DSG Schweiz', type: 'ch_law' },
{ code: 'CH_DSV', name: 'DSV', type: 'ch_law' },
{ code: 'CH_OR_AGB', name: 'OR/AGB', type: 'ch_law' },
{ code: 'CH_UWG', name: 'UWG CH', type: 'ch_law' },
{ code: 'CH_FMG', name: 'FMG', type: 'ch_law' },
{ code: 'CH_GEBUV', name: 'GeBuV', type: 'ch_law' },
{ code: 'CH_ZERTES', name: 'ZertES', type: 'ch_law' },
{ code: 'CH_ZGB_PERS', name: 'ZGB', type: 'ch_law' },
// LI
{ code: 'LI_DSG', name: 'DSG Liechtenstein', type: 'national_law' },
// Andere EU nationale
{ code: 'ES_LOPDGDD', name: 'LOPDGDD Spanien', type: 'national_law' },
{ code: 'IT_CODICE_PRIVACY', name: 'Codice Privacy Italien', type: 'national_law' },
{ code: 'NL_UAVG', name: 'UAVG Niederlande', type: 'national_law' },
{ code: 'FR_CNIL_GUIDE', name: 'CNIL Guide RGPD', type: 'national_law' },
{ code: 'IE_DPA_2018', name: 'DPA 2018 Ireland', type: 'national_law' },
{ code: 'UK_DPA_2018', name: 'DPA 2018 UK', type: 'national_law' },
{ code: 'UK_GDPR', name: 'UK GDPR', type: 'national_law' },
{ code: 'NO_PERSONOPPLYSNINGSLOVEN', name: 'Personopplysningsloven', type: 'national_law' },
{ code: 'SE_DATASKYDDSLAG', name: 'Dataskyddslag Schweden', type: 'national_law' },
{ code: 'PL_UODO', name: 'UODO Polen', type: 'national_law' },
{ code: 'CZ_ZOU', name: 'Zakon Tschechien', type: 'national_law' },
{ code: 'HU_INFOTV', name: 'Infotv. Ungarn', type: 'national_law' },
{ code: 'BE_DPA_LAW', name: 'Datenschutzgesetz Belgien', type: 'national_law' },
{ code: 'FI_TIETOSUOJALAKI', name: 'Tietosuojalaki Finnland', type: 'national_law' },
{ code: 'DK_DATABESKYTTELSESLOVEN', name: 'Databeskyttelsesloven DK', type: 'national_law' },
{ code: 'LU_DPA_LAW', name: 'Datenschutzgesetz Luxemburg', type: 'national_law' },
// EDPB
{ code: 'EDPB_GUIDELINES_5_2020', name: 'EDPB GL Einwilligung', type: 'eu_guideline' },
{ code: 'EDPB_GUIDELINES_7_2020', name: 'EDPB GL C/P Konzepte', type: 'eu_guideline' },
// Frameworks
{ code: 'ENISA_SECURE_BY_DESIGN', name: 'ENISA Secure by Design', type: 'international_standard' },
{ code: 'ENISA_SUPPLY_CHAIN', name: 'ENISA Supply Chain', type: 'international_standard' },
{ code: 'NIST_SSDF', name: 'NIST SSDF', type: 'international_standard' },
{ code: 'NIST_CSF_2', name: 'NIST CSF 2.0', type: 'international_standard' },
{ code: 'OECD_AI_PRINCIPLES', name: 'OECD AI Principles', type: 'international_standard' },
{ code: 'EFRAG_ENDORSEMENT', name: 'EFRAG Endorsement', type: 'eu_guideline' },
]