fix(address+ui): remove TIER 2 reuse, typed diff badges, false positive reduction
- Remove TIER 2 address lookup (county+city without street) from PL/SQL — creates new address when street differs instead of reusing wrong one - Replace generic "N diferente" badge with typed micro-badges (CUI, Denumire, TVA, Adr. livr., Adr. fact., Preturi) with red/amber semantic colors - Extend addrMatch() regex to strip full Romanian address words (STRADA, NUMAR, BLOC, COMUNA, SAT, MUNICIPIUL, etc.) — fixes "Strada X" vs "X" false positives - Extend normalize_company_name() for II, PFA, INTREPRINDERE INDIVIDUALA legal forms - Persist address_mismatch to SQLite so "Dif." filter includes address-only diffs - Add red/amber indicator dots to desktop table and mobile list rows - 12 unit tests for normalization and server-side address matching Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -183,8 +183,10 @@ def normalize_company_name(name: str) -> str:
|
||||
result = name.strip().upper()
|
||||
# Strip diacritics
|
||||
result = result.translate(_DIACRITICS)
|
||||
# Remove common suffixes
|
||||
result = re.sub(r'\b(S\.?R\.?L\.?|S\.?A\.?|S\.?C\.?|S\.?N\.?C\.?|S\.?C\.?S\.?)\b', '', result)
|
||||
# Remove common suffixes and legal forms
|
||||
result = re.sub(r'\b(S\.?R\.?L\.?|S\.?A\.?|S\.?C\.?|S\.?N\.?C\.?|S\.?C\.?S\.?|P\.?F\.?A\.?|INTREPRINDERE\s+INDIVIDUALA)\b', '', result)
|
||||
# Strip II only at start of name (avoid matching Roman numeral II in "TEHNICA II SRL")
|
||||
result = re.sub(r'^I\.?I\.?\s+', '', result)
|
||||
# Remove punctuation and extra spaces
|
||||
result = re.sub(r'[^\w\s]', '', result)
|
||||
result = re.sub(r'\s+', ' ', result).strip()
|
||||
|
||||
Reference in New Issue
Block a user