Chapter 1: Document Intelligence
Healthcare runs on paper. Faxes remain the dominant interoperability mechanism for prior authorizations, referrals, and records requests. Every integration eventually hits a document extraction problem, whether it's scanned claims forms, handwritten physician notes, or multi-page attachments. This chapter covers extracting structured, actionable data from the unstructured documents that flow through payer operations daily. PHI is present in virtually every document, confidence scoring is non-negotiable for human-in-the-loop workflows, and multi-page mixed-format documents (tables, checkboxes, free text, handwriting) are the norm rather than the exception.
AWS Services Featured: Amazon Textract, Amazon Comprehend Medical, AWS Lambda, Amazon S3, Amazon DynamoDB, Amazon A2I (Augmented AI)
What You'll Learn
By the end of this chapter, you'll know how to:
- Extract structured fields from images β turning a phone photo of an insurance card into a JSON payload your eligibility system can consume (Recipe 1.1)
- Digitize multi-section paper forms β handling tables, checkboxes, and mixed layouts from patient intake forms (Recipe 1.2)
- Combine OCR with medical NLP β layering Amazon Comprehend Medical on top of Textract output to pull ICD-10 codes and clinical entities from lab requisitions (Recipe 1.3)
- Process multi-page clinical documents β tackling the prior authorization problem: extracting structured data from 5-20 page faxed submissions where every page is different (Recipe 1.4)
- Build document classification and routing pipelines β classifying incoming attachments by type, routing each to the right extractor, and merging results into a unified claims record (Recipe 1.5)
- Handle handwritten text with confidence scoring and human review β the hardest extraction problem in healthcare, solved with a tiered confidence pipeline and Amazon A2I (Recipe 1.6)
- Extract medication data from prescription labels β mapping pharmacy label fields to RxNorm concept IDs for downstream medication reconciliation (Recipe 1.7)
- Parse Explanation of Benefits documents β normalizing payer-specific table layouts into a canonical financial schema with math-based validation (Recipe 1.8)
- Process medical records request forms β extracting routing identifiers and validating HIPAA authorization elements before records are released (Recipe 1.9)
- Migrate historical paper charts at scale β bulk OCR, document segmentation, FHIR R4 mapping, and HealthLake import for legacy chart digitization programs (Recipe 1.10)
Chapter Prerequisites
Before diving into these recipes, make sure you have:
AWS Account & Services:
- An AWS account with a signed AWS Business Associate Addendum (BAA) β non-negotiable for any workload touching PHI
- Amazon Textract, Amazon Comprehend Medical, Amazon S3, AWS Lambda, and Amazon DynamoDB enabled in your target region
- For Recipe 1.6: Amazon A2I (Augmented AI) and an A2I workforce configured
IAM & Security:
- An IAM role for Lambda with least-privilege access to Textract, Comprehend Medical, S3, and DynamoDB
- S3 bucket policies enforcing
aws:SecureTransport(TLS-only) and default SSE-KMS encryption - VPC endpoints for Textract and S3 if operating in a private subnet (recommended for production)
- CloudTrail enabled for audit logging of all API calls touching PHI
Sample Data:
- Each recipe includes notes on synthetic test data. For real-world testing, use de-identified documents or CMS sample forms β never use actual PHI in development environments
- The CMS Forms Library provides real-world form layouts for testing
Development Environment:
- Python 3.9+ with boto3
- AWS CLI configured with appropriate credentials
- Cost estimates in each recipe assume us-east-1 pricing as of early 2026
Chapter Architecture
How the 10 recipes relate to each other and where PHI flows between them:
Chapter 1: Document Intelligence
================================
SIMPLE MODERATE COMPLEX
(Textract core) (+ LLM reasoning) (multi-stage pipelines)
βββββββββββββββ
β 1.1 Ins. ββ confidence gating ββ
β Card Scan β β
βββββββββββββββ β
βββββββββββββββ β ββββββββββββββββββββ
β 1.2 Patientββ confidence gating ββΌβββ>β 1.6 Handwritten β
β Intake β (async Textract) β β Notes (A2I β
βββββββββββββββ β β human review) β
βββββββββββββββ β ββββββββββββββββββββ
β 1.3 Lab ββ Comprehend Medical β β
β Requisitionβ (ICD-10 codes) βββββββββββ
βββββββββββββββ β (shared patterns)
β v
β (code validation ββββββββββββββββββββ
β pattern reused) β 1.4 Prior Auth βββ> Ch.2 Clinical
β β (LLM + tiering) β Criteria
βββββββββββββββββββββββββ>ββββββββββββββββββββ
β
βββββββββββββββ β (fan-out pattern)
β 1.7 Rx β v
β Label OCR β ββββββββββββββββββββββββ
β (RxNorm) β β 1.5 Claims βββ> Ch.3 Claims
βββββββββββββββ β Attachment (boundary β Adjudication
β β detect + matching) β
β ββββββββββββββββββββββββ
β
β (medication ββββββββββββββββββββ
β reconciliation) β 1.8 EOB βββ> Ch.4 Payment
βββββββββββββββββββββ>β Processing β Integrity
β (payer profiles)β
ββββββββββββββββββββ
ββββββββββββββββββββ
β 1.9 Med Records βββ> Ch.5 Member
β Request (HIPAA β Access
β auth validation)β
ββββββββββββββββββββ
ββββββββββββββββββββββββ
β 1.10 Chart Migration β
β (batch inference, βββ> HealthLake
β FHIR R4, capstone) β
ββββββββββββββββββββββββ
Shared infrastructure across all recipes:
S3 (SSE-KMS) + DynamoDB + CloudTrail + VPC endpoints + Lambda
Technology progression:
Textract only ββ> + Comprehend Medical ββ> + Bedrock LLM ββ> + Vision models
(1.1-1.2) (1.3, 1.7) (1.4-1.5) (1.6, 1.10)
Each recipe's "Related Recipes" section identifies specific dependencies. Recipes 1.1 and 1.2 establish foundational patterns (confidence gating, async processing, HIPAA infrastructure) that every subsequent recipe builds on.
Recipes
| # | Recipe | Complexity | Phase |
|---|---|---|---|
| 1.1 | Insurance Card Scanning | Simple | β MVP |
| 1.2 | Patient Intake Form Digitization | Simple | β MVP |
| 1.3 | Lab Requisition Form Extraction | Moderate | πΆ Phase 2 |
| 1.4 | Prior Authorization Document Processing | Moderate | β MVP |
| 1.5 | Claims Attachment Processing | Complex | πΆ Phase 2 |
| 1.6 | Handwritten Clinical Note Digitization | Complex | π· Phase 3 |
| 1.7 | Prescription Label OCR | Simple | πΆ Phase 2 |
| 1.8 | EOB Processing | Moderate | πΆ Phase 2 |
| 1.9 | Medical Records Request Extraction | Moderate | πΆ Phase 2 |
| 1.10 | Historical Chart Migration | Complex | π· Phase 3 |
Reading order: Recipes build on each other. Start with 1.1 β each successive recipe introduces new concepts while referencing patterns established earlier. If you're only here for one thing, Recipe 1.4 (Prior Auth) is the most common real-world ask and can be read after 1.1-1.2 for context.