Inspiration

We’ve all had that feeling in the grocery aisle: the bag of chips feels lighter, the candy bar looks smaller, but the price tag hasn’t budged. This is Shrinkflation—a subtle form of inflation where manufacturers reduce the quantity of a product while maintaining its sticker price.

While standard inflation is easy to track (price goes up), shrinkflation is invisible because it requires tracking the relationship between price and weight over time. As students and consumers, we wanted to build a tool that brings transparency back to the shopping experience. We wanted to answer one simple question: "Am I actually paying more for less?"

What it does

ShrinkWatch is a "value watchdog" that allows users to paste a URL from any major grocery retailer (Walmart, Loblaws, Metro, etc.). The application instantly:

  • Extracts the current price and net weight (normalizing units like kg, g, lb, oz).
  • Calculates the true "Unit Price" (Price per Gram).
  • Visualizes the hidden inflation trend, flagging products where the price has remained stable but the value has plummeted due to weight reduction.

How we built it

We built ShrinkWatch as a full-stack application optimized for speed and data accuracy:

  • Frontend: Built with Next.js and Tailwind CSS for a responsive, modern UI. We used Recharts to visualize the "Shrinkflation Gap"—the divergence between price and weight.
  • Backend: A lightweight Python FastAPI service that handles the logic and data processing.
  • The Engine: The core of our project is the Yellowcake API.

The Math Behind the Detection

To detect shrinkflation, we don't just look at the price ($P$). We calculate the Unit Price ($U$) using the extracted weight ($W$):

$$U_t = \frac{P_t}{W_t}$$

We then calculate the "Hidden Inflation Rate" ($I_{hidden}$) between time $t_0$ (past) and $t_1$ (present):

$$I_{hidden} = \left( \frac{\frac{P_{t1}}{W_{t1}} - \frac{P_{t0}}{W_{t0}}}{\frac{P_{t0}}{W_{t0}}} \right) \times 100$$

If $P_{t1} \approx P_{t0}$ but $W_{t1} < W_{t0}$, our dashboard triggers a "Shrinkflation Alert."

Challenges we ran into

The biggest challenge was dealing with the "Unstructured Web" and the Lack of Historical Data.

  • The Data Void: We discovered that no open APIs exist for historical grocery weights. Retailers overwrite old data, erasing the evidence of shrinkflation. This forced us to innovate by building a Hybrid Engine that combines live extraction with a verified dataset of known "offenders" (sourced from consumer watchdogs).
  • Inconsistent HTML: Walmart puts weight in the title ("Lays Classic 235g"), while Loblaws hides it in a table (<td>Weight</td><td>0.235 kg</td>).
  • Brittle Scrapers: Traditional scrapers (using CSS selectors like div.product-price) break whenever a retailer updates their website layout.
  • Unit Chaos: Converting "1.5 lbs", "24 oz", and "0.5 kg" into a standardized metric (grams) is a nightmare using standard Regex.

How we leveraged the Yellowcake API

This is where Yellowcake saved our project. Instead of writing custom scrapers for every single grocery store, we used Yellowcake's semantic extraction.

We didn't write code to find the "price tag div." We simply sent a prompt:

"Extract the product name, the current price, and the net weight in grams. Normalize all units to grams."

Yellowcake acted as a universal adapter, turning messy, unstructured HTML into clean, mathematical JSON. It allowed us to support any retailer immediately, without writing specific logic for each one.

Accomplishments that we're proud of

  • Universal Compatibility: Our tool works on sites we didn't even test, because the API understands the context of a product page regardless of the underlying code.
  • Real-Time Unit Conversion: We successfully offloaded the complex logic of unit normalization (lbs to g) to the extraction layer.
  • The "Aha!" Moment: Seeing the graph finally render a dip in weight while the price line stayed flat was incredibly satisfying—it proved the concept instantly.

What we learned

  • We learned that semantic extraction is far superior to structural scraping when dealing with diverse data sources.
  • We gained experience integrating Python FastAPI with a Next.js frontend to create a seamless user experience.
  • We discovered just how difficult it is to standardize grocery data, and how powerful LLMs can be at cleaning up that messy data.

What's next for ShrinkWatch

  • Browser Extension: Automatically alerting users while they browse Amazon or Instacart.
  • Community Database: Allowing users to "submit" shrinkflation finds to a public leaderboard of "Worst Offenders."
  • OCR Integration: Using Yellowcake to read weight from product images when the text description is missing.

Built With

  • fastapi
  • git
  • javascript-frameworks:-next.js
  • lucide-react-tools:-git
  • next.js
  • npm
  • pandas
  • python
  • react
  • recharts
  • tailwind
  • tailwind-css-apis:-yellowcake-api-libraries:-pandas
  • typescript
  • yellowcake
Share this project:

Updates