Skip to content

v0.2.0 — Compare products across chains (GTIN helpers)

Latest

Choose a tag to compare

@sashaboulouds sashaboulouds released this 01 Sep 14:24
aaac0d1

Compare across chains

Barcoded products share the same GTIN barcode everywhere, so it is the natural key for lining the same SKU up across chains.

  • group_by_gtin({"super-pharm": sp, "shufersal": sh}, min_sources=2) — join the same product across chains, canonicalizing UPC-12 / EAN-13 to GTIN-14 so encoding differences don't split one product in two.
  • item.gtin (canonical GTIN-14, or None) and item.is_barcoded on every price/promotion row. gtin rides along in model_dump() / to_df() / JSON as the join key.
  • to_gtin14() / is_valid_gtin() as standalone helpers.

item_code stays raw and faithful to the source; loose/weighted goods (fresh produce, deli — no shared barcode) resolve to None by design.

Thanks to the PyWeb-IL community for the nudge.