Skip to content

Commit f8d80d1

Browse files
committed
feat(docs): update documentation for unified pattern architecture
1 parent 0c81c7c commit f8d80d1

6 files changed

Lines changed: 28 additions & 32 deletions

File tree

CLAUDE.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ python3 publish.py idp-1234567890 idp us-east-1 --verbose
2929
The build process:
3030
- Checks system dependencies (AWS CLI, SAM CLI, Docker, Python 3.12+, Node.js 22.12+)
3131
- Builds CloudFormation templates and assets using SAM
32-
- Pattern-2 functions are built as container images; Pattern-1 and Pattern-3 use ZIP-based Lambdas
32+
- All pattern functions are built within the unified pattern directory
3333
- Uploads artifacts to S3 bucket named `<cfn_bucket_basename>-<region>`
3434

3535
### Code Quality & Linting
@@ -106,7 +106,7 @@ idp-cli deploy \
106106
idp-cli deploy \
107107
--stack-name my-idp-stack \
108108
--pattern pattern-2 \
109-
--custom-config ./config_library/pattern-2/bank-statement-sample/config.yaml \
109+
--custom-config ./config_library/unified/bank-statement-sample/config.yaml \
110110
--wait
111111

112112
# Process documents in batch
@@ -125,7 +125,7 @@ idp-cli download-results \
125125
### Local Lambda Testing
126126

