Skip to main content

Installation

pip install flexorch-audit

Basic usage

from flexorch_audit import detect_pii

text = "Contact us at info@company.com or call +90 555 123 4567."

findings = detect_pii(text)

for f in findings:
    print(f["type"], f["value"], f["start"], f["end"])
# email  info@company.com  14  32
# phone_tr  +90 555 123 4567  39  56

Locale filtering

By default, all locales are active. Restrict detection to specific jurisdictions:
from flexorch_audit import detect_pii

# Only detect universal + Turkish types
findings = detect_pii(text, locales=["universal", "tr"])

# Only EU types
findings = detect_pii(text, locales=["universal", "de", "fr", "it", "nl", "es", "pl"])
Available locale values: "universal", "tr", "de", "fr", "it", "nl", "es", "pl", "uk", "us", "at", "be", "se", "dk", "fi", "pt"

Finding structure

Each finding contains:
FieldTypeDescription
typestringPII type identifier (e.g., email, national_id_tr)
valuestringThe matched text
startintStart character position
endintEnd character position
localestringJurisdiction (tr, de, universal, …)

Batch processing

from flexorch_audit import detect_pii_batch

texts = [
    "Customer: john@example.com",
    "IBAN: DE89 3704 0044 0532 0130 00",
    "No sensitive data here.",
]

results = detect_pii_batch(texts)
# List of finding lists, one per input

Streaming large files

from flexorch_audit import audit_stream

for chunk_result in audit_stream("large_document.txt", chunk_size=5000):
    print(chunk_result["pii_summary"]["count"])

Supported PII types

See PII Detection & Privacy for the complete list of 46 types across all jurisdictions.