USA Wrapped

By Sagar Sahu for the 2026 Team USA x Google Cloud Hackathon

Inspiration

I've been heavily involved in the Google Developer community since my early college days, and I've been passionate about finding new and cool ways to apply Google AI/Cloud tech. At the same time, moving away from home and working full-time has opened up new doors for me to explore new things, including athletics. I'm a little ashamed to say that I don't know much about the Olympics, and usually I don't really pay attention to it or find out about trending news until a few days after events. However I would like to change that.

Likewise, I've watched countless Instagram stories of my friends posting their Spotify Wrapped boards and it proved that personalization is one of the most powerful forces in consumer technology. Everyone shares their Wrapped. Literally everyone.It's deeply personal, surprising, and fun. So the question became: what if you could get a "Wrapped" for your athletic identity — powered by real Team USA performance data?

With LA28 on the horizon and a city about to host the Games for the third time, it felt like the perfect moment to build something that connects everyday Americans to the Team USA legacy in a way that's personal, data-driven, and awe-inspiring (and actually useful to someone like me and those who don't follow the Olympics closely).


What it does

USA Wrapped is a personalized, AI-powered athletic identity platform. You enter your physical metrics — height, weight, strength, agility, endurance, and wingspan — and the app generates your unique Team USA Athletic Archetype using Gemini.

Beyond the archetype, you get a full bento-style dashboard built around your profile:

  • Medal Distribution — Team USA's historical podium breakdown at US-hosted Games
  • Participation Trend — Decade-by-decade growth of the US Olympic delegation
  • US State Heat Map — A D3-powered geographic visualization of Team USA's strongest states
  • Physical Metrics Radar — Your personal stats overlaid against a historical profile
  • Ask Gemini — A live AI historian chat grounded in official teamusa.com content, with Google Search grounding so it cites real sources
  • Coaching Corner — Quirky historical Team USA trivia generated by Gemini AI
  • Surprise Me — An AI-powered button that generates a compelling research question if you don't know where to start

Every piece of data is strictly filtered to Team USA athletes only, at US-hosted Games only, with all individual athlete identities anonymized to ensure full NIL compliance.


How we built it

Frontend: Built with Next.js 14 and TypeScript, styled with Tailwind CSS and Framer Motion for smooth micro-animations. The hero background is a custom GLSL WebGL shader rendered via Three.js, giving the landing page a dynamic, living feel. The dashboard is a bento-grid layout that adapts each tile to its content density.

Data Pipeline: A Python ETL script (scripts/etl.py) processes the raw "120 Years of Olympic History" Kaggle dataset. It filters strictly for Team USA athletes (NOC = USA) at US-hosted Games, anonymizes all athlete names via MD5 hashing, and outputs a clean, compliance-safe usa_athletes.json that ships inside the production Docker container.

AI Layer: All generative features run on Gemini 2.5 Pro via the @google/genai SDK with Vertex AI. The chat system uses a dual-grounding architecture:

  1. Local grounding — Injects state-specific athlete records from usa_athletes.json into the system prompt
  2. Live grounding — Uses Gemini's native googleSearch tool to retrieve and cite real-time content from teamusa.com

Server-side prompt hardening enforces strict NIL compliance (no individual athlete names), correct Olympic terminology, and output format validation at every generation call.

Infrastructure: The entire app is containerized in a multi-stage Docker build and deployed to Google Cloud Run with automatic CI/CD via Cloud Build — every GitHub push triggers a new deployment. Credentials are secured via Secret Manager, and a real-time NIL compliance audit dashboard is built in Cloud Logging.


Challenges we ran into

1. Gemini API Response Instability Early in development, the response.text getter in the @google/genai SDK would throw uncaught exceptions when Gemini's safety filters blocked a response — crashing the entire API route. We had to replace all direct .text accesses with deep optional chaining on the candidates array and implement character-length and format validation before any string was returned to the client.

2. Data Compliance as an Architectural Constraint The hackathon's NIL and data rules weren't just legal requirements — they fundamentally shaped the architecture. We couldn't use athlete names anywhere in the stack. This meant designing a hash-based anonymization system in the ETL pipeline, building prompt guardrails into every Gemini call, and adding server-side validation to catch edge cases where the AI returned only a partial title like "The" before being filtered.

3. Cloud Run Deployment Blockers Getting the first successful deployment required solving three separate build failures in sequence: a misconfigured Dockerfile path using a local Mac file path instead of a repo-relative path, ESLint errors blocking the Next.js production compiler, and empty page stub files (archetype.js, region.js) that Next.js treated as invalid routes. Each fix required a full Cloud Build cycle.

4. Vertex AI Search Domain Verification We initially planned to use Vertex AI Search to index teamusa.com directly, but GCP requires domain ownership verification before crawling a URL — and we don't own teamusa.com. We pivoted to Gemini's native googleSearch grounding tool, which achieves the same result (real-time, cited content from teamusa.com) without requiring domain ownership and with significantly less infrastructure complexity.

5. The Fragmented AI Response Problem The "Surprise Me" button, which uses Gemini to generate research questions, intermittently returned truncated text like "Which US" instead of complete questions. The root cause was a 50-token output limit that wasn't enough headroom for longer questions. We fixed this by increasing the token budget, adding a validation gate (minimum 15 characters, must end with ?), and building a curated fallback pool of high-quality, compliant questions that activate when the AI response fails validation.


Accomplishments that we're proud of

  • Zero NIL violations by design — The system is architecturally incapable of naming individual athletes. This isn't enforced by a content filter after the fact; it's baked into the data model, the ETL pipeline, and every AI prompt simultaneously.
  • A genuinely personal experience — Entering your own metrics and receiving an AI-generated archetype that feels specifically tailored to you is a surprisingly emotional moment. "The Versatile Competitor" or "The Endurance Machine" lands differently when it's based on your actual physical profile.
  • Production-grade infrastructure for a hackathon — Cloud Run with GitHub CI/CD, Secret Manager, and Cloud Logging is a real production deployment stack, not just a demo. Every push to GitHub automatically deploys a new revision.
  • Dual-grounding RAG architecture — Combining static local data with live web search grounding in a single Gemini call is a pattern most production AI apps don't implement, let alone hackathon projects.

What we learned

  • Defensive AI coding is non-negotiable. Gemini's responses are probabilistic. Any production system that depends on a specific output format will break without server-side validation. We learned to treat every AI response as "untrusted input" until proven otherwise.
  • Cloud infrastructure decisions have cascading effects. Choosing Docker + Cloud Run meant we needed to ensure usa_athletes.json was copied into the container at build time — a subtlety that would have caused silent data failures in production if missed.
  • Data compliance shapes design from day one. Trying to add compliance as an afterthought is almost impossible. The most elegant solutions — like MD5 hashing athlete IDs in the ETL pipeline — only work if they're baked in from the beginning.
  • The best pivot is the one that removes complexity. Switching from Vertex AI Search (which required domain verification) to Gemini's native googleSearch tool eliminated an entire infrastructure layer while delivering a better result. Sometimes the "simpler" solution is actually the more powerful one.

What's next for USA Wrapped

  • LA28 Integration — As Los Angeles prepares to host the Olympic and Paralympic Games again in 2028, we want to build a live "Road to LA28" tracker that updates in real time as Team USA qualifies athletes across disciplines.
  • Paralympic Expansion — The current dataset focuses primarily on Olympic history. A dedicated Paralympic performance profile — with its own archetype system and specialized coaching tips — would make the experience more inclusive and complete.
  • Share Your Wrapped — A Spotify Wrapped-style shareable card (generated via html2canvas) that lets users post their Athletic Archetype to social media, driving organic discovery.
  • State-Level Leaderboards — A public, aggregated view of which states produce the most Team USA athletes across disciplines — without any individual-level data — turning the heat map into a live, competitive feature.
  • Gemini Live Voice Mode — Replace the text chat with a real-time voice conversation with your AI Team USA historian, using Gemini's multimodal audio capabilities.

Built With

Share this project:

Updates