# Why this matters Organizations that process thousands of scanned documents daily—medical forms, insurance claims, financial records—need reliable, scalable PII redaction before sharing or downstream processing. Manual redaction doesn't scale and traditional OCR-plus-pattern-matching approaches struggle with degraded text, handwriting, and field-level business rules.
# Solution in brief
# How the PII blueprint is designed Start by answering four concrete questions for the target document type:
- What is sensitive? (e.g., patient name, date of birth, home address, contact info)
- What is not sensitive? (e.g., physician name, office contact, medical notes)
- Where does it appear? (structured fields, handwriting, repeated instances)
- How should it be removed? (bounding box coords, convert PDF to PNG, black-box overlay)
Use the BDA console, CLI, or SDKs to create a blueprint schema that enumerates each field eligible for redaction. For each field include the data type, a short natural-language description, and any transformations (for example, date formats). Use explicit instructions to scope subtypes—e.g., instruct BDA to extract patient date of birth while ignoring appointment or signature dates. That scoping keeps non-sensitive dates and names out of the redaction set.
# Serverless architecture The pipeline is serverless and batch-oriented so it scales without server management. Core components:
- AWS Step Functions: orchestrates the batch workflow, handling retries, parallelism, and orchestration logic.
- AWS Lambda: handles lightweight transformations and post-processing such as image conversion, applying black-box redaction at bounding boxes, and token-matching checks.
This separation lets the same pipeline serve multiple use cases by swapping blueprints and post-processing rules.
# Improving recall for degraded or handwritten text Generative-document-understanding can still miss low-quality or handwritten tokens. The solution includes a token-matching quality check: after BDA returns extracted tokens and bounding boxes, compare tokens against expected patterns or token lists and use a tolerant match to capture missed instances. When token matching finds additional candidates, include them in redaction or flag for human review. This raises recall for degraded inputs without retraining models.
# Practical considerations
- Use the console walkthrough or sample documents to bootstrap the blueprint schema.
- Keep instructions focused on the intended field owner (for example, patient vs. physician) to reduce false positives.
- Apply coordinate-based black-box redaction to the image exports (PNG) rather than attempting in-place PDF edits.
- Design the Step Functions workflow to surface low-confidence or ambiguous extractions for human review.
# Outcome The approach automates end-to-end PII detection and redaction at scale, enforces field-level business rules through natural-language blueprint instructions, and uses a token-matching quality check to improve recall on degraded or handwritten documents.