Consolidated 1099 Extractor Service
๐ 1099B-NonGovt-Extractor-Service Design
๐ Project Overview
Repository Name: poc-autoextract-platform-consolidated-1099-Extractor-Service
๐งญ Overview
Theย `Consolidated-1099-Extractor-Serviceย is a cloud-native Node.js microservice deployed on Azure Kubernetes Service (AKS). It automates the extraction of structured data from Consolidated 199 tax documents using Azure Document Intelligence and OpenAI. The service is triggered by messages from Azure Service Bus and publishes results to a downstream topic once processing is complete. Follow the Framework V2 format for all components
๐ Workflow Summary
- Trigger: Listens to theย
classified-fileย topic on Azure Service Bus.
- Download: Retrieves the document from Azure Blob Storage.
- Analyze: Uses Azure Document Intelligence and OpenAI to extract structured data.
- Merge: Combines outputs from both services into a unified JSON format.
- Upload: Stores the result back in Blob Storage.
- Notify: Publishes a message to theย
extracted-resultย topic with a result URL.
๐งฉ Component List
โ๏ธ Infrastructure
- Platform: Azure Kubernetes Service (AKS)
- Automation:ย https://spacelift.io/ย (manages AKS, Azure Service Bus, Key Vault, and Helm deployments)
- Secrets: Azure Key Vault + CSI Driver
- Observability: Azure Monitor, Application Insights
๐ File Structure
1099B-NonGovt-Extractor-Service/ โโโ src/ โ โโโ index.js โ โโโ config/ โ โ โโโ env.js โ โโโ messaging/ โ โ โโโ subscriber.js โ โ โโโ publisher.js โ โโโ services/ โ โ โโโ blobService.js โ โ โโโ pdfParser.js โ โ โโโ documentAI.js โ โ โโโ openAIExtractor.js โ โ โโโ resultMerger.js โ โโโ utils/ โ โโโ logger.js โโโ Dockerfile โโโ helm/ โ โโโ chart.yaml โโโ spacelift/ โ โโโ stacks/ โ โ โโโ aks-stack.yaml โ โโโ modules/ โ โโโ azure-kubernetes/ โ โโโ main.tf โโโ package.json โโโ README.md
๐งฉ Module Responsibilities
index.js
- Entry point
- Initializes environment and starts the subscriber
config/env.js
- Loads and validates environment variables
messaging/subscriber.js
- Subscribes toย
classified-fileย topic - Parses incoming payload:
messaging/publisher.js
- Publishes toย
extracted-resultย topic:
services/blobService.js
- Downloads and uploads blobs from Azure Blob Storage
services/pdfParser.js
- Parses PDF usingย
pdf-libย orยpdf2json - Extracts tables and text
services/documentAI.js
- Calls Azure Document Intelligence with custom model
services/openAIExtractor.js
- Sends prompt to Azure OpenAI
- Validates and refines LLM output
services/resultMerger.js
- Merges Document AI and LLM results
- Formats final JSON output
utils/logger.js
- Centralized logging with context and correlation IDs
๐งช Testing Strategy
- Unit Tests: Jest for all service modules
- Integration Tests: Mock Azure SDKs and Service Bus
- E2E Tests: Simulate full message flow in AKS dev cluster
๐ Deployment
- CI/CD: GitHub Actions โ Spacelift โ AKS
- Helm: Used for Kubernetes manifests
- Spacelift:
- Stack:ย
aks-stack.yaml - Modules:ย
azure-kubernetes/main.tf - Triggers: GitHub PRs and merges toย
main - Secrets: Managed via Spacelift + Azure Key Vault
- Stack:ย