AI-powered document processing pipeline that accepts uploaded files, extracts text, classifies content, and persists structured output. The project is designed as a local-first Python implementation with a deployable AWS architecture built around API Gateway, S3, Step Functions, Lambda, Textract, Comprehend, and DynamoDB.
This repo demonstrates how to take a common document-ingestion problem and model it as a reliable event-driven workflow instead of a single monolithic script.
It showcases:
- asynchronous document processing with Step Functions and SQS-style buffering
- OCR and NLP enrichment using Textract-style and Comprehend-style adapters
- separation of ingestion, parsing, classification, and routing concerns
- a local development path that mirrors the cloud design
- Python package under
src/for ingestion, parsing, classification, and routing - local CLI for processing sample documents without cloud credentials
- AWS SAM template for the deployable cloud stack
- architecture diagram source in
architecture.py - unit tests under
tests/
The intended production flow is:
- A client uploads a document through an API endpoint.
- The raw file is stored in S3.
- Step Functions orchestrates parsing and classification work.
- Processing stages call Textract and Comprehend integrations.
- Structured results are written to DynamoDB and processed output lands in S3.
- CloudWatch metrics and alarms surface failures and pipeline health.
python3 -m unittest discover -s tests -v
PYTHONPATH=src python3 -m ai_document_processor.cli sample_documents/invoice.txt --output-dir outputsam build
sam deploy --guidedAfter deployment:
POST /documentsaccepts JSON withfilenameand base64content- raw uploads are stored in S3
- the Step Functions workflow processes the document asynchronously
- processed JSON is stored in the processed bucket and DynamoDB
.
|-- sample_documents/ # example local input files
|-- src/ # Python package and processing logic
|-- tests/ # unit tests
|-- template.yaml # AWS SAM stack
|-- architecture.py # diagram source
`-- architecture.png # rendered architecture diagram
- serverless workflow design for document pipelines
- practical use of OCR and NLP in an event-driven architecture
- local-first development for a cloud-targeted system
- clean decomposition of processing stages for scale and maintainability
python architecture.py