CoupCoup (/ˈkʊkuː/)
A customizable, automatic, money-saving machine, powered by Google Gemini.
Inspiration
Extreme Couponing
Extreme Couponing - popularized by the TV show of the same name, is the process of matching store coupons with newspaper coupons to allow for bulk purchases of a product (or product sets) for very cheap.
This works because stores will allow for a "Store Coupon" or sale to be matched with a "Manufacturer Coupon", often provided in the newspaper or online. Some will allow you to double-up on coupons as well, depending on the store and coupon restrictions.
This process takes a ton of manual time and effort on the couponers part, mandating a need to grab the circulars, determining the sales, searching the newspaper for the coupons, determining matchups, and planning your route and list for each store.
Project Idea:
The project stemmed from the idea of pursuing a way to automate this process. How do we extract structured data from weekly ads, and provide them in a way that can be cross referenced with the available Newspaper Coupons so that we can maximize the redeemability of our coupons with the least amount of active maintenance.
The project then went through several iterations:
- No formatting
- "Fuzzy" formatting utilizing simple replacement operations
- Regex based feature extraction
But the project really came into view when the consideration of generative AI became a more available possibility.
What it does
CoupCoup is capable of extracting weekly ad data from 23 different stores, including:
| Acme Markets | Albertson's | Dollar General | Family Dollar |
| Fred Meyer | Fry's Food Stores | Food City | Food Lion |
| Giant Food | Hannaford | Harris Teeter | Hy-vee |
| H - E - B | Ingles | Jewel-Osco | KingSoopers |
| Kroger | Meijer | Publix | Rouses |
| Safeway | Shoprite | Smith's Food and Drug | Sprouts Farmers Market |
| Stop & Shop | Walgreens | Winn-Dixie |
It is also able to extract digital coupon data from the following stores:
| Dollar General | Family Dollar | Food City | Kroger |
| Newspaper | Coupons.com | Fry's Food Stores | Walgreens |
| Meijer | Fred Meyer | ShopRite |
Source: WiseVoter
By doing so, CoupCoup is able to cover the most popular grocery stores in 100% of States in the USA (where the store offers an online weekly ad, and accepts coupons)
How we built it
The project itself is split into 3 distinct stages:
Track
- Store Weekly Ads
- Online Coupons
- Sales
- Newspaper Coupons
Plan
- Matchup Comparison
- Coupon Clipping
- Finding Coupons
- Checking Coupon Validity
Execute
- Store Routing
- Sale Tracking/Search
Sale Detection:
The first step taken is to extract the data regarding the current sales happening at your local retailers. This process is handled in one of many ways:
Flipp-Based: Flipp is a service provider who specializes in the digitalization of weekly ad circulars. This is commonly used amongst retailers and offers a Base class to be inherited from. This allowed rapid expansion of the store availability set. Each store is labeled by a
store_codeand a publicaccess_token, unique to each store. By setting these within the configuration file, you can localize the results to your area.Browser Based: This uses
pyppeteerto navigate weekly ads that may not be available via a JSON based REST API.
Coupon Detection:
By utilizing publicly available sources, we can determine the coupons that are expected to be available within the next week's newspaper. By grabbing the products, brands, and coupon expiration dates, we can perform the analysis needed for the cross referencing of these coupons with the currently available sales at stores.
Grocery and Route Planning
During this process, we take the data retrieved from the first 2 steps, and combine it with the configuration data the user provided.
We utilize this information to do the following:
- By fuzzy matching the Brand, Product, and Variety, we can attempt to match the values within both datasets to correctly identify matchups that have both a coupon and a currently available sale.
- Once cross-referenced, we have the matched items by store. This allows us to identify which stores we need to visit, as well as which items to pick up while there. Even more so, it gives us the ability to easily search for desired products within our spreadsheet program of choice - no newspaper required.
- Once we have a list of stores to visit, we utilize openrouteservice and user provided geolocation data to query the location of those local stores, and give you an optimized map to hit each stop.
Challenges we ran into
- Because of the rate limits on the calls per minute to the AI Studio, and the token limits on Gemini-Pro-1.0, the amount of input data that can be processed is limited. This is mitigated by allowing the user to configure the concurrency of the store scraping
- Gemini has a few issues with maintaining the schema for function calls, so retries are often needed for invalid responses. A reprocess queue was added to mitigate this.
Accomplishments that we're proud of
- This project stemmed from a simple desire to replicate the show in an automated fashion. While I had pursued this project several years ago in multiple different, smaller fractions, this particular time felt like a true follow through on my original dream. The ability for Generative AI to produce structured output is critical for developers to use it in projects.
- The small additions like the product search, as well as the overall views that I was able to make ensure that the experience using the program was as seamless as possible for end users.
What we learned
- This project allowed me to hone my web parsing skills, and find new ways to grab data that may not involve things like Browser Based Automation
- I also loved learning just how much of this project could be abstracted into reusable, configurable components.
Cost
Another thing I was majorly focused on is the cost of the total run of the total run of the program. If the script costs too much to run, it would defeat the purpose of using it in the first place.
After testing with both AI Studio and Vertex AI - I am able to report that the script cost (at time of writing) ~$4.50 per run of all stores - this means that any savings provided over $4.50 is considered a profit!

Log in or sign up for Devpost to join the conversation.