Project Artifacts

Requirements:

RequirementsStatus
Full Stack WebsiteCompleted
Fully Functioning In-House APICompleted
Display NBA Game InformationCompleted
Display Live NBA Game InformationCompleted
Deploy to Server to Run 24/7Completed
Automate Data PipelineCompleted
Develop In-House Prediction Model to Generate AI-Based PredictionsCompleted
Incorporate Sentiment Analysis From Social MediaCompleted
Develop Bet Tracking SystemCompleted
User Authentication SystemCompleted
Logging and Monitoring SystemsCompleted

 

Design/Prototyping:

Screen Flow Diagram:

https://excalidraw.com/#json=yLnmF4UY1-IcLmTKm9gcU,FjW9T1eJT3Pkl8sM8sM5_g 

Tech Stack:

  • Frontend: Angular, NGINX
  • Backend: FastAPI
  • Database: PostgreSQL
  • API: NBA_API
  • AI Tools: Gemini 
  • Data Pipeline: Celery

Data Flow:

Data/User flow chart

App Views:
 

Login/Sign Up Pages: Users will use these pages to either create an account or log in to a already existing account.

Log In Screen

Sign Up Screen

 

 

 

 

 

 

 

Home Page: The User can select whether to view past, present, or future games. They can also login/signup if they aren't logged into an account, click on games to view game specifics/place bets. Each game will consist of the home and away teams, with their corresponding logos, scores (if the game is live OR completed) and the pregame prediction is always present for all games. Live game predictions appear only when a game is on going, and that live prediction (and score) will update when game updates are received. 

Future games (not logged in)Past Games (not signed in)

 

Home Page (Not Signed Up)

 

Live games (not logged in)

 

Game Card View: This is the view that pops up when a user clicks on a game:

Game Card View

 

Live Game View

My Bets View: When a user is logged in and clicks on the "See All" button, they are taken to this screen.

Betting page

 

Demos/Lightning Talks:

Final Report:

Live. Laugh. Lock.

 

Developed by: Christian Ordaz, Jonah Hamell, Jacob Lehrman, and Jacob Russell

Developed for: Fatema Siddika

Course: 402C - CS Senior Design

Instructor: Simanta Mitra

TA: Junhyung Shim

 

 

Requirements:

Our project had the following requirements that needed to be met in order to satisfy our client’s requests:

 

  1. The application is an AI based tool for sports betting.
  2. The application should be both a web application and a mobile application.
  3. It will use sports data to influence bets.
  4. It will also use social media comments to make bets on upcoming games.
  5. It should utilize TypeScript in the frontend.
  6. It should have significant frontend components.
  7. It should have significant backend components.
  8. It should have significant data analysis and machine learning aspects.

 

Extensions:

  1. It can be extended to real time predictions of ongoing games. 

 

 

Designs:

Live. Laugh. Lock. is built using a three-tier architecture consisting of:

 

  1. Frontend: Angular-based web application served through NGINX, providing a responsive user interface for displaying game information, predictions, and bet tracking.

 

  1. Backend: FastAPI server handling all business logic, API endpoints, authentication, and integration with external data sources.

 

  1. Database: PostgreSQL database storing user accounts, game data, betting history, predictions, and cached sentiment analysis scores.

 

Tech Stack: 

  • Frontend: Angular with TypeScript, NGINX for reverse proxy and static file serving
  • Backend: FastAPI (Python)
  • Database: PostgreSQL
  • External APIs: NBA_API for real-time game and team statistics
  • AI/ML: Google Gemini for sentiment analysis
  • Task Scheduler: Celery for automated data pipeline orchestration
  • Mobile: Capacitor for cross-platform mobile deployment
  • Authentication: OAuth 2.0

 

 

Data Flow Architecture: 

 

  1. Scheduled Data Collection: Celery tasks run periodically to fetch current NBA game schedules and team statistics from NBA_API
  2. Live Data Updates: During active games, the system polls NBA_API at regular intervals to capture live scores and game statistics
  3. Sentiment Analysis Pipeline: Web scrapers extract commentary from YouTube, Reddit, and ESPN; this data is processed through Google Gemini with engineered prompts to generate sentiment scores
  4. Prediction Generation: Machine learning models utilize combine historical statistics and  real-time data to generate pre-game and live game predictions
  5. User Interface Updates: Predictions and live data are served to the frontend via REST API endpoints, with the frontend updating game cards in real-time

 

 

Core API Endpoints:

 

Games

  • GET /games/upcoming - Gets upcoming games
  • GET /games/previous - Gets previous games
  • GET /games/{game_id} - Gets game info by ID
  • GET /games/date/{game_date}- Gets games by a specific date

 

Predictions

  • GET /predictions/{game_id} - Retrieve AI-generated prediction for a specific game
  • GET /predictions/{game_id}/live - Retrieve real-time prediction updates during live games

 

Settings 

  • GET /settings/ - Gets user settings by ID
  • PUT /settings/ - Updates the current user’s settings

 

Teams

  • GET /teams/{team_id} - Retrieves a single team by its ID
  • GET /teams/ - Returns the full list of teams

 

Users:

  • POST /users/ - Registers a new user and returns their public profile plus an access token
  • POST /users/login/token/ - Logs in with email/password and returns an access token
  • GET /users/me/ - Returns the currently authenticated user
  • POST /users/resetpassword - Updates the authenticated user’s password after verifying the old password

 

Wagers: 

  • POST /wagers/placewager - Creates a new wager for the authenticated user
  • GET /wagers/userwagers - Returns all wagers for the authenticated user
  • GET /wagers/game/{game_id} - Returns that user’s wagers for a specific game

 

 

