From d25448b69089fabe7fd886d0d9650c13fe811a77 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 21 Mar 2026 21:50:10 -0400 Subject: [PATCH] Fix normalized quantity basis --- build_purchases.py | 4 ++++ enrich_costco.py | 5 ++++- enrich_giant.py | 29 +++++++++++++++++++++-------- pm/data-model.org | 6 ++++++ tests/test_costco_pipeline.py | 20 ++++++++++++++++++++ tests/test_enrich_giant.py | 16 ++++++++++++++++ tests/test_purchases.py | 14 ++++++++++++++ 7 files changed, 85 insertions(+), 9 deletions(-) diff --git a/build_purchases.py b/build_purchases.py index 5facc9e..3784aa6 100644 --- a/build_purchases.py +++ b/build_purchases.py @@ -29,6 +29,8 @@ PURCHASE_FIELDS = [ "upc", "qty", "unit", + "normalized_quantity", + "normalized_quantity_unit", "pack_qty", "size_value", "size_unit", @@ -337,6 +339,8 @@ def build_purchase_rows( "upc": row["upc"], "qty": row["qty"], "unit": row["unit"], + "normalized_quantity": row.get("normalized_quantity", ""), + "normalized_quantity_unit": row.get("normalized_quantity_unit", ""), "pack_qty": row["pack_qty"], "size_value": row["size_value"], "size_unit": row["size_unit"], diff --git a/enrich_costco.py b/enrich_costco.py index de81351..c566615 100644 --- a/enrich_costco.py +++ b/enrich_costco.py @@ -37,7 +37,9 @@ DUAL_WEIGHT_RE = re.compile( LOGISTICS_SLASH_RE = re.compile(r"\b(?:T\d+/H\d+(?:/P\d+)?/?|H\d+/P\d+/?|T\d+/H\d+/?)\b") PACK_DASH_RE = re.compile(r"(?