Inspiration

We've all been there: you're in a group chat with friends trying to pick a restaurant, and it turns into an endless loop of "I don't know, what do you want?" followed by "I'm fine with anything." Twenty messages later, you're still starving and no closer to a decision.

I experienced this frustration one too many times and realized this is a perfect problem for AI to solve. Not just finding restaurants, but actually building consensus across different preferences—cuisines, dietary restrictions, budgets, and locations. That's when I discovered Yelp's AI API hackathon and saw the opportunity to build something genuinely useful.

## What it does

Group Consensus Builder lets friends create a shared session (no login required), where everyone submits their individual preferences:

  • Favorite cuisines
  • Dietary restrictions
  • Price range
  • Maximum distance they're willing to travel

Once everyone's submitted, the app uses a custom consensus algorithm to score restaurants from Yelp's database, weighing factors like cuisine matches, location convenience, price compatibility, and dietary accommodations. The result? Top 5 restaurants that actually work for everyone in the group.

Users can then make reservations directly through conversational AI powered by Yelp's beta reservation feature.

## How I built it

Architecture:

  • Frontend: React 18 with TypeScript, Tailwind CSS for styling, and Socket.io Client for real-time updates
  • Backend: Node.js/Express server with Socket.io for WebSocket connections
  • API Integration: Yelp AI API (chat/v2 endpoint) with multi-turn conversation support

The Consensus Algorithm: This was the most interesting technical challenge. I designed a weighted scoring system:

  • Cuisine matching (30%): Calculates what percentage of the group wants each cuisine
  • Location scoring (25%): Computes the geographic centroid of all participants, then scores restaurants by average distance
  • Price compatibility (20%): Ensures the restaurant fits within everyone's budget
  • Dietary restrictions (25%): Uses Yelp's rich business data to verify restaurants can accommodate all dietary needs

Real-time Collaboration: I implemented WebSocket architecture so participants see live updates when others join and submit preferences. This creates a collaborative experience rather than just a form-filling exercise.

Conversational Reservations: Integrated Yelp's beta conversational reservation feature, maintaining chat_id across requests to enable natural back-and-forth dialogue about availability and booking.

## Challenges I ran into

1. Geographic centroid calculations Calculating fair meeting points was harder than expected. I had to implement the Haversine formula to accurately compute distances accounting for Earth's curvature, not just straight-line Euclidean distance.

2. Consensus algorithm tuning Finding the right weight distribution took iteration. Initially, I weighted dietary restrictions at 40%, but this over-prioritized one person's needs. The current 25/30/25/20 split feels balanced after testing with real friend groups.

3. Handling edge cases What if there's zero cuisine overlap? What if someone wants $ and another wants $$$$? I had to add fallback logic that gracefully degrades when perfect consensus isn't possible, explaining why certain restaurants were chosen.

4. Socket.io state management Syncing state across multiple clients in real-time was tricky. I had to carefully manage session storage on the backend and emit targeted updates to prevent race conditions when multiple users submit simultaneously.

5. Yelp API response parsing The Yelp AI API returns incredibly rich data—business attributes, summaries, contextual snippets. Extracting dietary information from unstructured attributes required building flexible parsers that could handle varying data formats.

## Accomplishments I'm proud of

  • Solving a real problem: This isn't a toy project—it solves something I genuinely experience with my own friend groups
  • Algorithm design: Building a fair consensus system that balances competing preferences
  • Clean UX: Zero friction—no login, just share a link and go
  • Full-stack implementation: TypeScript throughout for type safety, WebSocket architecture, geospatial calculations
  • Deep API integration: Not just basic search—multi-turn conversations, beta features, rich data extraction

## What I learned

  • Geospatial algorithms: Implementing Haversine distance calculations and centroid computation
  • WebSocket architecture: Managing real-time state synchronization across distributed clients
  • Conversational AI patterns: Maintaining context across multi-turn interactions with chat_id
  • Consensus algorithms: Balancing competing constraints in group decision-making
  • API design patterns: How to structure backend services that wrap external APIs effectively

## What's next for Group Consensus Builder

  • Caching layer: Implement 24-hour caching of Yelp data to avoid hitting rate limits
  • Preference history: Let users save their common preferences for quick session creation
  • Enhanced dietary filters: Better AI-powered detection of dietary compatibility from reviews and menus
  • Mobile optimization: PWA support for better mobile experience
  • Analytics dashboard: Show group members visualizations of preference overlaps
Share this project:

Updates