How akshit-saharia/cadence-pii-shield works
Cadence PII Shield turns PDF, DOCX, and PPTX files into protected text for downstream LLM use: it extracts document content and images, OCRs embedded images, detects PII, classifies and redacts it, then releases only files allowed by a fail-closed gate. Its result also supports exposure reporting and token rehydration for end-user responses. The README documents the Streamlit UI and evaluation capability; evaluation wiring is not shown in the sampled evidence, so no evaluation flow is inferred.
Main entry points: pipeline.py Protection pipeline · router.py Format router · engine.py Detection engine · streamlit_app.py Streamlit UI
Components 23
Document Intake
- Format router
extraction/router.py - PDF extraction
extraction/pdf_extractor.py - DOCX extraction
extraction/docx_extractor.py - PPTX extraction
extraction/pptx_extractor.py - Image OCR stage
redaction/ocr_stage.py - OCR pipeline
ocr/ocr_pipeline.py - Tesseract engine
ocr/engine.py
PII Detection
- Detection engine
detection/engine.py - PII recognizers
detection/recognizers - False-positive controls
detection/allowlist.py
Protection and Release
- Protection pipeline
redaction/pipeline.py - Risk classifier
redaction/classifier.py - PII redactor
redaction/redactor.py - Token formatter
redaction/tokenizer.py - Token vault
redaction/vault.py - Fail-closed gate
redaction/gate.py - Exposure report
redaction/report.py
Shared Contracts
- Shared data schemas
schemas.py - Shared settings
config.py
User Interface
- Streamlit UI
app/streamlit_app.py - CLI entrypoint
pipeline.py
Other components
- Document user
- LLM consumer
Connections 24
- Document user → Streamlit UI: uses
README.md - Document user → CLI entrypoint: runs
README.md - Streamlit UI → Protection pipeline: uses
app/streamlit_app.py - Streamlit UI → Exposure report: uses
app/streamlit_app.py - CLI entrypoint → Protection pipeline: invokes
pipeline.py - Protection pipeline → Format router: extracts files
redaction/pipeline.py - Format router → PDF extraction: dispatches
extraction/router.py - Format router → DOCX extraction: dispatches
extraction/router.py - Format router → PPTX extraction: dispatches
extraction/router.py - Protection pipeline → Image OCR stage: processes images
redaction/pipeline.py - Image OCR stage → OCR pipeline: requests OCR
redaction/ocr_stage.py - OCR pipeline → Tesseract engine: recognizes text
ocr/ocr_pipeline.py - Protection pipeline → Detection engine: detects PII
redaction/pipeline.py - Detection engine → PII recognizers: generates candidates
detection/engine.py - Detection engine → False-positive controls: filters spans
detection/engine.py - Protection pipeline → Risk classifier: classifies findings
redaction/pipeline.py - Protection pipeline → PII redactor: redacts findings
redaction/pipeline.py - PII redactor → Token vault: stores reversible tokens
redaction/redactor.py - Token vault → Token formatter: formats tokens
redaction/vault.py - Protection pipeline → Fail-closed gate: evaluates release
redaction/pipeline.py - Protection pipeline → Exposure report: builds report
redaction/pipeline.py - Protection pipeline → Shared data schemas: uses result models
redaction/pipeline.py - Protection pipeline → Shared settings: reads settings
redaction/pipeline.py - LLM consumer → Protection pipeline: receives allowed payload
README.md