TaxDoc Extractor Service
๐ Project Overview
Repository Name: poc-autoextract-platform-taxdoc-extractor-service
๐ Overview
The Document Extraction Service is a containerized Node.js application that listens to Azure Service Bus messages on the classified-file topic. Upon receiving a message, it orchestrates a local workflow to:
Download and prepare a PDF document from Azure Blob Storage. Submit the document to Azure Cognitive Services for analysis. Poll for the result. Publish a success message to the extracted-result topic. This replaces the Camunda BPMN-based orchestration with a lightweight, in-code orchestration model. The service is deployed to Azure Kubernetes Service (AKS) using Spacelift for infrastructure automation.
Follow the Framework V2 format for all components
๐งฉ Components
๐ Low-Level Design (LLD)
1. Message Handling
- Subscriber: Listens to
classified-filetopic. - Payload:
2. Orchestration Flow
prepareDocument():
Downloads the PDF from childUrl. Filters pages based on docType mapping. Uploads the filtered PDF to a prepared folder.
extractDocument():
Streams the prepared PDF. Submits it to Azure Cognitive Services. Retrieves the operation-location.
pollForResult():
Polls the operation-location until status === succeeded. Extracts and stores the analyzeResult.
publishResult():
Sends a message to extracted-result topic:
3. Error Handling
Centralized retry logic with exponential backoff. Graceful failure publishing (optional dead-letter queue). Logging and alerting for diagnostics.
๐๏ธ File Layout
๐งช 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:ย