German-Privacy-Shield
DSGVO-konforme Dokument-Redaktion mit KI
Erkennt und schwärzt personenbezogene Daten (PII) in deutschen Dokumenten automatisch. Läuft 100% lokal mit Ollama - keine Cloud, keine Datenübertragung.
Highlights
- 100% Lokal - Läuft komplett auf Ihrer Hardware mit Ollama
- DSGVO-konform - Basiert auf Art. 4 DSGVO, Art. 6 DSGVO, Par. 26 BDSG
- Smart Knowledge Injection - DSGVO-Wissen direkt im Modell integriert
- Multi-Mode - Drei Sicherheitsstufen (strict, balanced, loose)
- Dokumenttyp-Erkennung - Optimiert für Rechnungen, Verträge, Ausweise, etc.
- Nur 1.9GB - Läuft auf jeder Consumer-GPU und CPUs
Installation
pip install german-privacy-shield
Voraussetzungen
- Ollama installieren: https://ollama.com
- Modell laden:
ollama pull Keyvan/german-privacy-shield
Schnellstart
Python API
from german_privacy_shield import GermanPrivacyShield, Redactor, PrivacyMode
# PII-Erkennung
shield = GermanPrivacyShield(mode=PrivacyMode.BALANCED)
result = shield.detect_pii("rechnung.png")
for pii in result.pii_items:
print(f"[{pii.label}] {pii.text}")
# Dokument schwärzen
redactor = Redactor(mode=PrivacyMode.STRICT)
result = redactor.redact("rechnung.png", "rechnung_redacted.png")
print(f"Geschwärzt: {result.pii_count} PIIs")
CLI
# PII-Erkennung
german-privacy-shield detect rechnung.png
# Dokument schwärzen
german-privacy-shield redact rechnung.png -o rechnung_redacted.png
# Mit strenger Sicherheitsstufe
german-privacy-shield redact dokument.png --mode strict
# Batch-Verarbeitung
german-privacy-shield batch ./input/ ./output/
Sicherheitsstufen
| Modus | Beschreibung | Anwendungsfall |
|---|---|---|
strict |
Alle PIIs, Unterschriften, Fotos | Maximaler Datenschutz, AI-Training |
balanced |
Namen, Adressen, Bankdaten | Standard DSGVO-Compliance |
loose |
Nur IBAN, Steuer-ID, Sozialvers. | Minimale Schwärzung |
Erkannte PII-Kategorien
- Identität: Namen, Geburtsdaten, Ausweisnummern
- Kontakt: Adressen, Telefon, E-Mail
- Finanzen: IBAN, BIC, Kontonummern, Beträge
- Biometrie: Unterschriften, Fotos, Gesichter
- Gesundheit: Diagnosen, Versicherungsnummern
- Arbeit: Personalnummern, Gehalt
- Steuern: Steuernummern, Steuer-ID
Dokumenttypen
Das Modell ist für folgende Dokumenttypen optimiert:
- invoice - Rechnungen
- contract - Verträge
- id_card - Ausweise und Reisepässe
- tax - Steuerbescheide
- medical - Arztbriefe und medizinische Dokumente
from german_privacy_shield import Redactor, DocumentType
redactor = Redactor()
result = redactor.redact("rechnung.png", doc_type=DocumentType.INVOICE)
API Referenz
GermanPrivacyShield
class GermanPrivacyShield:
def __init__(
self,
model: str = "german-privacy-shield",
mode: PrivacyMode = PrivacyMode.BALANCED,
host: Optional[str] = None # Ollama Host URL
)
def detect_pii(
self,
image_path: str,
doc_type: Optional[DocumentType] = None,
custom_rules: Optional[List[str]] = None
) -> RedactionResult
Redactor
class Redactor(GermanPrivacyShield):
def redact(
self,
image_path: str,
output_path: Optional[str] = None,
doc_type: Optional[DocumentType] = None,
custom_rules: Optional[List[str]] = None,
draw_labels: bool = False
) -> RedactionResult
def redact_batch(
self,
input_dir: str,
output_dir: str,
pattern: str = "*.png"
) -> List[RedactionResult]
Rechtlicher Hintergrund
German-Privacy-Shield basiert auf:
- Art. 4 DSGVO - Definition personenbezogener Daten
- Art. 6 DSGVO - Rechtmäßigkeit der Verarbeitung
- Par. 26 BDSG - Pseudonymisierung und Anonymisierung
- Par. 22 BDSG - Besondere Kategorien (Gesundheit, Religion)
Performance
| Hardware | Zeit pro Dokument |
|---|---|
| RTX 4060 8GB | ~5 Sekunden |
| RTX 3060 12GB | ~6 Sekunden |
| CPU (keine GPU) | ~15 Sekunden |
Systemanforderungen
- Python 3.9+
- Ollama v0.1.0+
- 4GB+ VRAM (GPU) oder 8GB+ RAM (CPU)
- 2GB Speicherplatz für Modell
Verwandte Projekte
- german-ocr - OCR für deutsche Dokumente
- german-ocr-turbo - Schnelles OCR-Modell
Lizenz
Apache 2.0
Autor
Keyvan Hardani - keyvan.ai
Made with privacy in Germany
Metadata
Release files for german-privacy-shield 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| german_privacy_shield-0.1.0.tar.gz | 13.0 kB | With provenance | Details for german_privacy_shield-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| german_privacy_shield-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for german_privacy_shield-0.1.0-py3-none-any.whl |
Total release size: 25.9 kB
Release files / german_privacy_shield-0.1.0.tar.gz
| Download URL | german_privacy_shield-0.1.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf2e7f239f9a22ae01ffd41d35d4a494524d0ce6174ef452d4cf5fdb28d382c6
|
|
BLAKE2b-256 checksum How to use checksums |
c2833f1ef725c4ba43019b10eb084663b012708651c6a28d00b69885a2ac2b25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logRelease files / german_privacy_shield-0.1.0-py3-none-any.whl
| Download URL | german_privacy_shield-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
536716709b05601206176117cbf81af81d0effbc8244215f33055bafab4ff492
|
|
BLAKE2b-256 checksum How to use checksums |
97e842184dd3d3f43195e6fc98614e7e2b1c828967889d8b09834a97ab6e0589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logSecurity for german-privacy-shield 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for german_privacy_shield-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.