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

> Source: <https://dev.to/fauzan18296/building-pitchpassion-ai-transforming-football-passion-into-data-with-google-ai-4ooc>
> Published: 2026-07-10 18:35:41+00:00

*This is a submission for Weekend Challenge: Passion Edition*

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.

I will include a video demo link below.

**Video Demo:** [Video File](https://drive.google.com/drive/folders/139eY8ywVfvYyK3Sc6bVflpvPVtYBfjeB?usp=drive_link)

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

**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.

**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.

**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.

`503 Unavailable`

responses from the Google Gemini API. This was caused by traffic spikes on the server side.**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()`

.

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.
