Skip to content

elizabethsiegle/marchmadness-prediction-analysis-worker

Repository files navigation

NCAA Basketball Stats & Analysis App

A Cloudflare Workers application that provides NCAA basketball statistics (from the NCAA website--not with scores of games being played, but only once they are finished) and AI-powered analysis for both men's and women's Division I teams.

Features

  • Statistics from NCAA.com (using this NCAA API)
  • Support for both men's and women's Division I basketball
  • AI-powered analysis of team performance
  • Interactive web interface
  • Data caching for improved performance
  • Data visualizations based on conference and team standings from NCAA.com

Tech Stack

  • Cloudflare Workers
  • Cloudflare D1 (SQLite)
  • Cloudflare Workers AI
  • Cloudflare KV for caching
  • NCAA API integration

Setup

  1. Install Wrangler CLI:
npm install -g wrangler
  1. Clone the repository:
git clone https://github.com/elizabethsiegle/marchmadness-prediction-analysis-worker
cd https://github.com/elizabethsiegle/marchmadness-prediction-analysis-worker
  1. Create D1 databases:
wrangler d1 create basketball-women
wrangler d1 create basketball-men
  1. Initialize both databases using the schema:
wrangler d1 execute basketball-women --file=./schema.sql
wrangler d1 execute basketball-men --file=./schema.sql
  1. Configure environment variables in wrangler.jsonc:
"kv_namespaces": [
    {
      "binding": "BROWSER_KV_MM",
      "id": "your-kv-id-here",
      "preview_id": "your-preview-id-here"
    }
  ],
  "ai": {
    "binding": "AI"
  },
  "d1_databases": [
    {
      "binding": "DB_MEN",
      "database_name": "FOR-EX-MARCH-MADNESS-MEN",
      "database_id": "YOUR-DB-ID-HERE"
    },
    {
      "binding": "DB",
      "database_name": "FOR-EX-MARCH-MADNESS-WOMEN",
      "database_id": "YOUR-DB-ID-HERE"
    }
  ]
  1. Deploy:
wrangler deploy