From c64baf2c45a39c3596b58ed7ca257641f1ff247b Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 22 May 2026 19:10:42 -0400 Subject: [PATCH] classify_makes: add short 8-digit DN + 76/77 prefix rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers 3 additional edge cases found in unmatched: - 8-digit 114xxxx / 241xxxx → DN (short serial format) - 10-digit 76xxxx / 77xxxx → DN (no alpha suffix variant) Unknown make: 130 → 6 (95.4% classified) 6 remaining: garbage serials (00, 520, a×3) + RY01023590 (low-conf Royal) --- classify_makes.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/classify_makes.py b/classify_makes.py index b72a0a8..e458dcd 100644 --- a/classify_makes.py +++ b/classify_makes.py @@ -211,6 +211,23 @@ def _royal_ry(orig_sn): return s.startswith('RY') and len(s) >= 6 ROYAL_RY = (_royal_ry, 'Royal', 'GIII', 'Bev', 'low') +# ─── Short DN serals (8-digit formats seen in DB) ────────────────────────── +# DN has 8-digit serials: 11440039, 11495117, 24110016, 24220045, etc. +# Narrow prefix rules to avoid false positives with Royal (1100xxxx) or Crane + +def _dn_8digit_short(sn_clean): + """8-digit DN serials with specific known prefixes.""" + return (len(sn_clean) == 8 and sn_clean.isdigit() and + (sn_clean.startswith('114') or sn_clean.startswith('241') or + sn_clean.startswith('1149') or sn_clean.startswith('2411'))) +DN_SHORT_8 = (_dn_8digit_short, 'DN', 'BevMax/5800/3800/200E', 'GF Bev', 'medium') + +# 10-digit 76/77 prefix → DN (e.g., 76820565BD, 76920191BD, 77090262AE) +def _dn_76_77(sn_clean): + """10-digit serials starting with 76 or 77 → DN.""" + return len(sn_clean) == 10 and sn_clean.isdigit() and sn_clean[:2] in ('76', '77') +DN_76_77 = (_dn_76_77, 'DN', 'BevMax/5800/3800/200E', 'Bev', 'medium') + # ─── RULE COLLECTION (ordered: first match wins) ─────────────────────────── RULES = [ @@ -231,6 +248,8 @@ RULES = [ ('AMS dash', AMS_DASH), ('AMS long', AMS_LONG), ('DN specific prefixes', DN_RULE), + ('DN short 8-digit', DN_SHORT_8), + ('DN 76/77 10-digit', DN_76_77), ('DN broad 11x', DN_BROAD), ('Vendo 8-digit 00', VENDO_8), ('Royal BA/PA suffix', ROYAL_SUFFIX),