Skip to content

Create 4point-Hoops.mdx #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rapha18th
Copy link

4point Hoops perplexity showcase.

Description

Brief description of your contribution
A basketball analytics app that showcases the power of perplexity.

Type of Contribution

  • Example Tutorial
  • Showcase Project
  • Article/Integration Guide
  • Documentation Update
  • Bug Fix
  • Other (please describe)

Checklist

  • My code follows the cookbook's style guidelines
  • I have included comprehensive documentation
  • I have tested my code and it works as expected
  • I have included all necessary dependencies and setup instructions
  • My MDX file includes proper frontmatter (title, description, keywords)
  • I have linked to any external repositories or live demos

Project Details


title: 4Point Hoops | AI Basketball Analytics & Insights
description: Advanced NBA analytics platform that combines live Basketball-Reference data with Perplexity Sonar to deliver deep-dive player stats, cross-season comparisons and expert-grade AI explanations.
sidebar_position: 2
keywords: [nba, basketball, analytics, ai, perplexity, sonar, sports-data, comparisons]

4Point Hoops – AI-Powered NBA Analytics

4Point Hoops Dashboard

4Point Hoops turns raw NBA statistics into actionable, narrative-driven insights. By scraping Basketball-Reference in real time, cleansing the data and routing context-rich prompts to Perplexity’s sonar-pro model, it lets fans, analysts and fantasy players understand the “why” and “what’s next” – not just the numbers.

Demo Video

What 4Point Hoops Does

  • Player analytics – season & playoff splits, shot-type breakdowns and performance radar for any NBA player
  • Cross-era comparisons – e.g. Michael Jordan ’97 vs. Stephen Curry ’22 side-by-side, stat-for-stat
  • Team dashboards – standings, playoff-probability Sankey flows and KPI tiles that auto-refresh daily
  • AI Explain & Similar Players – one-click Sonar explanations of a stat line or AI-picked comparable athletes
  • Basketball AI Chat – ask an expert LLM anything about NBA history, rosters or projections
  • Credit-based SaaS plumbing – Firebase Auth + Realtime DB manage sign-up, Google login, credit wallets, admin tooling and feedback inbox

AI Explain Modal

How It Uses Perplexity Sonar

# Inline “AI Explain” for a selected player/season
payload = {
    "model": "sonar-pro",
    "messages": [
        {
            "role": "user",
            "content": (
                "Explain Giannis Antetokounmpo's 2021 playoff stats in plain English. "
                "Highlight shooting efficiency and defensive impact."
            )
        }
    ],
    "response_format": {"type": "text"}
}
explanation = client.chat.completions.create(**payload)

# Free-form chat endpoint
chat = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {"role": "system", "content": "You are an NBA analytics expert."},
        {"role": "user", "content": "Who were the top 5 players in PER last season and why?"}
    ]
)
  • Context packing – the backend injects cleaned, season-filtered DataFrames into the prompt so Sonar reasons over actual numbers.
  • Credit guard – every AI call passes through credit_required() middleware that checks Firebase balance before deducting a point and logging the query.

Tech Stack

Layer Tech
Frontend React + shadcn/ui, Recharts (Netlify deploy)
Backend/API Python Flask (Hugging Face Spaces)
Data Pipeline BRScraper → cleanse → Firebase cache
Auth & Storage Firebase Auth + Realtime Database
AI Integration Perplexity Sonar-Pro, Pollinations TTS
DevOps Docker, GitHub Actions

Links

4point Hoops perplexity showcase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant