Self-Hosted AI Data Governance: Checksum PII Tokenization, Undoable Jaro-Winkler Merges, and PostgreSQL Schema Audits
How ai-data-governance combines Luhn/Mod-97 checksum PII detection, reversible HKDF/Fernet vault tokenization, undoable Jaro-Winkler/Soundex deduplication, E.164/USPS normalizers, and PostgreSQL DDL hygiene audits.
Growing databases accumulate messy operational debt: untagged PII columns sitting in analytics tables, duplicate customer profiles with conflicting phone numbers, unindexed foreign keys causing sequential-scan hotspots, and risky one-off cleanup scripts with no rollback path.
AI Data Governance & Cleanup Platform (source on GitHub) addresses database hygiene through deterministic checksum validators, reversible cryptography, and four-eyes governance inside a FastAPI, async SQLAlchemy 2.0, PostgreSQL (`pgvector`), and 7-tab React 18 console.
Checksum-Validated PII Scanning & Reversible HKDF/Fernet Tokenization#
Under `/api/v1/pii/*`, regex detectors and offline heuristic NER pair with Luhn payment-card and Mod-97 IBAN checksum validation so arbitrary order IDs do not trigger false alerts. Findings can be handled with `redact`, `mask`, `hash`, or reversible HKDF/Fernet vault `tokenize` paired with audited `detokenize` endpoints.
Undoable Jaro-Winkler Dedup Merges & Non-Destructive Normalizers#
The `/api/v1/dedup/*` engine clusters candidate duplicates using blocking keys, Jaro-Winkler distance, token-set matching, and Soundex phonetic keys, computing survivorship rules with field provenance and undoable HITL merge snapshots. In parallel, `/api/v1/normalizers/*` previews non-destructive standardizations across emails, E.164 phone numbers, USPS addresses, taxonomies, null sentinels, whitespace, and ISO dates.
PostgreSQL DDL/Catalog Schema Audits & Encrypted Live Connectors#
Under `/api/v1/schema-audit/*` and `/api/v1/connectors/*`, Fernet-encrypted SQLite and PostgreSQL connectors perform live introspection and sampling while the schema analyzer inspects DDL and live catalog telemetry for structural and performance defects:
- Orphaned or unindexed foreign keys -> emits CREATE INDEX CONCURRENTLY remediation SQL
- Sequential-scan hotspots & unused indexes -> ranks query-plan impact
- Missing primary keys & untagged PII columns -> flags governance policy gaps
- Retention SLA violations -> surfaces archival/cleanup candidates for steward sign-off- Four-Eyes Governance & RBAC (`/api/v1/auth/*`, `/governance/*`): Enforces HS256 JWT + API-key RBAC (`viewer`, `analyst`, `steward`, `admin`) with four-eyes approval separation.
- Observability, Compliance Exports & Guardrails: Emits `structlog` JSON logs, enforces pure ASGI security headers and sliding-window rate limiting, defaults `LLM_REDACT_PII_FOR_CLOUD=true` alongside local Ollama/mock adapters, and exports Markdown, CSV, and JSON compliance reports (`/api/v1/reports/*`).
Tackling database hygiene, PII tokenization, or PostgreSQL schema remediation? Explore my Software Architecture and AI Engineering services or book a consultation.
Production Case Studies & Capabilities
Explore how these engineering patterns are deployed in production systems and available through client engagements.
AI Data Governance & Cleanup Platform
An open-source Python 3.12 (FastAPI), async SQLAlchemy 2.0 + PostgreSQL/pgvector, and React 18 data governance console combining Luhn/Mod-97 PII detection and HKDF/Fernet vault tokenization with undoable Jaro-Winkler/Soundex merges, non-destructive normalizers, live DB connectors, and PostgreSQL DDL hygiene audits.
Software Architecture & System Design
Fast-moving teams frequently accrue hidden architectural liabilities: tangled domain logic, unmaintainable monoliths, or over-engineered microservices that paralyze development.
AI Engineering & LLM Integration
Many AI initiatives fail in production due to prompt fragility, high token latency, hallucination risks, and lack of structured evaluation. I bridge the gap between experimental LLM prompts and deterministic software engineering.
Frequently Asked Questions
How does ai-data-governance avoid false positives when scanning tables for PII?
What makes duplicate record merges safe to run on production datasets?
How does the platform connect to external PostgreSQL or SQLite databases safely?
Related Technical Articles
Automating Compliance, Data Governance, QA, and IT Operations with Guarded Self-Hosted AI
How deterministic policy scanners, legal-hold DSAR blocks, HKDF/Fernet PII tokenization, SCIM 2.0 dry-run diffs, and OpenAPI E2E test synthesis power internal governance and release engineering safely.
Engineering a Self-Hosted AI Compliance Auditor: 18 SOC 2/HIPAA/GDPR Controls, Signed ZIP Bundles, and 409 Legal Holds
Inside ai-compliance-auditor: 18-control SOC 2/HIPAA/GDPR registry, 20 deterministic CFG/ENC/LOG/RBAC/SOP scanners, HMAC-signed ZIP/PDF evidence bundles with offline verify_bundle.py, Policy RAG, and 409 legal-hold DSARs.