Week 11 Worklog

Week 11 Objectives:

  • Optimize the full-stack OCR pipeline to support high-volume parallel batch processing and reduce end-to-end latency.
  • Implement robust infrastructure scaling and resilience mechanisms, specifically targeting AI API rate limits and memory-intensive fallback scenarios.
  • Resolve critical synchronization and connectivity bugs within the concurrent upload and polling systems.

Tasks to be carried out this week:

DayTaskStart DateCompletion DateReference Material
2Project - OCR Latency & Edge Cases:
• Reduce latency from 45s to 18.8s by bypassing local OCR when Gemini is active
• Fix math discrepancies in C# logic and implement “Auto-interpolation” for missing tax data
• Implement “Read-then-Destroy” for Ghost Bug (404) and fix OcrReviewModal display
23/03/202623/03/2026
3Project - Batch Processing & Optimization:
• Rewrite upload flow for concurrent uploads using Promise.all() and semaphores
• Implement Smart Polling with 15s initial delay and 5s intervals
• Refactor Worker Service to prevent “greediness” and local RAM pressure
24/03/202624/03/2026
4Project - Scaling & AI Resilience:
• Reconfigure CloudWatch alarms for precise SQS-based Auto Scaling
• Resolve Gemini 429 rate limit issues and fix OOM failures during local AI fallback
• Upgrade ECS Fargate tasks to 2 vCPU / 8 GB RAM and perform zero-downtime rollout
25/03/202625/03/2026
5Project - Batch Upload Reliability:
• Fix net::ERR_CONNECTION_REFUSED by tuning uploadSemaphore limits
• Refactor polling logic to be independent per invoice (removing blocking loops)
• Sync Worker timeouts (300s) with SQS Visibility Timeout for heavy AI tasks
26/03/202626/03/2026
6Project - Pipeline Performance:
• Transition all frontend polling to parallel execution via Promise.all()
• Increase upload bandwidth utilization (max: 5 concurrent streams)
• Implement resumePollingForInvoice recovery mechanism for browser refreshes
27/03/202627/03/2026
7Project - Infrastructure & Local AI:
• Configure Step Scaling Policies for ECS Fargate based on SQS queue depth
• Debug and fix LayoutLMv3 model loading paths within Docker containers
• Verify AI Fallback resilience during simulated 429 quota exhaustion
28/03/202628/03/2026

Week 11 Achievements:

  • Successfully reduced average processing latency from 45s to 18.8s by optimizing the AI orchestration workflow.
  • Stabilized the production environment with dynamic ECS scaling policies and enhanced worker resilience (5-minute keep-alive).
  • Validated a zero-interruption AI fallback mechanism that handles Gemini API quota exhaustion by gracefully switching to local models.