127127
```bash
128-
cd patterns/pattern-2/
128+
cd patterns/unified/
129129
sam build
130130
sam local invoke OCRFunction -e ../../testing/OCRFunction-event.json --env-vars ../../testing/env.json
131131
```
@@ -153,30 +153,26 @@ The solution uses a modular architecture with the main template (`template.yaml`
153153
- Authentication (Cognito User Pool, Identity Pool)
154154
- AppSync GraphQL API (for UI-backend communication)
155155

156-
**Pattern Stacks** (`patterns/pattern-*/template.yaml`) - Pattern-specific resources:
157-
- Step Functions State Machine
158-
- Pattern-specific Lambda Functions (OCR, Classification, Extraction)
159-
- Pattern-specific CloudWatch Dashboard
160-
- Model Endpoints and Configurations
156+
**Unified Pattern Stack** (`patterns/unified/template.yaml`) - Processing resources:
157+
- Step Functions State Machine (BDA branch + Pipeline branch + shared tail)
158+
- Lambda Functions (OCR, Classification, Extraction, Assessment, Summarization, Evaluation, etc.)
159+
- CloudWatch Dashboard
161160

162-
### Processing Patterns
161+
### Processing Modes
163162

164-
1. **Pattern 1: Bedrock Data Automation (BDA)**
163+
The unified architecture supports two processing modes, controlled by the `use_bda` configuration flag:
164+
165+
1. **BDA Mode** (formerly Pattern 1)
165166
- Uses AWS Bedrock Data Automation for end-to-end processing
166167
- Handles packet or media documents with integrated OCR, classification, and extraction
167-
- Location: `patterns/pattern-1/`
168168

169-
2. **Pattern 2: Textract + Bedrock**
169+
2. **Pipeline Mode** (formerly Pattern 2)
170170
- OCR with Amazon Textract
171171
- Classification with Bedrock (page-level or holistic)
172172
- Extraction with Bedrock
173173
- Supports few-shot examples
174-
- Location: `patterns/pattern-2/`
175174

176-
3. **Pattern 3: Textract + UDOP + Bedrock**
177-
- OCR with Amazon Textract
178-
- Classification with UDOP model on SageMaker
179-
- Extraction with Bedrock
175+
> **Note**: The separate `patterns/pattern-1/`, `patterns/pattern-2/`, and `patterns/pattern-3/` directories have been removed. All processing is now in `patterns/unified/`. See [pattern-1.md](docs/pattern-1.md) and [pattern-2.md](docs/pattern-2.md) for historical reference.
180176
181177
### Document Processing Flow
182178

docs/assessment-bounding-boxes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The Assessment Service now supports **optional bounding box extraction** as part
2020
### Core Capabilities
2121

2222
- **Optional Feature**: Disabled by default, enabled via configuration
23-
- **UI Compatible**: Outputs geometry format compatible with existing pattern-1 UI
23+
- **UI Compatible**: Outputs geometry format compatible with existing BDA mode UI
2424
- **Multi-page Support**: Handles bounding boxes across multiple document pages
2525
- **Error Resilient**: Gracefully handles invalid or incomplete bounding box data
2626
- **Coordinate Normalization**: Converts from 0-1000 scale to 0-1 normalized coordinates
@@ -325,7 +325,7 @@ if explainability_info:
325325

326326
## Integration with UI
327327

328-
The geometry format is fully compatible with the existing pattern-1 UI:
328+
The geometry format is fully compatible with the existing BDA mode UI:
329329

330330
- **Coordinate System**: Normalized 0-1 coordinates
331331
- **Bounding Box Format**: `{top, left, width, height}`

docs/classification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ The boundary detection is automatically included in the classification results.
172172
- Identifies distinct document segments within multi-page documents
173173
- Determines document type for each segment
174174
- Better suited for multi-document packets where context spans multiple pages
175-
- Deployed when you select the default pattern-2 configuration during stack deployment or update
175+
- Deployed when you select the default pipeline mode configuration during stack deployment or update
176176

177177
The default configuration in `config_library/unified/default/config.yaml` implements this approach with a task prompt that instructs the model to:
178178

lib/idp_common_pkg/idp_common/classification/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,14 @@ classes:
604604
"sender_address": "206 Maple Street P.O. Box 1056 Murray Kentucky 42071-1056",
605605
"recipient_name": "The Honorable Wendell H. Ford",
606606
# ... other expected attributes
607-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter1.jpg"
607+
imagePath: "config_library/unified/few_shot_example/example-images/letter1.jpg"
608608
- classPrompt: "This is an example of the class 'letter'"
609609
name: "Letter2"
610610
attributesPrompt: |
611611
expected attributes are:
612612
"sender_name": "William H. W. Anderson",
613613
# ... other expected attributes
614-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter2.png"
614+
imagePath: "config_library/unified/few_shot_example/example-images/letter2.png"
615615
```
616616

617617
### Configuration Parameters
@@ -629,12 +629,12 @@ The `imagePath` field now supports multiple formats for maximum flexibility:
629629

630630
**Single Image File (Original functionality)**:
631631
```yaml
632-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter1.jpg"
632+
imagePath: "config_library/unified/few_shot_example/example-images/letter1.jpg"
633633
```
634634

635635
**Local Directory with Multiple Images (New)**:
636636
```yaml
637-
imagePath: "config_library/pattern-2/few_shot_example/example-images/"
637+
imagePath: "config_library/unified/few_shot_example/example-images/"
638638
```
639639

640640
**S3 Prefix with Multiple Images (New)**:
@@ -767,7 +767,7 @@ classes:
767767
"to_address": "jane.smith@client.com",
768768
"subject": "FW: Meeting Notes 4/20",
769769
"date_sent": "04/18/2024"
770-
imagePath: "config_library/pattern-2/few_shot_example/example-images/email1.jpg"
770+
imagePath: "config_library/unified/few_shot_example/example-images/email1.jpg"
771771
772772
classification:
773773
task_prompt: |

lib/idp_common_pkg/idp_common/extraction/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ classes:
156156
"signature": "Will E. Clark",
157157
"cc": null,
158158
"reference_number": "TNJB 0008497"
159-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter1.jpg"
159+
imagePath: "config_library/unified/few_shot_example/example-images/letter1.jpg"
160160
- classPrompt: "This is an example of the class 'letter'"
161161
name: "Letter2"
162162
attributesPrompt: |
@@ -171,7 +171,7 @@ classes:
171171
"signature": "Bill",
172172
"cc": null,
173173
"reference_number": null
174-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter2.png"
174+
imagePath: "config_library/unified/few_shot_example/example-images/letter2.png"
175175
```
176176
177177
### Configuration Parameters
@@ -190,13 +190,13 @@ The `imagePath` field now supports multiple formats for maximum flexibility:
190190
**Single Image File (Original functionality)**:
191191

192192
```yaml
193-
imagePath: "config_library/pattern-2/few_shot_example/example-images/letter1.jpg"
193+
imagePath: "config_library/unified/few_shot_example/example-images/letter1.jpg"
194194
```
195195

196196
**Local Directory with Multiple Images (New)**:
197197

198198
```yaml
199-
imagePath: "config_library/pattern-2/few_shot_example/example-images/"
199+
imagePath: "config_library/unified/few_shot_example/example-images/"
200200
```
201201

202202
**S3 Prefix with Multiple Images (New)**:
@@ -427,7 +427,7 @@ classes:
427427
"priority": null,
428428
"thread_id": null,
429429
"message_id": null
430-
imagePath: "config_library/pattern-2/few_shot_example/example-images/email1.jpg"
430+
imagePath: "config_library/unified/few_shot_example/example-images/email1.jpg"
431431
432432
extraction:
433433
task_prompt: |
@@ -469,7 +469,7 @@ from idp_common.extraction.service import ExtractionService
469469
import yaml
470470
471471
# Load configuration with examples
472-
with open('config_library/pattern-2/few_shot_example/config.yaml', 'r') as f:
472+
with open('config_library/unified/few_shot_example/config.yaml', 'r') as f:
473473
config = yaml.safe_load(f)
474474
475475
# Initialize service

lib/idp_common_pkg/idp_common/rule_validation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ from idp_common.rule_validation import RuleValidationService
565565
from idp_common import s3
566566

567567
# Load configuration
568-
config_path = "../../config_library/pattern-2/rule-validation/config.yaml"
568+
config_path = "../../config_library/unified/rule-validation/config.yaml"
569569
with open(config_path, 'r') as f:
570570
config = yaml.safe_load(f)
571571

0 commit comments

Comments
 (0)