Building "PitchPassion AI": Transforming Football Passion into Data with Google AI

작성자

카테고리:

← 피드로
DEV Community · Ahmad Fauzan · 2026-07-11 개발(SW)

Ahmad Fauzan

This is a submission for Weekend Challenge: Passion Edition

What I Built

I built PitchPassion AI, a web application that transforms text-based football match narratives into informative player performance visualizations using AI. The goal is to help fans quickly understand statistics without having to read lengthy reports.

Why is it named PitchPassion AI?

I named this project PitchPassion_AI because I wanted to unite two things I love: my passion for football and my technical curiosity regarding artificial intelligence (AI).

On one hand, there is ‘Pitch,’ representing the field where all the action and emotion unfold. On the other, there is ‘Passion,’ symbolizing the dedication of fans and players alike. This application serves as a bridge, leveraging ‘AI’ to translate the emotions and performance of the pitch into meaningful data insights.

Demo

I will include a video demo link below.
Video Demo: Video File

Code

  1. Back-End: Repository Back End
  2. Front-End: Repository Front End

How I Built It

  • Tech Stack: React for front end, Flask for back end, Google Gemini API.
  • AI Integration: The biggest challenge in sports data analysis is the unstructured nature of the data sources. Match reports typically consist of lengthy paragraphs written by journalists or narratives from spectators. While humans can easily read them, computers (databases) cannot directly process such text into charts or graphs.

This is where I utilize the Google Gemini API as a data extraction engine:

  1. Natural Language Processing (NLP): Gemini reads the match narrative to comprehend the context—identifying the players involved, the actions performed (goals, assists, tackles), and the quality of those actions.

  2. Structured Transformation: I provide specific instructions (prompts) to the model so that it not only understands the text but also transforms it into a JSON format.

  3. Data Cleaning: Since AI sometimes includes conversational text in its output, I implemented middleware in Flask to clean the response and ensure that only pure JSON data enters my application.

  • Problem solving:
  1. API Stability Issues (Error 503) During development, I frequently encountered 503 Unavailable responses from the Google Gemini API. This was caused by traffic spikes on the server side.
  • Solution: I didn’t let the application simply fail. I implemented a retry strategy in my Flask backend. If the API failed due to server load, the system would automatically wait for 2 seconds and retry up to three times before returning an error message to the user. This made the application feel more robust and professional.

Inconsistent Data Formatting
Another major challenge was the AI’s tendency to be “too chatty.” Instead of providing pure JSON data, the AI ​​would often include introductory text like “Here is the data you requested…” This caused my frontend application to fail when parsing the data.

  • Solution: I implemented two layers of protection:

  • Prompt Engineering: I reinforced the system instructions with the command: “Provide only the JSON, without any additional explanation.

  • Backend Sanitization: I added a cleaning function in Python using replace() and strip() to remove Markdown characters (such as '''json) before passing the data to json.loads().

Prize Categories

I am submitting this project for the Best use of Google AI category.

PitchPassion AI relies entirely on the Google Gemini API to bridge the gap between unstructured sports narratives and structured data visualization. By leveraging Gemini’s natural language processing capabilities, the application is able to extract player names and performance scores from messy, human-written match reports in real-time. Without the sophisticated data extraction power of Google AI, transforming narrative content into the dynamic charts displayed in this app would not have been possible.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다