Skip to content

service_invoice — Overview

Invoice processing and extraction service. Responsible for orchestrating invoice retrieval from Gmail, organizing files, creating evaluation reports, and performing PDF analysis and metadata extraction.

Directories:

  • endpoints/ — Per-router reference pages for API endpoints (download, gmail CRUD, utilities).
  • services/ — Internal service implementation documentation (Gmail manager, Sheets manager, connection manager, PDF processing).

Contents

Endpoint reference

Service implementation docs

Primary API prefix: /api/v1/invoice (router-local paths are shown in per-endpoint pages)

Important notes:

  • Google credentials required: Activate a Google credential record (GoogleCredentials) and ensure Gmail & Sheets APIs are enabled.
  • Background tasks: Long-running downloads run in background tasks and create their own DB SessionLocal() to avoid lifecycle issues.
  • WebSocket progress: The download flow reports progress via a WebSocket (/ws) using Connection_Manager.
  • PDF tooling: PDF rendering and analysis use WeasyPrint/pdfkit/imgkit/Playwright and PyPDF2; ensure native dependencies are available in Docker.

See endpoint docs in endpoints/ and service docs in services/ for details and examples.