[object Object]

← back to Designer Wallcoverings

kravet worklist: coalesce FTP new_map + GDrive master map_price (source-of-truth union, TK-10014)

aec137bb0c595ff73c89cd3d0e26fa74dc52e92f · 2026-07-28 11:48:17 -0700 · Steve

Closes the 123-product gap where a DWKK roll had a master MAP but no FTP feed row.
14,123 covered (14,000 ftp + 123 master); map_src column tags provenance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit aec137bb0c595ff73c89cd3d0e26fa74dc52e92f
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 28 11:48:17 2026 -0700

    kravet worklist: coalesce FTP new_map + GDrive master map_price (source-of-truth union, TK-10014)
    
    Closes the 123-product gap where a DWKK roll had a master MAP but no FTP feed row.
    14,123 covered (14,000 ftp + 123 master); map_src column tags provenance.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 shopify/scripts/gen-kravet-worklist-from-ftp.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/shopify/scripts/gen-kravet-worklist-from-ftp.sh b/shopify/scripts/gen-kravet-worklist-from-ftp.sh
index ae32303a..06d17722 100755
--- a/shopify/scripts/gen-kravet-worklist-from-ftp.sh
+++ b/shopify/scripts/gen-kravet-worklist-from-ftp.sh
@@ -12,20 +12,24 @@ DIR="$(cd "$(dirname "$0")" && pwd)"
 OUT="$DIR/data/kravet-map-pricing/kravet-map-worklist-latest.csv"
 mkdir -p "$(dirname "$OUT")"
 
-echo "shopify_id,dw_sku,brand,mfr_sku,cost_price,map,uom" > "$OUT"
+echo "shopify_id,dw_sku,brand,mfr_sku,cost_price,map,uom,map_src" > "$OUT"
+# Source-of-truth priority (TK-10014): FTP price-change feed new_map FIRST,
+# then the GDrive master map_price for SKUs the FTP feed doesn't carry.
 psql "host=/tmp dbname=dw_unified" -tA -F',' -c "
 select s.shopify_id,
        s.dw_sku,
        coalesce(s.vendor,''),
        s.mfr_sku,
-       coalesce(k.new_whls::text,''),
-       k.new_map,
-       coalesce(s.metafields->'global'->'Unit of measure'->>'value','')
+       coalesce(ap.new_whls::text, mp.whls_cost::text, ''),
+       coalesce(ap.new_map, mp.map_price),
+       coalesce(s.metafields->'global'->'Unit of measure'->>'value',''),
+       case when ap.new_map is not null then 'ftp' else 'master' end
 from shopify_products s
-join kravet_authoritative_pricing k on k.mfr_sku = s.mfr_sku
+left join kravet_authoritative_pricing ap on upper(ap.mfr_sku) = upper(s.mfr_sku)
+left join kravet_master_price mp on upper(mp.mfr_sku) = upper(s.mfr_sku)
 where s.dw_sku like 'DWKK-%' and s.status='ACTIVE'
   and s.has_product_variant = true
-  and k.new_map is not null and k.new_map > 0
+  and coalesce(ap.new_map, mp.map_price) > 0
 order by s.dw_sku;" >> "$OUT"
 
 n=$(( $(wc -l < "$OUT") - 1 ))

← d450effe kravet: feed MAP-reprice engine from LIVE FTP worklist, not  ·  back to Designer Wallcoverings  ·  TK-10002 Phase-2a: null-Sample + low-risk collision remediat 7ccd2e42 →