DEV Community
Follow
Can an AI tell a rivalry's story without inventing the score?
The Rivalry Engine is a Snowflake-powered application designed to analyze and narrate the history and intensity of football team rivalries. It processes 150 years of match data using SQL to calculate a rivalry's "heat" and assigns a one-word description of its shape. The system then predicts the outcome of the next match using a Snowpark Elo model. Cortex is utilized to narrate the story of the rivalry, strictly using facts computed in SQL. A key design principle is that the AI never invents facts. If two teams have never met, the application honestly indicates an "unwritten first chapter" and does not engage the AI. The entire application, including data, analytics, and AI, runs within Snowflake, with nothing leaving the data warehouse. This ensures data security and deterministic results grounded in reality. The user interface is built with Streamlit within Snowflake, meaning no external hosting or API keys are required. The architecture emphasizes separating factual data computation in SQL from the creative narration provided by Cortex. This project aims to move beyond simple scoreboards to capture the emotional essence of sporting rivalries.