How at2345/challenge_cto works
The product is a local invoice-to-booking MVP: users upload PDFs, review extracted fields and governance results, correct yellow cases, and inspect a proposed booking. The backend orchestrates text extraction, privacy handling, deterministic or optional semantic field extraction, rule evaluation, and proposal generation, with MongoDB persistence and audit logging. The frontend exposes this workflow and PDF preview. Main pipeline and API relationships are supported by the sampled excerpts; optional LLM wiring and broader UI capabilities are also documented in the README.
Main entry points: main.py Invoice API · App.tsx Workflow UI · api.ts API client · engine.py Rule evaluator
Components 23
Review interface
- Workflow UI
frontend/src/App.tsx - API client
frontend/src/services/api.ts - Invoice selector
frontend/src/components/InvoiceSelector.tsx - PDF preview
frontend/src/components/PdfPreview.tsx - Field editor
frontend/src/components/ExtractedDataForm.tsx - Validation results
frontend/src/components/ValidationResults.tsx - Traffic status
frontend/src/components/TrafficLightBadge.tsx - Booking display
frontend/src/components/BookingProposalTable.tsx
Invoice processing
- Invoice API
backend/src/main.py - PDF text loader
backend/src/extraction/pdf_loader.py - PII pseudonymizer
backend/src/security/anonymizer.py - Regex extraction
backend/src/extraction/field_extractor.py - Optional LLM extraction
backend/src/extraction/llm_extractor.py
Rules and booking
- Rule evaluator
backend/src/rules/engine.py - Validation rules
backend/src/rules/validators.py - Account suggestion
backend/src/rules/account_suggester.py - Proposal builder
backend/src/accounting/proposal_builder.py
Data and privacy
- Master data
backend/src/master_data.py - Mongo access
backend/src/database.py - Memory vault
backend/src/security/memory_vault.py
Other components
- User
- MongoDB
- OpenAI-compatible model
Connections 23
- User → Workflow UI: uploads and reviews
- Workflow UI → Invoice selector: renders
- Workflow UI → PDF preview: renders
- Workflow UI → Field editor: renders
- Workflow UI → Validation results: renders
- Workflow UI → Traffic status: renders
- Workflow UI → Booking display: renders
- Workflow UI → API client: requests
- API client → Invoice API: calls API
- Invoice API → PDF text loader: extracts PDF text
- Invoice API → PII pseudonymizer: pseudonymizes text
- Invoice API → Regex extraction: fallback extraction
- Invoice API → Optional LLM extraction: optional extraction
- Invoice API → Rule evaluator: evaluates fields
- Invoice API → Proposal builder: builds proposal
- Invoice API → Mongo access: reads and writes
- Invoice API → Master data: uses fallback data
- Rule evaluator → Validation rules: runs checks
- Rule evaluator → Account suggestion: suggests account
- PII pseudonymizer → Memory vault: retains mappings
- Optional LLM extraction → OpenAI-compatible model: sends sanitized text
- Mongo access → MongoDB: queries and stores
- API client → Invoice API: fetches PDF