DEV Community

Cover image for ReceiptSense - AI-Powered Grocery Receipt Analyzer
Pavan C
Pavan C

Posted on • Edited on

ReceiptSense - AI-Powered Grocery Receipt Analyzer

Redis AI Challenge: Real-Time AI Innovators

This is a submission for the Redis AI Challenge: Real-Time AI Innovators.

What I Built

ReceiptSense, an AI-powered receipt analyzer that helps people track spending, catch overpayments, and discover better grocery deals.**

It started as a simple idea: what if your grocery receipt could talk back? What if it could tell you where you overpaid, where you could’ve saved, and even how prices are trending over time?

So I built just that.

Users snap a photo of their receipt → OCR kicks in → Redis Stack handles the rest: semantic search, trends, insights, alerts. All in real time.

Whether it’s finding that you overpaid for almond milk or discovering Store A consistently beats Store B on certain items, ReceiptSense makes price awareness effortless.

Demo

Screenshots:

1. Upload Interface

Drag-and-drop support. OCR kicks in immediately.

upload

2. Price Comparison

Semantic search: type milk, get back whole milk, almond milk, and trend data.

price comparison 1

3. Smart Recommendations

Green = good deal. Red = overpriced. Simple.

price comparison 2

4. Receipt History

Track all past uploads, sorted by latest.

receipt history

How I Used Redis 8

🔍 Vector Search + Semantic AI

I used vector embeddings to match similar items—even when the names don’t exactly match.

// Store vectorized items for search
await client.json.set(itemKey, '$', {
  name: item.name,
  price: item.price,
  name_vector: embedding
});

// Query similar items
await client.ft.search('item_idx', '*=>[KNN 10 @vector $vec]', {
  PARAMS: { vec: vectorBuffer }
});
Enter fullscreen mode Exit fullscreen mode

Example:

Searching for “milk” brings up “whole milk”, “almond milk”, “oatmilk” — even if those terms weren’t used exactly.


📈 TimeSeries for Trend Analysis

I log prices over time and use Redis TimeSeries to generate insights.

await client.ts.add(`price:${itemName}`, Date.now(), price);
await client.ts.range(key, fromTime, '+', {
  AGGREGATION: { type: 'avg', timeBucket: 86400000 }
});
Enter fullscreen mode Exit fullscreen mode

Insight Examples:

  • “Price increased 8.2% in the last 24 hours”
  • “Lowest price last week: $2.89 at Kroger”

🔄 Real-Time Streams

Every receipt upload and price event goes through Redis Streams.

await client.xAdd('receipt-stream', '*', {
  event: 'receipt_uploaded',
  storeName,
  totalAmount: totalAmount.toString()
});
Enter fullscreen mode Exit fullscreen mode

That gives me a pipeline for triggering notifications, trend updates, or analytics dashboards in real time.


🧩 Multi-Model Redis Setup

Here’s how I structured the data:

  • JSON Documents: Items + metadata + vector embeddings
  • Hashes: Store receipt summaries and relationships
  • Sets: Tagging and category matching
  • Full-text Search + Vectors: Combined for smarter matching

AI-Driven Insights Generated

Insight Type Example
💰 Best Deal “Walmart: $2.99 (25% below avg)”
⚠️ Overpaid Alert “You paid $4.99, avg is $4.05 (+23.5%)”
🏪 Store Rankings “Target saves you $1.50 vs Kroger (last 5 receipts)”
📈 Price Trends “Almond milk up 8.2% this week”
🕒 Time Insights “Avg daily range: $2.99 - $5.49 (mean $4.12)”

Tech Stack

  • Frontend: Next.js 15 + Tailwind CSS
  • OCR: Tesseract.js (runs client-side)
  • Backend/DB: Redis Stack (JSON, Vectors, Streams, TimeSeries)

Why This Matters

Receipts are boring. But they hold valuable info.

With Redis Stack, I turned static pieces of paper into a live system that watches your grocery spending, helps you shop smarter, and shows you pricing trends most people never see.

That’s the real power of AI + real-time data.


If this idea sparks something for you or you'd like to collaborate—hit me up. Thanks for reading!

Top comments (0)