All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 38s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 19s
- obligations.md: NEU — Obligations Framework v2 (325 Pflichten, 9 Regulierungen, Condition Engine, TOM-Mapping, Gap-Analyse, alle 13 API-Endpoints) - requirements.md: POST /compliance/extract-requirements-from-rag dokumentiert (RAG-Collections, dry_run, Deduplication, Auto-Regulation-Stubs) - vorbereitung-module.md: UCCA Obligations v2 Abschnitt + neue Endpoints + Hinweis: Go-Tests lokal statt im Container - index.md: Obligations, IACE, Import, Screening, RAG zur Modulliste + URLs - mkdocs.yml: obligations.md als nav-Eintrag Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
187 lines
5.1 KiB
Markdown
187 lines
5.1 KiB
Markdown
# Anforderungen (CP-ANF)
|
|
|
|
Verwaltet regulatorische Anforderungen aus DSGVO, AI Act, CRA, NIS2 und weiteren Regulierungen.
|
|
|
|
**Prefix:** `CP-ANF` · **Frontend:** `https://macmini:3007/sdk/anforderungen`
|
|
**Proxy:** `/api/sdk/v1/compliance/[[...path]]` → `backend-compliance:8002/compliance/...`
|
|
|
|
---
|
|
|
|
## Features
|
|
|
|
- Paginierte Anforderungsliste mit Freitextsuche
|
|
- Filtert nach Regulierung, Anwendbarkeit und Implementierungsstatus
|
|
- Verknüpfung mit Controls und Audit-Tracking
|
|
- RAG-Rechtskontext: Holt passende Gesetzestexte aus dem Vector-Store
|
|
|
|
---
|
|
|
|
## Rechtsgrundlage
|
|
|
|
| Regulierung | Beispielartikel |
|
|
|-------------|-----------------|
|
|
| DSGVO | Art. 5, Art. 24, Art. 32 |
|
|
| AI Act | Art. 9, Art. 13 |
|
|
| NIS2 | Art. 21 |
|
|
| CRA | Art. 13 |
|
|
|
|
---
|
|
|
|
## API Endpoints
|
|
|
|
| Methode | Pfad | Beschreibung |
|
|
|---------|------|--------------|
|
|
| `GET` | `/compliance/requirements` | Paginierte Liste (`page`, `page_size`, `search`, `is_applicable`) |
|
|
| `GET` | `/compliance/requirements/{id}` | Einzelne Anforderung + optionaler RAG-Rechtskontext |
|
|
| `GET` | `/compliance/regulations/{code}/requirements` | Alle Anforderungen einer Regulierung |
|
|
| `POST` | `/compliance/requirements` | Neue Anforderung anlegen |
|
|
| `PUT` | `/compliance/requirements/{id}` | Implementierungsstatus, Audit-Notizen aktualisieren |
|
|
| `DELETE` | `/compliance/requirements/{id}` | Anforderung löschen |
|
|
|
|
### RAG-Rechtskontext
|
|
|
|
```http
|
|
GET /compliance/requirements/{id}?include_legal_context=true
|
|
```
|
|
|
|
Gibt zusätzlich `legal_context[]` mit RAG-Ergebnissen zurück:
|
|
|
|
```json
|
|
{
|
|
"legal_context": [
|
|
{
|
|
"text": "...",
|
|
"regulation_code": "GDPR",
|
|
"article": "Art. 32",
|
|
"score": 0.92,
|
|
"source_url": "https://eur-lex.europa.eu/..."
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### RAG-Extraktion: Anforderungen automatisch aus Corpus erstellen
|
|
|
|
```http
|
|
POST /compliance/extract-requirements-from-rag
|
|
```
|
|
|
|
Durchsucht **alle RAG-Collections** parallel nach Prüfaspekten / Audit-Kriterien und legt automatisch Requirement-Einträge in der DB an.
|
|
|
|
**Request:**
|
|
|
|
```json
|
|
{
|
|
"collections": null,
|
|
"search_queries": null,
|
|
"regulation_codes": ["BSI-TR-03161-1", "GDPR"],
|
|
"max_per_query": 20,
|
|
"dry_run": true
|
|
}
|
|
```
|
|
|
|
| Feld | Typ | Standard | Beschreibung |
|
|
|------|-----|---------|--------------|
|
|
| `collections` | string[]? | alle | RAG-Collections durchsuchen (`bp_compliance_ce`, `bp_compliance_recht`, ...) |
|
|
| `search_queries` | string[]? | 5 Standard-Queries | Suchbegriffe (MUSS/SOLL-Prüfaspekte etc.) |
|
|
| `regulation_codes` | string[]? | alle | Nur bestimmte Regulierungen einschließen |
|
|
| `max_per_query` | int | 20 | `top_k` pro Suchquery |
|
|
| `dry_run` | bool | false | `true` = Vorschau ohne DB-Schreibzugriff |
|
|
|
|
**Response:**
|
|
|
|
```json
|
|
{
|
|
"created": 47,
|
|
"skipped_duplicates": 12,
|
|
"skipped_no_article": 3,
|
|
"failed": 0,
|
|
"collections_searched": ["bp_compliance_ce", "bp_compliance_recht"],
|
|
"queries_used": ["Prüfaspekt Anforderung MUSS SOLL", "..."],
|
|
"dry_run": false,
|
|
"message": "Erstellt: 47, Duplikate übersprungen: 12, ...",
|
|
"requirements": [
|
|
{
|
|
"regulation_code": "BSI-TR-03161-1",
|
|
"article": "M.Zugriffsschutz_01",
|
|
"title": "Implementierung einer Zugangskontrolle",
|
|
"requirement_text": "...",
|
|
"source_url": "...",
|
|
"score": 0.91,
|
|
"action": "created"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
**Deduplication:** Bereits vorhandene `(regulation_code, article)` Kombinationen werden übersprungen — sicheres Mehrfachaufrufen.
|
|
|
|
**Auto-Regulation-Stubs:** Für unbekannte Regulierungscodes werden automatisch Regulation-Stubs angelegt.
|
|
|
|
---
|
|
|
|
### Request-Beispiel (POST)
|
|
|
|
```json
|
|
{
|
|
"regulation_id": "uuid-der-regulierung",
|
|
"article": "Art. 32",
|
|
"title": "Sicherheit der Verarbeitung",
|
|
"is_applicable": true,
|
|
"priority": 1
|
|
}
|
|
```
|
|
|
|
### Response-Felder (RequirementResponse)
|
|
|
|
| Feld | Typ | Beschreibung |
|
|
|------|-----|--------------|
|
|
| `id` | string | UUID |
|
|
| `regulation_code` | string | z.B. "GDPR", "AI_ACT" |
|
|
| `article` | string | Artikel-Referenz |
|
|
| `implementation_status` | string | `not_started` / `implemented` / `partial` |
|
|
| `audit_status` | string | `pending` / `passed` / `failed` |
|
|
| `last_audit_date` | datetime? | Letztes Audit-Datum |
|
|
|
|
---
|
|
|
|
## Frontend
|
|
|
|
**URL:** `https://macmini:3007/sdk/anforderungen`
|
|
|
|
Zeigt eine filterbare Tabelle aller Anforderungen. Detailansicht öffnet sich per Klick und zeigt neben Metadaten optional den RAG-Rechtskontext mit Quellenangabe.
|
|
|
|
---
|
|
|
|
## Datenbankschema
|
|
|
|
```sql
|
|
compliance_requirements (
|
|
id UUID PRIMARY KEY,
|
|
regulation_id UUID REFERENCES compliance_regulations(id),
|
|
article VARCHAR,
|
|
title TEXT,
|
|
description TEXT,
|
|
is_applicable BOOLEAN DEFAULT true,
|
|
priority INTEGER,
|
|
implementation_status VARCHAR DEFAULT 'not_started',
|
|
audit_status VARCHAR DEFAULT 'pending',
|
|
last_audit_date TIMESTAMP,
|
|
audit_notes TEXT,
|
|
created_at TIMESTAMP,
|
|
updated_at TIMESTAMP
|
|
)
|
|
```
|
|
|
|
---
|
|
|
|
## Tests
|
|
|
|
**Testdatei:** `backend-compliance/tests/test_requirement_routes.py`
|
|
**Anzahl Tests:** 18 · **Status:** ✅ alle bestanden (Stand 2026-03-05)
|
|
|
|
```bash
|
|
cd backend-compliance
|
|
python3 -m pytest tests/test_requirement_routes.py -v
|
|
```
|