Initial commit
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
# STEP 10 – Technische Einwilligungs-Protokollierung
|
||||
|
||||
## Ziel
|
||||
Jede KI-bezogene Datenverarbeitung muss technisch nachweisbar
|
||||
durch eine Einwilligung gedeckt sein.
|
||||
|
||||
---
|
||||
|
||||
## 1. Datenmodell
|
||||
|
||||
Jeder Consent-Eintrag enthält:
|
||||
|
||||
| Feld | Typ | Beschreibung |
|
||||
|---|---|---|
|
||||
| user_id | string | Benutzername aus Profil |
|
||||
| consent_type | string | Immer "ai_processing" |
|
||||
| consent_version | string | Stand-Datum aus ai_consent.md |
|
||||
| timestamp | string | UTC ISO-8601 |
|
||||
| source | string | "ui", "test", "admin" |
|
||||
| action | string | "grant" oder "revoke" |
|
||||
| prev_hash | string | SHA-256 des vorherigen Eintrags |
|
||||
| hash | string | SHA-256 dieses Eintrags (Integritaetskette) |
|
||||
|
||||
## 2. Speicherort
|
||||
|
||||
- Datei: `aza_consent_log.json` (Projekt-Root)
|
||||
- Format: JSON-Array (Append-only)
|
||||
- Manipulationssicherheit: SHA-256-Hash-Kette
|
||||
(jeder Eintrag referenziert den Hash des vorherigen)
|
||||
- Kein Überschreiben: Widerruf erzeugt neuen Eintrag,
|
||||
alter Grant bleibt in der Historie
|
||||
|
||||
## 3. Enforcement-Punkte
|
||||
|
||||
KI-Funktionen werden an folgenden Stellen blockiert, wenn
|
||||
keine gueltige Einwilligung vorliegt:
|
||||
|
||||
| Stelle | Datei | Methode |
|
||||
|---|---|---|
|
||||
| Chat Completion (alle KI-Texte) | basis14.py | call_chat_completion() |
|
||||
| Transkription | basis14.py | transcribe_wav() |
|
||||
| Aufnahme starten | basis14.py | toggle_record() |
|
||||
| Korrektur-Aufnahme | basis14.py | _toggle_record_append() |
|
||||
| Diktat in Widget | basis14.py | _diktat_into_widget() |
|
||||
| KI-Prüfung | basis14.py | open_ki_pruefen() |
|
||||
| Interaktionscheck | basis14.py | do_interaktion() |
|
||||
|
||||
Bei fehlendem Consent:
|
||||
- UI-Einstiegspunkte: Consent-Dialog wird angezeigt
|
||||
- API-Gateways: RuntimeError wird geworfen
|
||||
|
||||
## 4. UI-Elemente
|
||||
|
||||
### 4.1 Consent-Dialog (vor erster KI-Nutzung)
|
||||
- Zeigt den kompletten Text aus legal/ai_consent.md
|
||||
- Checkbox: "Ich habe den Text gelesen und stimme zu"
|
||||
- Buttons: "Zustimmen" / "Ablehnen"
|
||||
- Wird nur angezeigt, wenn kein gueltiger Consent vorliegt
|
||||
|
||||
### 4.2 Einstellungsfenster (Datenschutz & Recht)
|
||||
- Status-Anzeige: "Erteilt" / "Nicht erteilt / widerrufen"
|
||||
- Button: "KI-Einwilligung widerrufen" / "erteilen"
|
||||
- Button: "Consent-Log exportieren"
|
||||
- Bestehende Buttons: Datenschutzerklaerung, KI-Einwilligung
|
||||
|
||||
## 5. Versions-Handling
|
||||
|
||||
- Die Consent-Version wird aus dem "Stand:"-Feld in
|
||||
legal/ai_consent.md extrahiert
|
||||
- Bei Aenderung des Consent-Textes (neues Datum) wird
|
||||
ein bestehender Consent ungueltig
|
||||
- Benutzer muss erneut zustimmen
|
||||
|
||||
## 6. Audit-Workflow
|
||||
|
||||
### Export
|
||||
```
|
||||
python -c "from aza_consent import export_consent_log; print(export_consent_log())"
|
||||
```
|
||||
Oder ueber Einstellungen -> "Consent-Log exportieren"
|
||||
|
||||
### Integritaetspruefung
|
||||
```
|
||||
python -c "from aza_consent import verify_chain_integrity; ok, e = verify_chain_integrity(); print('OK' if ok else e)"
|
||||
```
|
||||
|
||||
### Export-Format
|
||||
```json
|
||||
{
|
||||
"export_timestamp": "2026-02-22T...",
|
||||
"total_entries": 3,
|
||||
"current_consent_version": "Februar 2026",
|
||||
"entries": [
|
||||
{
|
||||
"user_id": "...",
|
||||
"consent_type": "ai_processing",
|
||||
"consent_version": "Februar 2026",
|
||||
"timestamp": "2026-02-22T...",
|
||||
"source": "ui",
|
||||
"action": "grant",
|
||||
"prev_hash": "0000...0000",
|
||||
"hash": "a1b2c3..."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 7. Geaenderte / Neue Dateien
|
||||
|
||||
| Datei | Aktion |
|
||||
|---|---|
|
||||
| aza_consent.py | NEU – Consent-Modul (Datenmodell, Storage, Enforcement, Export) |
|
||||
| basis14.py | GEAENDERT – Import aza_consent, Consent-Check an 7 Stellen |
|
||||
| aza_settings_mixin.py | GEAENDERT – Widerruf/Erteil-Button, Status, Export im Einstellungsfenster |
|
||||
| _test_consent.py | NEU – Testskript (14 Tests) |
|
||||
|
||||
## 8. Test-Ergebnisse (22.02.2026)
|
||||
|
||||
| Test | Ergebnis |
|
||||
|---|---|
|
||||
| Ohne Consent -> KI blockiert | PASS |
|
||||
| Consent erteilen -> KI erlaubt | PASS |
|
||||
| Widerruf -> KI blockiert | PASS |
|
||||
| Erneuter Consent -> KI erlaubt | PASS |
|
||||
| Hash-Kette intakt | PASS |
|
||||
| Status-Abfrage korrekt | PASS |
|
||||
| Version-Match | PASS |
|
||||
| Export erstellt gueltige Datei | PASS |
|
||||
| User-Historie korrekt | PASS |
|
||||
| Anderer User -> kein Consent | PASS |
|
||||
| Gesamt: 14/14 | ALLE BESTANDEN |
|
||||
|
||||
## 9. Risiken
|
||||
|
||||
| Risiko | Bewertung | Massnahme |
|
||||
|---|---|---|
|
||||
| JSON-Datei manuell editierbar | NIEDRIG | Hash-Kette erkennt Manipulation |
|
||||
| Kein digitaler Signatur-Mechanismus | MITTEL | Fuer Audit: Export + Integritaetspruefung |
|
||||
| Consent nur auf App-Ebene, nicht Patient | NIEDRIG | Papier-Einwilligung ergaenzt dies |
|
||||
Reference in New Issue
Block a user