How shalloe99/taxai works
1. Overall shape
- This repo is a Python backend for a tax-document processing workflow. The core path appears to be: uploaded/customer PDFs and form templates are ingested, text is extracted, document intent/type is classified, and data is stored or retrieved from local/vector and cloud-backed stores.
- The backend is the main executable subsystem; the frontend is mentioned in the README but not present in this tree.
2. HTTP/API boundary
- backend/app.py is the Flask entrypoint exposed on localhost:5001.
- backend/routes/routes.py is the request-routing layer, likely defining the service endpoints used by the UI or API clients.
- This boundary is where external callers enter the system before work is delegated into extraction, retrieval, or persistence modules.
3. Domain orchestration
- backend/modules.py likely acts as a coordination layer tying together extraction, classification, storage, and service clients.
- The repo structure suggests this is where document-processing use cases are assembled into end-to-end flows rather than isolated utilities.
4. Document extraction pipeline
- backend/retriever/data_extractor.py is the main data-ingestion component for PDF content.
- The README’s poppler dependency indicates PDF text/image extraction depends on native PDF tooling.
- This subsystem bridges raw tax forms, instructions, and customer documents into machine-usable text or chunks.
5. AI / retrieval subsystem
- backend/crews/ contains notebooks, knowledge assets, and two local Chroma databases (chroma_db, db), which strongly indicates vector search and/or LLM-driven classification workflows.
- The intent_classification.ipynb and crew_playground.ipynb notebooks suggest experimentation around document intent routing, probably feeding the production backend logic.
- backend/crews/knowledge/i8949.pdf is a seed knowledge artifact used for retrieval or prompting.
6. Local persistence for vectors/blobs
- backend/database/blobs_db.py, files_db.py, and id_generator.py define a storage abstraction for document identifiers, file/blob handling, and ID generation.
- The embedded Chroma SQLite files under backend/crews/ show that vector data is persisted locally for fast retrieval during development or single-node deployment.
- This local store is a distinct boundary from cloud persistence and likely used for search/index state.
7. Cloud integrations
- backend/service_clients/aws_client.py centralizes AWS connectivity.
- backend/database/s3/s3_bucket_store.py suggests S3 is used for document/object storage.
- backend/database/dynamodb/dynamodb_store.py suggests DynamoDB is used for structured metadata, status, or record indexing.
- backend/service_clients/mongo_db_client.py indicates an optional or parallel MongoDB integration, likely for document metadata or application state.
8. Data model and supported artifacts
- The resource/ tree is the main corpus: IRS forms, instructions, schemas, tests, and a sample customer package.
- Form families such as 1040, 1099-*, ScheduleA/B/C/D/E, and w-2 indicate the app is designed around tax document intake and classification.
- The resource/data/schema/*.json files imply schema-driven parsing or validation for at least some document types.
9. Processing inputs and test fixtures
- resource/first-customer/ contains realistic source documents grouped by life event/domain: wage, investment, property, school, and health.
- resource/data/tests/ and resource/data/forms/ provide canonical inputs for validating extraction/classification behavior.
- These assets are important for understanding the intended data flow: from mixed customer PDF bundles to normalized tax-document outputs.
10. Deployment and runtime
- The backend is packaged for local Python execution, Docker image build, and docker-compose orchestration.
- The README documents environment-based AWS credentials in .env, which means cloud connectivity is runtime-configured rather than hardcoded.
- The architecture therefore supports both local development with embedded Chroma storage and containerized deployment with external AWS dependencies.
11. Operational boundaries
- There is a clear split between:
- API layer (app.py, routes/)
- processing/orchestration (modules.py, retriever/)
- storage adapters (database/, service_clients/)
- knowledge/index assets (crews/)
- raw/form data (resource/)
- For an architecture diagram, these should be drawn as separate concerns with data flowing from request/API into extraction/classification, then into storage/search backends.
12. Likely end-to-end flow
- A client submits or selects a tax PDF set.
- The backend extracts document text and metadata.
- The system classifies the document/intent and may retrieve supporting knowledge from Chroma-backed indexes.
- Results and file references are persisted via S3/DynamoDB/Mongo abstractions, with local SQLite/Chroma used for vector state or development data.
Main entry points: modules.py Modules · data_extractor.py Extractor · intent_classification.ipynb Intent notebook · aws_client.py AWS client
Components 20
API layer
HTTP entrypoints and request routing
Processing
Extraction, orchestration, and retrieval/classification
- Modules · Coordinates end-to-end document processing flows
backend/modules.py - Extractor · Extracts text and metadata from incoming documents
backend/retriever/data_extractor.py - Intent notebook · Experimental intent classification and routing logic
backend/crews/intent_classification.ipynb - Playground · Interactive crew and retrieval experimentation
backend/crews/crew_playground.ipynb - Chroma index · Local Chroma database used for retrieval and classification state
backend/crews/chroma_db/chroma.sqlite3 - Vector DB · Secondary local Chroma database backing notebook workflows
backend/crews/db/chroma.sqlite3 - Knowledge PDF · Reference form used as retrieval knowledge
backend/crews/knowledge/i8949.pdf
Storage
Local and cloud persistence adapters
- Blobs DB · Stores blob or document payload references
backend/database/blobs_db.py - Files DB · Tracks file records and document metadata
backend/database/files_db.py - ID generator · Generates stable document or record identifiers
backend/database/id_generator.py - AWS client · Central AWS connectivity and credential setup
backend/service_clients/aws_client.py - S3 store · Persists documents and files in S3
backend/database/s3/s3_bucket_store.py - Dynamo store · Stores structured records and application state in DynamoDB
backend/database/dynamodb/dynamodb_store.py - Mongo client · Optional MongoDB integration for metadata or state
backend/service_clients/mongo_db_client.py
Assets
Tax form corpora, schemas, and sample customer documents
- Form corpus · Canonical IRS forms and instructions used for parsing and classification
resource/data/forms - Schemas · JSON schemas for selected document types
resource/data/schema - Test fixtures · Representative document sets for extraction and classification evaluation
resource/data/tests - Customer docs · Realistic mixed customer tax-document bundle
resource/first-customer
Connections 23
- App → Routes: dispatches · Flask app hands requests to routing layer
- Routes → Modules: invokes · Endpoints delegate work to orchestration layer
- Modules → Extractor: extracts · Processing flow starts by reading PDFs and document text
- Modules → Intent notebook: classifies · Orchestration likely uses intent routing logic developed in notebooks
- Modules → Playground: experiments · Notebook workflows inform or validate processing behavior
- Modules → Blobs DB: stores · Document payloads and references are persisted locally
- Modules → Files DB: indexes · File-level metadata is tracked for retrieval and state
- Modules → ID generator: assigns ids · Identifiers are generated before persistence
- Modules → AWS client: uses · Cloud adapters rely on shared AWS client setup
- AWS client → S3 store: connects · AWS connectivity supports object storage operations
- AWS client → Dynamo store: connects · AWS connectivity supports metadata persistence
- Modules → S3 store: uploads · Processed documents can be stored in S3
- Modules → Dynamo store: persists · Structured processing state is written to DynamoDB
- Modules → Mongo client: optionally uses · MongoDB is an alternate or parallel backend
- Extractor → Form corpus: reads · Extraction and classification operate on IRS form corpus
- Extractor → Schemas: validates · Structured output can be matched against schemas
- Extractor → Test fixtures: benchmarks · Test fixtures exercise extraction behavior
- Extractor → Customer docs: processes · Real customer document bundles are the main input shape
- Intent notebook → Chroma index: queries · Intent experiments use the local vector index
- Intent notebook → Vector DB: queries · Notebook workflows also reference a second local vector store
- Intent notebook → Knowledge PDF: retrieves · Reference documents provide retrieval context
- Playground → Chroma index: explores · Interactive retrieval and classification experiments
- Modules → Chroma index: searches · Production flow likely consults local retrieval state