Skip to content

ChijiokeDivine/barrel-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BAXUS Comparison Tool (Baxathon Winner)

This repository contains the source code for a Chrome extension designed to bridge the gap between traditional spirit retailers and the BAXUS marketplace. This project was developed for the Baxathon Hackathon, where it secured the 11k USD grand prize (with two other tools) in collaboration with Joel.

The extension programmatically identifies whiskey and wine products on third-party websites, queries the BAXUS API, and performs client-side fuzzy matching to highlight price discrepancies and potential savings.


Technical Architecture

The extension operates through a three-tier logic system to ensure accurate data extraction and matching.

1. Heuristic-Based Scrapping

The scrapeBottlesFromPage() function utilizes DOM traversal to identify product entities. It employs a combination of:

  • Selector Heuristics: Targets common e-commerce patterns (e.g., [data-testid="product-title"], .product-price).
  • Keyword Filtering: A whitelist of spirits-related terminology (e.g., single malt, bourbon, nikka) to prevent the scraper from attempting to price-match non-beverage items.
  • URL Pattern Recognition: Detects product detail pages (PDP) versus listing pages to optimize extraction strategy.

2. API Integration & Data Retrieval

The tool interfaces with the BAXUS API (https://services.baxus.co/api).

  • Fetching: It retrieves active listings using the /search/listings endpoint.
  • Normalization: Since external site metadata is often messy, the tool performs client-side normalization of search queries to better interface with the BAXUS catalog.

3. Matching & Similarity Algorithm

The core "intelligence" resides in the findMatches logic:

  • Term Extraction: Tokenizes product names and strips common stop-words (e.g., with, and, 70cl).
  • Jaccard Similarity: Implements a string similarity score between 0 and 1 based on character-set intersection.
  • Ranked Savings: Matches are sorted by the delta between the scraped price and the BAXUS listing price.

Installation & Setup

To load the extension in a development environment:

  1. Clone this repository to your local directory.
  2. Navigate to chrome://extensions/ in Google Chrome.
  3. Enable Developer mode via the toggle in the upper right corner.
  4. Click Load unpacked and select the root directory of this project.
  5. Ensure the BAXUS API endpoints are accessible from your network environment.

Technical Considerations

  • Async Messaging: The extension utilizes chrome.runtime.onMessage with sendResponse to handle asynchronous scraping tasks without blocking the UI thread.
  • State Management: It maintains a localized state of the BAXUS marketplace hits to reduce redundant API calls during a single browsing session.
  • Extensibility: The scraping logic is modular; site-specific scrapers can be injected into scrapeBottlesFromPage to handle sites with highly obfuscated DOM structures.

Contributors

About

A 11k USD Baxathon-winning Chrome extension that programmatically compares whiskey and wine prices on retail sites with BAXUS marketplace listings using fuzzy matching and Jaccard similarity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors