How pushpak1203/vat works
VAT Chain Auditor is a Python CLI for evidence-grounded cross-border VAT audits. A user supplies transaction JSON or an invoice image; the CLI invokes the orchestrator, which normalizes input, classifies the transaction, assesses risk and anomalies, applies VAT rules, optionally retrieves legal evidence and runs LLM reasoning, calibrates confidence, and returns an audit result. The graph preserves the documented operating modes and optional Gemma capability. Relationships are limited to calls visible in excerpts or the source index; several documented capabilities have no sampled implementation details.
Main entry points: orchestrator.py Audit orchestrator · vat_rules_engine.py Rules engine · retriever.py Legal retriever · main.py CLI entry
Components 26
CLI and orchestration
- CLI entry
main.py - Audit orchestrator
pipeline/orchestrator.py - Transaction schema
utils/schema.py
Transaction analysis
- Invoice extraction
pipeline/ocr_extraction.py - LayoutLM extractor
models/layoutlmv3_extractor.py - Transaction classifier
pipeline/transaction_classifier.py - DeBERTa classifier
models/deberta_classifier.py - Risk scoring
pipeline/risk_scoring.py - LightGBM model
models/lightgbm_model.py - Anomaly detection
pipeline/anomaly_detection.py
VAT rules
- Rules engine
pipeline/vat_rules_engine.py - EU VAT rules
vat_rules/eu_vat_rules.py - UK VAT rules
vat_rules/uk_vat_rules.py - OSS/IOSS handling
vat_rules/oss_ioss_handler.py - VAT exemptions
vat_rules/exemptions.py
Legal evidence
- Legal RAG facade
pipeline/legal_rag.py - Legal retriever
rag/retriever.py - Legal embedder
rag/embedder.py - Vector store
rag/vector_store.py - Evidence reranker
rag/reranker.py
Reasoning and results
- LLM reasoning
pipeline/llm_reasoning.py - Model loader
models/model_loader.py - Optional Gemma
models/gemma_optional.py - Confidence calibration
pipeline/confidence_calibration.py - Audit result
utils/schema.py
Other components
- Auditor
Connections 25
- Auditor → CLI entry: supplies input
README.md - CLI entry → Audit orchestrator: runs audit
main.py - Audit orchestrator → Transaction schema: validates input
pipeline/orchestrator.py - Audit orchestrator → Invoice extraction: extracts invoices
pipeline/orchestrator.py - Invoice extraction → LayoutLM extractor: uses layout model
pipeline/ocr_extraction.py - Audit orchestrator → Transaction classifier: classifies transaction
pipeline/orchestrator.py - Transaction classifier → DeBERTa classifier: delegates classification
pipeline/transaction_classifier.py - Audit orchestrator → Anomaly detection: detects anomalies
pipeline/orchestrator.py - Audit orchestrator → Risk scoring: scores risk
pipeline/orchestrator.py - Risk scoring → LightGBM model: uses model
pipeline/risk_scoring.py - Audit orchestrator → Rules engine: evaluates rules
pipeline/orchestrator.py - Rules engine → OSS/IOSS handling: checks scheme
pipeline/vat_rules_engine.py - Rules engine → VAT exemptions: checks exemption
pipeline/vat_rules_engine.py - Rules engine → UK VAT rules: routes UK cases
pipeline/vat_rules_engine.py - Rules engine → EU VAT rules: routes other cases
pipeline/vat_rules_engine.py - Audit orchestrator → Legal RAG facade: requests evidence
pipeline/orchestrator.py - Legal RAG facade → Legal retriever: delegates retrieval
pipeline/legal_rag.py - Legal retriever → Legal embedder: embeds query
rag/retriever.py - Legal retriever → Vector store: searches vectors
rag/retriever.py - Legal retriever → Evidence reranker: reranks candidates
rag/retriever.py - Audit orchestrator → LLM reasoning: requests reasoning
pipeline/orchestrator.py - LLM reasoning → Model loader: loads language model
pipeline/llm_reasoning.py - Audit orchestrator → Confidence calibration: calibrates confidence
pipeline/orchestrator.py - Audit orchestrator → Audit result: builds audit result
pipeline/orchestrator.py - Model loader → Optional Gemma: optional integration
models/gemma_optional.py