extraction-pipeline
Skill329 starsChanged 7 days agoMIT-0View on GitHub
Use when changing the document processing pipeline, its configuration, or agentic extraction and table parsing.
In this repository42 other files it gives its agents.
- .claude/rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-modelSkill
- agent-capability-reviewSkill
- api-rbac-testSkill
- backend-lambdaSkill
- code-reviewSkill
- create-hf-dataset-prSkill
- curate-security-resultsSkill
- cut-release-changelogSkill
- dependabot-prsSkill
- documentationSkill
- fix-single-issueSkill
- frontend-uiSkill
- full-test-batterySkill
- infrastructureSkill
- live-auth-checksSkill
- live-eval-and-costSkill
- prepare-changelogSkill
- prep-develop-for-releaseSkill
- product-demoSkill
- pr-review-ciSkill
- pr-reviewSkill
- releaseSkill
- release-validationSkill
- remove-classification-flat-keysSkill
- repo-quality-reviewSkill
- run-benchmarksSkill
- run-stack-testsSkill
- srt-security-scanSkill
- sync-pii-anonymizerSkill
- testing-qaSkill
- test-upgradeSkill
- transform-deploy-testSkill
- ui-i18nSkill
- update-solution-profileSkill
- ux-test-ciSkill
- ux-testSkill
- ux-test-stories-ciSkill
- ux-test-storiesSkill
- work-the-backlog-hazardsSkill
- work-the-backlogSkill
The file
Files
Extraction Pipeline — Core Domain Logic — GenAI IDP Accelerator
Processing Flow
Documents → S3 Input Bucket → EventBridge → Queue Sender Lambda
→ SQS → Queue Processor Lambda → Step Functions
→ [OCR → Classification → Extraction → Assessment → Rule Validation → Summarization]
→ S3 Output BucketTwo Processing Modes
Controlled by use_bda flag in configuration:
Pipeline Mode (use_bda: false) — Default
- OCR: Amazon Textract (or Bedrock OCR backend)
- Classification: Bedrock LLM —
classification.strategyiscombined(one call returns boundaries and classes) orsplit_then_classify(boundaries first, then one classification call per section); the granularity,pageorpacket, isclassification.combined.granularityundercombinedandclassification.split_then_classify.splitting.llm.granularityundersplit_then_classify;modality.text/modality.imagesdecide what each call is sent - Extraction: Bedrock LLM — traditional or agentic mode
- Assessment: LLM-powered confidence assessment with multimodal analysis
- Rule Validation: Custom business rules (criteria validation)
- Summarization: Document summarization
BDA Mode (use_bda: true)
- End-to-end processing with Bedrock Data Automation (BDA)
- Handles packet or media documents
- Integrated OCR, classification, and extraction
- Then → Rule Validation → Summarization
Agentic Extraction with Table Parsing
For documents with large tables (100+ rows), bank statements, transaction logs:
extraction:
mode: advanced # selects the agentic path; agentic.enabled is derived from it
model: "us.anthropic.claude-sonnet-5"
agentic:
table_parsing:
enabled: true
max_empty_line_gap: 3 # Standard quality (0-10)
auto_merge_adjacent_tables: true
min_confidence_threshold: 95.0
min_parse_success_rate: 0.90extraction.modeis authoritative and overwritesagentic.enabledwhenever it is set, soagentic.enabled: truealone stays on the traditional path once the config is merged with amode- Strands agent framework for tool-based structured output
- Deterministic Markdown table parser for robust tabular data
- Intelligent lookahead recovery for OCR artifacts
- Auto-merge table fragments split by page breaks
- See
lib/idp_common_pkg/idp_common/extraction/README.mdfor details
Configuration System
Hierarchy
- System defaults (
idp_common/config/system_defaults/*.yaml) - Configuration presets (
config_library/unified/<preset>/config.yaml) - Custom overrides (via
CustomConfigPathparameter or CLI) - Stored in DynamoDB Configuration Table (gzip-compressed for large configs)
Config Structure (YAML)
use_bda: false
notes: "Description of this configuration"
classes:
- $schema: https://json-schema.org/draft/2020-12/schema
$id: DocumentType
type: object
x-aws-idp-document-type: DocumentType # Custom extension
description: >-
Description of the document class
properties:
FieldName:
type: string
description: "Field description"
x-aws-idp-evaluation-method: EXACT # see the method list belowCustom JSON Schema Extensions
x-aws-idp-document-type— Document class identifierx-aws-idp-evaluation-method— Evaluation metric typex-aws-idp-evaluation-method-config— Per-comparator options (e.g.DateComparator'sdayfirst,NUMERIC_EXACT's tolerance)x-aws-idp-examples— Few-shot example references. ⚠️ This is the declared spelling (X_AWS_IDP_EXAMPLESinidp_common/config/schema_constants.py). A misspelledx-aws-idp-*extension is accepted, stored, never read and never reported, so a typo here fails silently — no gate catches it.
Evaluation methods
The settable values of x-aws-idp-evaluation-method, from METHOD_TO_COMPARATOR in
idp_common/evaluation/stickler_backend/mapper.py (the authority — re-read it rather
than trusting this list):
| Method | Comparator |
EXACT | ExactComparator |
NUMERIC_EXACT | NumericComparator |
FUZZY | FuzzyComparator |
LEVENSHTEIN | LevenshteinComparator |
SEMANTIC | SemanticComparator |
DATE | DateComparator |
LLM | IDPLLMComparator (Bedrock-backed) |
HUNGARIAN | none — built in for arrays |
Configuration presets
Located in config_library/unified/, one directory per preset, the directory name
being the Configuration Preset stack parameter value. lending-package-sample is
the default. Enumerate the rest with ls config_library/unified/ — they are added and
renamed often enough that a list here goes stale.
Presets are not keyed by processing mode: use_bda resolves to false for every
one of them, and each preset's notes says to set use_bda: true for BDA mode.
Key Models and Types (idp_common.models)
from idp_common.models import Document, Page, Section, Status
class Status(str, Enum):
QUEUED = "QUEUED"
IN_PROGRESS = "IN_PROGRESS"
COMPLETE = "COMPLETE"
FAILED = "FAILED"
...
class Document(BaseModel):
id: str
input_bucket: str
input_key: str
status: Status
pages: list[Page]
sections: list[Section]
...Concurrency Management
- DynamoDB atomic counter for workflow concurrency
MaxConcurrentparameter limits Step Functions executions- Queue Processor manages back-pressure via SQS visibility timeout
Human-in-the-Loop (HITL)
Built-in review system for human validation:
- Documents flagged by assessment module
- Review UI in the web interface
- Status transitions: IN_PROGRESS → REVIEW → APPROVED/REJECTED
Evaluation Framework
- Baseline data in S3 Evaluation Baseline bucket
stickler-evallibrary for accuracy metrics- Per-field evaluation methods: EXACT, NUMERIC_EXACT, FUZZY
- Configuration versioning for A/B testing
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

