[object Object]

← back to Fischbacher Onboard

Add Collezione Italia (60) + Benu Recycled (10) sub-lines; dedup on mfr_sku -> 202 patterns / 1345 colorways staged

20b86e5b94bc51b8f2a4880068c989049202c497 · 2026-07-22 09:30:35 -0700 · Steve Abrams

Files touched

Diff

commit 20b86e5b94bc51b8f2a4880068c989049202c497
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 22 09:30:35 2026 -0700

    Add Collezione Italia (60) + Benu Recycled (10) sub-lines; dedup on mfr_sku -> 202 patterns / 1345 colorways staged
---
 fetch_stage.py | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/fetch_stage.py b/fetch_stage.py
index a59a87b..af7d7df 100644
--- a/fetch_stage.py
+++ b/fetch_stage.py
@@ -9,11 +9,15 @@ import json, time, urllib.request, subprocess, sys
 GQL = "https://fischbacher1819.com/graphql"
 UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36"
 
-# category_uid -> (product_type, source_category)
-CATS = {
-    "MzA=": ("Fabric", "Fabrics > Christian Fischbacher"),
-    "NDI=": ("Wallcovering", "Wall Coverings"),
-}
+# (category_uid, product_type, line, priority) — all vendor "Christian Fischbacher".
+# Higher priority wins when a SKU is cross-listed (dedup on mfr_sku, not brand):
+# most-specific sub-line beats the main CF fabric bucket.
+CATS = [
+    ("MTA=", "Fabric",       "Benu Recycled",         3),
+    ("OQ==", "Fabric",       "Collezione Italia",     2),
+    ("NDI=", "Wallcovering", "Wall Coverings",        2),
+    ("MzA=", "Fabric",       "Christian Fischbacher", 1),
+]
 
 def gql(query):
     req = urllib.request.Request(GQL, data=json.dumps({"query": query}).encode(),
@@ -38,20 +42,23 @@ def fetch_category(uid):
         time.sleep(0.4)
     return items
 
-rows = []
-for uid, (ptype, srccat) in CATS.items():
+by_sku = {}  # mfr_sku -> (priority, row)
+for uid, ptype, line, prio in CATS:
     got = fetch_category(uid)
-    print(f"  {srccat}: {len(got)} patterns", file=sys.stderr)
+    print(f"  {line}: {len(got)} patterns", file=sys.stderr)
     for p in got:
+        sku = p["sku"]
+        if sku in by_sku and by_sku[sku][0] >= prio:
+            continue  # keep the more-specific line already recorded
         variants = [v["product"]["sku"] for v in (p.get("variants") or []) if v.get("product")]
         imgs = [g["url"] for g in (p.get("media_gallery") or []) if g.get("url")]
         primary = (p.get("image") or {}).get("url") or (imgs[0] if imgs else None)
         price = ((p.get("price_range") or {}).get("minimum_price") or {}).get("regular_price") or {}
-        rows.append({
-            "mfr_sku": p["sku"],
+        by_sku[sku] = (prio, {
+            "mfr_sku": sku,
             "pattern_name": p["name"],
             "product_type": ptype,
-            "source_category": srccat,
+            "source_category": line,
             "pdp_url": f"https://fischbacher1819.com/{p['url_key']}.html" if p.get("url_key") else None,
             "image_url": primary,
             "all_images": imgs,
@@ -63,6 +70,7 @@ for uid, (ptype, srccat) in CATS.items():
             "price_currency": price.get("currency"),
         })
 
+rows = [r for _, r in by_sku.values()]
 with open("data/fischbacher_staged.jsonl", "w") as f:
     for r in rows:
         f.write(json.dumps(r) + "\n")

← 4493f41 Onboard Christian Fischbacher: feed-first stage of 133 patte  ·  back to Fischbacher Onboard  ·  auto-save: 2026-07-22T09:43:01 (2 files) — data/ push_draft. 2b70920 →