Building "PitchPassion AI": Transforming Football Passion into Data with Google AI
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. Demo I will include a video demo link below. Video Demo: Video File Code Back-End: Repository Back End 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: 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. Problem solving: 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