Most price-tracking prototypes fail for two boring architectural reasons—not because of the UI:
- Duplicate polling explodes your API bill. If 500 users track the exact same keyboard, a naive per-user cron job makes 500 upstream requests instead of 1.
-
Retailers name the exact same product differently. One store lists
"ProGasket 75 Keyboard", another lists"New Sealed ProGasket 75 Wireless Keyboard Free Shipping".
To solve both cleanly, I built PriceWatch Kit using a zero-dependency Python engine and a Flutter watchlist app.
1. Three-Tier Waterfall Product Normalization
Instead of relying on brittle string equality, every incoming listing is mapped to a single canonical_id:
def normalize_canonical_id(listing: RetailerListing) -> str:
# Tier 1: Deterministic GTIN / UPC / EAN
if listing.gtin and listing.gtin.strip():
return f"GTIN:{listing.gtin.strip().upper()}"
# Tier 2: Manufacturer Part Number
if listing.mpn and listing.mpn.strip():
return f"MPN:{listing.mpn.strip().upper()}"
# Tier 3: Normalized core title tokens
tokens = re.findall(r"[a-z0-9]+", listing.raw_title.lower())
stop = {"new", "sealed", "with", "free", "shipping", "the", "for", "edition"}
core = "-".join(t for t in tokens if t not in stop)[:48]
return f"TITLE:{core}"
When two retailers expose the same GTIN (or converge on the same core token signature), both listings collapse into one canonical product record.
2. Centralized Polling + SHA-256 Delta Caching
User watch rules (target_price or min_discount_pct) point to the canonical_id. Before triggering downstream alert evaluation, the poller hashes the sorted (retailer, price) tuple:
fingerprint = hashlib.sha256(
"|".join(f"{l.retailer}:{l.price:.2f}" for l in sorted(listings, key=lambda x: x.retailer)).encode()
).hexdigest()[:16]
if self.payload_hashes.get(canonical_id) == fingerprint:
self.cache_hits += 1
return {"changed": False, "best_price": self.latest_prices[canonical_id]}
If prices haven't moved since the last poll, downstream alert evaluators and push notifications are skipped completely.
3. Flutter Watchlist & Alert UI
On the client side, a lightweight PriceWatchProvider tracks baselinePrice, currentPrice, and targetPrice, computing savingsPct and surfacing active alerts immediately when a drop crosses the user's threshold.
Source Code, Commercial Bundle & Book
- Open-Source Repo (4/4 tests passing): github.com/mzulfaas/price-watch-kit
- Ready-to-Deploy Bundle on Gumroad ($39): mzulfaas.gumroad.com/l/twopai
- Full Anti-Bot & Pipeline Blueprint on Amazon Kindle ($9.99): Production Web Scraping & Resilient Data Pipelines
- Portfolio & All Kits: mzulfaas.github.io
Top comments (0)