AI-powered Romanian accounting document OCR and audit system. Processes invoices (Facturi), receipts (Bon Fiscal), and other fiscal documents, extracting structured data and running a multi-dimensional confidence audit.
- 📄 Supports PDF and image inputs
- 🤖 Multi-provider AI: Gemini, OpenAI, OpenRouter
- 🧮 6-dimension confidence scoring system
- 🇷🇴 Romanian CUI validation via ANAF API
- 📊 Export to XML (e-Factura, SAGA formats)
⚠️ Automatic human-review flagging for low-confidence documents
Install dependencies and configure environment:
pip install -r requirements.txt
cp .env.example .envEdit .env and add your API Keys (Gemini, OpenAI, or OpenRouter). If you use Vertex AI, provide the path to your google-credentials.json.
Run the server:
uvicorn main:app --reloadLocated in the ContaDesktop/ folder.
- .NET SDK 10.0+
- (Optional) Avalonia Templates:
dotnet new install Avalonia.Templates
cd ContaDesktop
dotnet runUse the included build script to package the .app bundle:
cd ContaDesktop
chmod +x build_app.sh
./build_app.shThe output will be in ContaDesktop/publish/.
- Backend:
main.py(FastAPI),export_engine.py(logic),xml_generator.py(XML formatting). - Desktop UI:
ContaDesktop/MainWindow.axaml(UI layout) andContaDesktop/MainWindow.axaml.cs(C# logic).
Credentials: Never commit .env or google-credentials.json. These are listed in .gitignore. Ensure you have these files locally before running the app.
POST /process — Upload a document for OCR and audit.
Returns structured JSON with extracted fields, confidence scores per dimension, and export-ready XML.
| Dimension | Weight | What it checks |
|---|---|---|
| Field Completeness | 20% | All required fields present |
| Line Item Math | 25% | qty × price ≈ line total |
| Global Math | 20% | Sum of lines ≈ invoice totals |
| CUI Validation | 15% | ANAF registration check |
| Value Plausibility | 10% | Valid VAT rates (date-aware), no negatives |
| Cross-Reference | 10% | net + VAT = gross, date logic |
Documents scoring < 0.85 are flagged for human review.