Skip to content

santiagopalma12/DraftOracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ DraftOracle

AI-Powered Drafting Assistant for League of Legends Esports

Python 3.11+ FastAPI License: MIT

Built for the Sky's the Limit - Cloud9 x JetBrains Hackathon


๐ŸŽฏ Overview

DraftOracle is an AI-powered tool that helps esports teams make optimal draft decisions in League of Legends. By analyzing historical match data from the GRID Esports API, it provides real-time recommendations for picks and bans based on:

  • Champion Synergies - How well champions work together
  • Counter Matchups - Lane advantages and phase-specific counters
  • Meta Analysis - Current patch tier lists and pick/ban priorities
  • Player Comfort - Individual player champion pools and performance

โœจ Features

Core Capabilities

Feature Description
๐ŸŽฏ Pick Recommendations Get optimal champion suggestions with reasoning
๐Ÿšซ Ban Recommendations Smart bans targeting opponent weaknesses
๐Ÿ“Š Draft Analysis Full draft breakdown with win probability
โšก Real-Time WebSocket Live updates during pick/ban phase
๐Ÿ“ˆ Meta Snapshots Current patch tier lists and statistics

API Endpoints

POST /api/v1/draft/recommend/pick  - Get pick recommendations
POST /api/v1/draft/recommend/ban   - Get ban recommendations
POST /api/v1/draft/analyze         - Analyze draft composition
GET  /api/v1/meta/current          - Get current meta snapshot
GET  /api/v1/meta/champions        - Get all champions
WS   /ws/draft/{session_id}        - Real-time draft session

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • PostgreSQL 15+
  • Redis 7+

Installation

# Clone the repository
git clone https://github.com/your-team/draftoracle.git
cd draftoracle

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or: .\venv\Scripts\activate  # Windows

# Install dependencies
pip install -e ".[dev]"

# Copy environment config
cp .env.example .env
# Edit .env with your settings

# Run database migrations (coming soon)
# alembic upgrade head

# Start the API
python -m src.api.main

Using Docker (Recommended)

docker-compose up -d

The API will be available at http://localhost:8000.

Frontend Setup

The modern React frontend is located in frontend/.

cd frontend
npm install
npm run dev

The UI will be available at http://localhost:5173.

The API will be available at http://localhost:8000

๐Ÿ“– API Documentation

Once running, access the interactive API docs:

Example: Get Pick Recommendations

import httpx

response = httpx.post(
    "http://localhost:8000/api/v1/draft/recommend/pick",
    json={
        "draft_state": {
            "blue_picks": [{"champion_id": 1, "role": "top"}],
            "red_picks": [],
            "blue_bans": [10, 20, 30],
            "red_bans": [40, 50, 60],
            "patch_version": "26.02"
        },
        "our_side": "blue",
        "role_needed": "mid",
        "top_k": 5
    }
)

recommendations = response.json()["recommendations"]
for rec in recommendations:
    print(f"{rec['champion_name']}: {rec['score']:.2f}")
    print(f"  Reasoning: {', '.join(rec['reasoning'])}")

Example: WebSocket Draft Session

const ws = new WebSocket("ws://localhost:8000/ws/draft/my-session-123");

ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log("Update:", data);
};

// Make a pick
ws.send(JSON.stringify({
    type: "pick",
    side: "blue",
    champion_id: 1,
    role: "mid"
}));

// Request recommendations
ws.send(JSON.stringify({
    type: "request_recommendations",
    side: "blue",
    role: "jungle"
}));

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        Frontend                              โ”‚
โ”‚                   (Future: React/Vue)                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚    FastAPI + WS       โ”‚
              โ”‚    REST & WebSocket   โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ–ผ                     โ–ผ                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Synergy โ”‚       โ”‚   Counter   โ”‚       โ”‚    Draft    โ”‚
โ”‚ Engine  โ”‚       โ”‚   Engine    โ”‚       โ”‚  Optimizer  โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚                   โ”‚                      โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  PostgreSQL + Redis  โ”‚
              โ”‚   Data & Cache       โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ–ผ               โ–ผ               โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  GRID   โ”‚   โ”‚ Data Dragon โ”‚   โ”‚  Celery โ”‚
    โ”‚   API   โ”‚   โ”‚     API     โ”‚   โ”‚  Tasks  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Project Structure

draftoracle/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api/              # FastAPI application
โ”‚   โ”‚   โ”œโ”€โ”€ routes/       # REST endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ websocket/    # WebSocket handlers
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/   # Rate limiting, auth
โ”‚   โ”‚   โ”œโ”€โ”€ schemas.py    # Pydantic models
โ”‚   โ”‚   โ””โ”€โ”€ main.py       # App entry point
โ”‚   โ”œโ”€โ”€ services/         # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ grid_ingestion.py
โ”‚   โ”‚   โ”œโ”€โ”€ data_dragon.py
โ”‚   โ”‚   โ”œโ”€โ”€ synergy_engine.py
โ”‚   โ”‚   โ”œโ”€โ”€ counter_engine.py
โ”‚   โ”‚   โ””โ”€โ”€ draft_optimizer.py
โ”‚   โ”œโ”€โ”€ ml/              # Machine learning
โ”‚   โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ features/
โ”‚   โ”‚   โ””โ”€โ”€ training/
โ”‚   โ”œโ”€โ”€ db/              # Database
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ”œโ”€โ”€ session.py
โ”‚   โ”‚   โ””โ”€โ”€ migrations/
โ”‚   โ””โ”€โ”€ tasks/           # Background jobs
โ”œโ”€โ”€ tests/
โ”œโ”€โ”€ config/
โ”œโ”€โ”€ docker/
โ””โ”€โ”€ scripts/

๐Ÿ”ง Configuration

All configuration is managed via environment variables. See .env.example for available options:

Variable Description Default
GRID_API_KEY GRID API authentication key Required
DATABASE_URL PostgreSQL connection string postgresql+asyncpg://...
REDIS_URL Redis connection string redis://localhost:6379/0
API_PORT API server port 8000
ML_EMBEDDING_DIM Champion embedding dimension 128

๐Ÿงช Testing

# Run all tests
pytest

# With coverage
pytest --cov=src --cov-report=html

# Specific test category
pytest tests/unit/
pytest tests/integration/

๐Ÿ“Š Data Sources

  • GRID Esports API - Historical match data, draft sequences, player stats
  • Riot Data Dragon - Champion metadata, patch information

๐Ÿ—บ๏ธ Roadmap

  • Phase 1: Research & Planning
  • Phase 2: Core Backend (Services, DB, API)
  • Phase 3: ML Models (Embeddings, Win Predictor)
  • Phase 4: Real-Time System (WebSockets, Drag & Drop)
  • Phase 5: Testing & Documentation
  • Phase 6: Frontend Application (React + Vite, Glassmorphism UI)

๐Ÿ‘ฅ Team

Built for the Sky's the Limit Hackathon by passionate esports fans.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐ŸŽฎ Powered by GRID Esports Data ๐ŸŽฎ

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published