← back to Dw Photo Capture
Scan lookup driven by the OCR'd label code: a VISUAL-only identify no longer beats the printed model# — the wallpaper-file lookup now prefers the OCR'd code (so 217500 gets searched even when identify 'found' a visual match), and every scan shows '📄 read: <codes>' so mis-reads are visible on-device. No-code-read state guides toward a clearer label photo
a7f6374c1a1b8030380fd1b8986d7fa1b20cea84 · 2026-07-08 13:14:09 -0700 · Steve Abrams
Files touched
Diff
commit a7f6374c1a1b8030380fd1b8986d7fa1b20cea84
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 8 13:14:09 2026 -0700
Scan lookup driven by the OCR'd label code: a VISUAL-only identify no longer beats the printed model# — the wallpaper-file lookup now prefers the OCR'd code (so 217500 gets searched even when identify 'found' a visual match), and every scan shows '📄 read: <codes>' so mis-reads are visible on-device. No-code-read state guides toward a clearer label photo
---
public/index.html | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/public/index.html b/public/index.html
index 3ee09a6..12d9293 100644
--- a/public/index.html
+++ b/public/index.html
@@ -178,6 +178,7 @@
.wp-d-row{display:flex;justify-content:space-between;gap:8px;font-size:12px;border-bottom:1px dotted #2a2721;padding-bottom:3px}
.wp-d-lbl{color:#8f887a}.wp-d-val{color:#eadfc6;font-weight:600;text-align:right}
.wp-d-desc{margin-top:8px;font-size:11px;color:#b3aa93;line-height:1.4}
+ .fb-read{margin-top:6px;font-size:11px;color:#8f887a;font-family:ui-monospace,Menlo,monospace;word-break:break-word}
.fb-search{display:flex;gap:7px;margin:10px 0 2px}
.fb-search input{flex:1;min-width:0;padding:9px 11px;font-size:14px;border:1px solid var(--line);border-radius:9px;background:#0f0e0b;color:#eadfc6}
.fb-search input::placeholder{color:#6f6857}
@@ -1535,15 +1536,22 @@ async function fbIdentify(){
$('#fbGo').disabled=true; $('#fbNote').textContent='Identifying…'; $('#fbResult').innerHTML='';
try{
const r=await(await fetch('/api/identify-multi',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({back:_fbBack,front:_fbFront,qr:_fbQR})})).json();
- if(!r.found){ const oc=r.code||(r.back_read&&(r.back_read.top||((r.back_read.candidates||[])[0])))||'';
- if(oc){ $('#fbNote').innerHTML=`No exact match for <b>${oc}</b> — searching the wallpaper file…`; wallpaperSearch(oc); }
- else { $('#fbNote').textContent='No confident match — try a clearer/closer photo, or type part of the SKU below.'; $('#fbResult').innerHTML=fbVisualHtml(r.visual); }
+ // what the OCR actually read off the label (codes with a digit) — the model# is what runs down the SKU
+ const ocrCands=(r.back_read&&r.back_read.candidates)||[];
+ const ocrTop=r.code||(r.back_read&&r.back_read.top)||ocrCands[0]||'';
+ const readLine=ocrCands.length?`<div class="fb-read">📄 read: ${ocrCands.slice(0,6).join(' · ')}</div>`:'';
+ if(!r.found){
+ if(ocrTop){ $('#fbNote').innerHTML=`No exact match for <b>${ocrTop}</b> — searching the wallpaper file…`+readLine; wallpaperSearch(ocrTop); }
+ else { $('#fbNote').innerHTML='No code read — try a clearer/closer photo of the label, or type part of the SKU below.'+readLine; $('#fbResult').innerHTML=fbVisualHtml(r.visual); }
$('#fbGo').disabled=false; return; }
const p=r.primary, conf=(r.confidence||'').replace('-','');
const via=r.source==='qr'?'🔗 QR':r.source==='code'?'📄 label code':'🎨 visual';
- $('#fbNote').innerHTML=`Source: ${via}${r.corroborated?' · ✓ front+back agree':''}`;
+ $('#fbNote').innerHTML=`Source: ${via}${r.corroborated?' · ✓ front+back agree':''}`+readLine;
$('#fbResult').innerHTML=`<div class="fb-hit">${p.image?`<img src="${p.image}">`:''}<div><b>${p.pattern||p.mfr_sku||p.dw_sku||'—'}</b><span class="fb-conf ${conf}">${r.confidence}</span><br><small>${[p.vendor,p.dw_sku,p.mfr_code].filter(Boolean).join(' · ')}</small></div></div>`+`<div id="fbWpDetails"></div>`+fbVisualHtml(r.visual);
- loadWallpaperDetails(p); // pull the master product record from the WALLPAPER FileMaker file
+ // WALLPAPER lookup: trust a CODE/QR identify; but a VISUAL-only match doesn't beat the printed model# —
+ // so prefer the OCR'd label code for the file lookup, falling back to the identified code.
+ const byCode=(r.source==='code'||r.source==='qr');
+ loadWallpaperDetails({ dw_sku: byCode?p.dw_sku:'', mfr_code: byCode?(p.mfr_code||p.mfr_sku):(ocrTop||p.mfr_code||p.mfr_sku), _ocr: ocrTop });
if(!_fbLookup){ matchIncoming(p); checkSampleRequest(p.dw_sku||p.mfr_code, p.mfr_code); } // Check-Sample-In: flag the incoming match + print popup; pure Look-Up SKU skips both
}catch(e){ $('#fbNote').textContent='Failed: '+e.message; }
$('#fbGo').disabled=false;
@@ -1556,7 +1564,7 @@ async function loadWallpaperDetails(p){ const box=$('#fbWpDetails')||$('#fbResul
let r; try{ r=await(await fetch(`/api/wallpaper-details?sku=${sku}&code=${code}`)).json(); }catch(e){ box.innerHTML=''; return; }
if(!r||!r.ok||!r.found||!r.details){ // exact miss → try a partial/fuzzy lookup
box.innerHTML='<div class="wp-d-hd wp-d-empty">No exact wallpaper-file record — searching partial…</div>';
- wallpaperSearch(p.mfr_code||p.mfr_sku||p.dw_sku||'', box); return; }
+ wallpaperSearch(p.mfr_code||p.mfr_sku||p.dw_sku||p._ocr||'', box); return; }
const d=r.details;
const rows=[['Mfr #','mfr_pattern'],['Collection','series'],['Width','width'],['Repeat','repeat'],
['Retail','retail'],['Net','net'],['Cost','cost'],['Roll','roll_size'],['Minimum','minimum'],
← 5cea2c8 Scan fixes: (1) scrub DW's OWN header from identification —
·
back to Dw Photo Capture
·
visual-search: add POST /similar (SKU->CLIP visual neighbors c68081a →