## Store Profiles System
- Add ProfileRegistry for CUI-based profile lookup
- Add BaseStoreProfile with generic extraction patterns
- Implement hot-reload via POST /api/data-entry/ocr/profiles/reload
## 12 Store Profiles
- LIDL: Multi-rate TVA (A, B, C, D codes)
- OMV, SOCAR: B2B with client CUI, YYYY.MM.DD dates
- BRICK, DEDEMAN: Standard TVA, e-factura support
- KINETERRA, BEST PRINT: Non-VAT payers (returns [])
- STEPOUT MARKET: TVA 5% (books/reduced rate)
- UNLIMITED KEYS: NUMERAR payment detection
- GAMA INK, ELECTROBERING, PICTUS VELUM: Standard TVA
## Flexible TVA Patterns
- All patterns use (\d{1,2})% to accept any rate
- Supports historical (19%, 9%, 5%) and current (21%, 11%)
## Payment Methods Fix
- Fixed base.py to support multiple payments of same type
- Changed deduplication from method-only to (method, amount) tuple
- Returns separate entries for split payments
## Tools
- Add generate_store_profile.py for automatic profile generation
- Analyzes PDFs via OCR API and detects patterns
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
"""
|
|
BEST PRINT TRADE ACTIV SRL store profile for OCR extraction.
|
|
|
|
Stamp manufacturing service. Non-VAT payer (neplătitor de TVA).
|
|
"""
|
|
|
|
from typing import List, Dict, Any
|
|
|
|
from .base import BaseStoreProfile
|
|
from . import ProfileRegistry
|
|
|
|
|
|
@ProfileRegistry.register
|
|
class BestPrintProfile(BaseStoreProfile):
|
|
"""
|
|
BEST PRINT TRADE ACTIV SRL - non-VAT payer profile.
|
|
|
|
Key characteristics:
|
|
- Non-VAT payer (neplătitor de TVA) - NO TVA on receipts
|
|
- Stamp manufacturing and printing services
|
|
- Total amount has no TVA component
|
|
- CARD payment typical
|
|
"""
|
|
|
|
CUI_LIST = ["45417955"]
|
|
NAME_PATTERNS = ["BEST PRINT", "BESTPRINT", "BEST PRINT TRADE", "BEST PR1NT"]
|
|
STORE_NAME = "BEST PRINT TRADE ACTIV SRL"
|
|
|
|
def extract_tva_entries(self, text: str) -> List[dict]:
|
|
"""
|
|
Extract TVA entries - returns empty for non-VAT payer.
|
|
|
|
BEST PRINT is a non-VAT payer (neplătitor de TVA),
|
|
so no TVA entries are expected on receipts.
|
|
|
|
Args:
|
|
text: Raw OCR text from receipt (unused)
|
|
|
|
Returns:
|
|
Empty list (non-VAT payer has no TVA)
|
|
"""
|
|
# Non-VAT payer - no TVA entries
|
|
return []
|
|
|
|
def get_validation_hints(self) -> Dict[str, Any]:
|
|
"""Return BEST PRINT-specific validation hints."""
|
|
return {
|
|
"has_multi_rate_tva": False,
|
|
"card_equals_total": True,
|
|
"has_client_cui": True, # May have client CUI
|
|
"has_efactura": False,
|
|
"is_non_vat_payer": True, # CRITICAL: Non-VAT payer
|
|
"tva_pattern": "none",
|
|
}
|