Database Schema:

  • games: id, home_id, away_id, status, game_clock, start_time, home_score, away_score, api_id, league, pre_game_prediction, live_prediction, game_date, period
  • teams: id, name, abbreviation, win_count, loss_count, primary_color, alternate_color, logo_url, api_id
  • user_settings: user_id, theme, notifications_enabled
  • users: id, username, email, email_verified, password, created_at, updated_at
  • wagers: id, user_id, platform, time, platform_odds, stake_amt, local_odds, game_id, team_id

 

 

Work Done: 

 

Christian Ordaz

        Primary Contributions: 

  • Focused on backend work with Jacob Lehrman
    • Focused on several backend endpoints
      • Worked on Users, Settings, Predictions, and Wagers API
      • Helped structure the schemas with the group
      • Developed a fully functional user authentication system, with proper safeguards and data protection with OAuth2, hashing sensitive information
  • Developed AI models and imported data from NBA API
    • Researched proper techniques with the group
    • Implemented an inhouse pregame prediction model with proper feature engineering work done
    • Implemented a live prediction model that is modeled after the model built by ESPN
  • Developed the automated data pipeline
    • Set up the tasks that are to be performed at certain times in the day or in certain intervals
      • Daily tasks: Retrain the pregame prediction model, Update which games are to be played that day (important for other tasks), update the database with any new changes from the previous day, set up an automated email system (the base is completed, future work could focus on this system)
      • Interval tasks: Check for live games, check for updates for live games (to give a live viewing in the frontend), update any changes in the games to the DB, check if games have begun or finished

 

        Technologies Learned:

  • FastAPI + Python: to build out the backend systems 
  • Celery: To build out the automated data pipeline

 

Jonah Hamell

        Primary Contributions: 

  • Implemented webscrapers that feed data into sentiment analysis model.
    • Youtube Comments From Official Youtube Channel, ESPN Articles, Reddit Comments from Official NBA Subreddit
      • Youtube Webscraper: Utilized YoutubeAPI v3 to extract information from official NBA Youtube Channel, any video under 5 minutes was not considered a video.
      • ESPN Articles: Utilized https://site.api.espn.com/apis/site/v2/sports/basketball/nba/news to get current basketball articles, extracted and parsed html files using BeautifulSoup.
      • Reddit Comments: Utilized Reddit's publicly available JSON to extract specific threads from NBA’s Subreddit.
    • Data fed through a pipeline into Gemini Flash 2.5
  • .Ported website to mobile applications so all users could access information.
    • Android and iOS mobile applications were created using Capacitor
      • Android: Wrote security permissions and HTML handling through XML Files to allow backend data to display on the app, successfully emulated application through android studio.
      • iOS: Wrote security permissions into property lists to allow backend information to display on the app. Successfully emulated the application through Xcode.
    • Modified layout of the application in CSS files in a way that wouldn't impact website, but would change the layout of the application for a cleaner look
  • Created API layer testing to ensure that api calls were working regardless of being connected to the database or not.

 

        Technologies Learned:

  • Data extraction principles, how to properly extract data from html/json.
    • BeautifulSoup: allowed easy parsing for html information
  • .Angular Framework
    • Architecture of Angular.
    • Implementation of Typescript.
  • .Swift
    • Writing and implementing swift code
    • Understanding what files are needed for a swift app to work
    • Learned about Property List Files and how to implement them.

 

Jacob Lehrman

        Primary Contributions: 

  • .
  • .
  • .

 

        Technologies Learned:

  • .
  • .
  • .

 

Jacob Russell

        Primary Contributions: 

  • Frontend screenflow diagrams using Escalidraw
  • Angular + Typescript frontend contributions:
    • Game tab switching and previous tab memory
    • Login/SignUp page design and functionality
    • MyBets page layout and functionality
    • Wager creation form functionality
    • Settings page functionality
  • Frontend to Backend RESTful API calls
  • Angular + Responsive CSS:
    • Blinking LIVE indicator
    • Wager status indicator
  • Sentiment Analysis:
    • Gemini Flash 2.5 embedding
    • Prompt Engineering research and implementation

        Technologies Learned:

  • Angular + TypeScript
    • Modular component rendering
    • Standalone architecture
  • LLM embeddings and Google Gemini API

 

 

Results:

 

Fullstack Application: 

  • Deployed a fully functional web application
  • Developed port to mobile for iOS and Android
  • Implemented OAuth 2.0 authentication for secure user access
  • Created responsive UI supporting both desktop and mobile platforms
  • Processed real-time NBA game data for instant user updates

 

        Prediction System:

  • Developed machine learning models achieving accurate game predictions
  • Integrated sentiment analysis scores for improved accuracy
  • Implemented live game predictions that update during ongoing matches

 

        Automated Data Pipeline

  • Built Celery-based scheduler for periodic data collection
  • Achieved live game score updates without manual intervention
  • Automatically processed web-scraped commentary for sentiment analysis

 

        Bet Tracking System

  • Users can simulate bets based on real money line odds
  • Complete betting history tracking with visual wins vs losses feedback
  • Real-time bet outcome settlement
  • Users can place bets on future games or ongoing games

 

        Sentiment Analysis + Webscraping

  • Multi-source data collection (YouTube, Reddit, ESPN)
  • Prompt-engineered Gemini integration for accurate sentiment scoring

Conclusion:

This project ultimately demonstrates the power of combining both objective and subjective analysis in a single model. By integrating NBA statistics with public sentiment, Live. Laugh. Lock. provides its users with a better understanding of basketball itself, and how to practice good betting habits. The result is a platform that allows users to practice betting while educating users on the sport of basketball and help them make data-driven decisions.