← back to Dw Material Reclassify
Add --all full-catalog scope; full run = 13% free / 9456 vision (~$5.67)
a3d8f0aeabacfe7b424105ac0915bf68e22585ca · 2026-07-22 08:50:50 -0700 · Steve
Files touched
Diff
commit a3d8f0aeabacfe7b424105ac0915bf68e22585ca
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Jul 22 08:50:50 2026 -0700
Add --all full-catalog scope; full run = 13% free / 9456 vision (~$5.67)
---
classify.py | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/classify.py b/classify.py
index 7251ad7..488ab10 100644
--- a/classify.py
+++ b/classify.py
@@ -78,7 +78,11 @@ def body_material(b):
return "Non-Woven", "body:non-woven"
return None
-SQL = r"""
+def build_sql(scope_all=False):
+ na = "" if scope_all else "and tags ilike '%New Arrival%'"
+ return SQL_TMPL.replace("__NA__", na)
+
+SQL_TMPL = r"""
with wc as (
select id, title, coalesce(vendor,'') vendor, coalesce(dw_sku,'') dw_sku,
coalesce(pattern_name,'') pattern_name,
@@ -86,7 +90,7 @@ with wc as (
lower(regexp_replace(tags,'color:[a-z ]+','','g')) as t
from shopify_products
where product_type='Wallcovering' and status='ACTIVE'
- and tags ilike '%New Arrival%' and tags is not null
+ __NA__ and tags is not null
)
select json_agg(json_build_object(
'id',id,'title',title,'vendor',vendor,'dw_sku',dw_sku,
@@ -96,8 +100,8 @@ where not (t ~ '(cork|grasscloth|paperweave|paper weave|sisal|jute|hemp|abaca|ra
and (t ~ '(woven|textured|texture)');
"""
-def load_rows():
- out = subprocess.run(["psql", "host=/tmp dbname=dw_unified", "-tAc", SQL],
+def load_rows(scope_all=False):
+ out = subprocess.run(["psql", "host=/tmp dbname=dw_unified", "-tAc", build_sql(scope_all)],
capture_output=True, text=True)
if out.returncode != 0:
sys.exit("psql error: " + out.stderr)
@@ -130,7 +134,8 @@ def classify(row):
def main():
show_samples = "--samples" in sys.argv
- rows = load_rows()
+ scope_all = "--all" in sys.argv
+ rows = load_rows(scope_all)
from collections import Counter, defaultdict
tier_counts = Counter()
fiber_split = Counter()
@@ -153,8 +158,9 @@ def main():
free = tier_counts["tier1_material_line"] + tier_counts["tier15_body"]
need = tier_counts["needs_vision"]
print("="*72)
- print(f"WAVE-1 RECLASSIFY — DRY RUN (no writes, no vision calls)")
- print(f"Target: NA Textured/Woven catch-all total={total}")
+ print(f"RECLASSIFY — DRY RUN (no writes, no vision calls)")
+ scope = "ALL collections (full catalog)" if scope_all else "New-Arrivals only"
+ print(f"Scope: {scope} Textured/Woven catch-all total={total}")
print("="*72)
print(f"Resolved FREE (text): {free:4d} ({free/total*100:.0f}%)")
print(f" - tier1 Material: line (authoritative) {tier_counts['tier1_material_line']:4d}")
← d5930f7 Wave-1 material reclassify dry-run: tiered free text classif
·
back to Dw Material Reclassify
·
auto-save: 2026-07-22T09:12:53 (3 files) — classify.py __pyc 5ef8ff1 →