Delivered remotely for a business based in Prague, Czech Republic. Names withheld by agreement.
Project Overview
Regional e-commerce shoppers often open a dozen browser tabs to verify whether a discounted washing machine or graphics card is genuinely cheaper once shipping fees, extended warranties, and stock status are factored in. Retail feeds across Central Europe vary wildly in schema quality, update cadence, and identifier hygiene, leaving conventional aggregator sites cluttered with duplicate listings and broken checkout links.
Engineered for a comparison commerce operator in Prague, we built a multi-retailer product price comparison platform with Python, Django, and React. The system ingests structured merchant feeds alongside targeted headless verification, links fragmented retail listings to canonical hardware and consumer-goods profiles, preserves verifiable price histories, and serves faceted search and instant price-drop alerts across web interfaces and partner APIs.
Market & Feed Fragmentation
Scaling price intelligence across hundreds of independent online stores exposed four recurring engineering obstacles:
- Dirty and inconsistent merchant feeds: Retailers submit nested XML feeds, flat CSV exports, and custom JSON endpoints with missing EAN barcodes, bundled accessories disguised as standalone units, and ambiguous shipping tiers.
- Duplicate canonical listings: Naive title matching splits one laptop configuration into dozens of separate product pages whenever merchants abbreviate RAM, storage, or localization codes differently.
- Stale stock and hidden delivery surcharges: Feed snapshots taken overnight fail to catch midday stockouts or mandatory pickup fees, eroding shopper trust at the moment of merchant click-out.
- Noisy alert storms: Temporary API glitches or rapid penny repricing bots can trigger repeated false-positive price-drop emails if alerts fire without hysteresis and verification checks.
Architectural Strategy
We separated canonical catalog curation in Django and PostgreSQL from high-throughput quote ingestion in Celery and low-latency discovery in Elasticsearch. Every incoming merchant line item enters a deterministic normalization stage before touching live search indices: barcode matches resolve immediately, while ambiguous items enter an attribute-scoring pipeline with confidence thresholds and an editorial review queue inside Django Admin.
Rather than overwriting prices on every crawl, the platform appends price-state transitions into a compressed PostgreSQL history table whenever a listing's net price, delivery cost, or availability changes. That design feeds transparent 30-day and 12-month price charts in React while powering EU Omnibus-compliant discount verification.
Core Capabilities
- Multi-Format Feed & DOM Ingestion: Streams merchant XML, CSV, and JSON feeds via scheduled Celery workers while selectively verifying high-demand items through Playwright headless browsers.
- Canonical SKU & Variant Clustering: Resolves listings using GTIN/EAN validation, manufacturer part numbers, and normalized attribute vectors so color or capacity variants stay cleanly grouped.
- Total-Landed-Cost Ranking: Calculates item price plus carrier-specific shipping, cash-on-delivery surcharges, and pickup availability in real time inside the React comparison table.
- Verifiable Price History & Fake-Sale Detection: Plots historical low, median, and rolling 30-day baseline prices directly from immutable quote transitions.
- Threshold & Back-in-Stock Alerts: Evaluates subscribed watchlists against validated price drops and dispatches throttled email or browser push notifications.
- Merchant Feed Diagnostics Portal: Surfaces feed parse errors, unmapped SKUs, and broken product URLs back to participating retailers through authenticated Django endpoints.
Technical Architecture
Ingestion workers fetch merchant catalogs on staggered intervals, hash unchanged payloads in Redis to skip redundant database writes, and push only modified quotes into PostgreSQL. Domain signals then project updated min-price summaries and facet counts asynchronously into Elasticsearch, keeping the Django REST API and React client responsive during bulk feed refreshes.
Flow: Merchant Feeds & Storefront DOM → Celery Python Parsers & Playwright Pool → Normalization & SKU Matcher → PostgreSQL Product & Price Ledger + Redis Cache → Elasticsearch Facet Index → Django REST API → React Comparison Storefront & Alert Dispatcher
Isolating Playwright extraction onto dedicated worker queues ensures heavy browser rendering never starves fast XML feed parsing or user-facing API traffic. Category-level webhooks and partner REST consumers read from the same Django serialized endpoints, keeping internal storefront views and external affiliate integrations aligned on pricing, stock badges, and shipping estimates.
Technology Stack
| Category | Technology detail |
|---|---|
| Comparison Storefront | React and TypeScript single-page interface for faceted search, spec tables, and price history charts |
| Core Application API | Python Django and Django REST Framework powering catalog curation, user alerts, and merchant portals |
| Quote & Ledger Storage | PostgreSQL persisting canonical products, merchant accounts, price-change time series, and alert rules |
| Search & Faceting | Elasticsearch indexing normalized attributes, brand facets, delivery windows, and live quote aggregates |
| Ingestion Workers | Celery worker queues parsing merchant XML, JSON, and CSV feeds plus incremental quote deltas |
| Headless Extraction | Playwright browser pools verifying dynamic JavaScript pricing and stock badges where feeds lack fidelity |
| Caching & Coordination | Redis managing crawl rate limits, deduplication bloom filters, and sub-second price-quote caches |
| Click & Feed Telemetry | Signed outbound redirect tracking and merchant feed health diagnostics exposed via REST endpoints |
| Alert Dispatch | Asynchronous email and web-push notification workers gated by cooldown and threshold rules |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Full-catalog browser scraping is slow, fragile, and triggers merchant IP blocks | Prioritized structured XML/JSON merchant feeds for baseline syncs and restricted Playwright checks to high-churn SKUs and pre-redirect spot checks, trading universal DOM coverage for crawl stability. |
| Fuzzy title matching occasionally merges different hardware SKUs (e.g., OEM vs. retail box) | Enforced hard blocks on mismatched EANs and numeric capacity attributes, routing medium-confidence pairs to a Django editorial triage queue rather than risking bad automatic merges. |
| Writing every identical hourly price poll bloats PostgreSQL time-series tables | Implemented change-only state persistence with Redis payload fingerprinting, storing rows only when price, shipping, or stock shifts; trades uniform sampling intervals for lean ledger storage. |
| Complex multi-facet category filters slow down relational SQL joins under load | Denormalized active quote aggregates and technical spec facets into Elasticsearch index documents updated via batched Celery projectors, accepting brief eventual consistency after feed imports. |
Anti-Scraping Resilience & Data Integrity
Automated price collection fails quickly if workers hammer origin servers or ingest malformed discount feeds. Every merchant domain carries a configurable token-bucket rate policy in Redis, respectful concurrency caps, and exponential backoff on transient HTTP errors. Playwright sessions reuse lightweight contexts with strict resource blocking for third-party ad scripts so price verification completes cleanly without saturating merchant bandwidth.
Before any scraped or feed-derived price updates a live listing, sanity validators check currency codes, VAT-inclusive formatting, and anomalous drop thresholds. Suspicious spikes—such as a decimal-point parsing bug turning a television into pocket change—quarantine automatically in Django for manual inspection instead of triggering thousands of false alert notifications. Outbound merchant click links carry HMAC-signed redirect tokens to prevent automated click-fraud inflation and protect affiliate attribution integrity.
Search Latency & Ingestion Throughput
Shoppers filter categories by dozens of technical attributes simultaneously while hundreds of merchant feeds refresh in the background. Django serves pre-rendered category shells and delegates faceted queries to Elasticsearch with shard routing tuned by category volume, while Redis caches hot product-detail quote matrices with targeted invalidation upon price-change events.
Bulk XML ingestion runs via streaming lxml iterators in Python rather than loading full multi-hundred-megabyte documents into memory. Delta comparison against cached item hashes ensures Celery workers only touch PostgreSQL rows that genuinely changed, keeping database I/O predictable during seasonal retail sales spikes. Reindexing pipelines run in zero-downtime alias swaps whenever category attribute schemas evolve, ensuring shoppers never experience partial search results.
Operational Outcomes
Consolidating feed parsing, canonical SKU matching, and historical price verification onto one unified platform improved catalog reliability for both shoppers and retail partners:
- Cleaner canonical product pages: Deterministic barcode joins paired with attribute validation eliminate fragmented duplicate listings across regional stores.
- Trustworthy discount transparency: Immutable price-change ledgers expose genuine historical lows and flag artificial pre-sale anchor markups before shoppers click through.
- Responsive faceted discovery: Offloading heavy multi-attribute filtering and quote aggregation to Elasticsearch keeps storefront browsing crisp even during peak promotional campaigns.
- Self-healing merchant onboarding: Automated feed validation reports in Django highlight missing identifiers and schema errors immediately, cutting manual catalog cleanup cycles.