Pit-Lane-Project / README.md
Interact-ai's picture
Upload folder using huggingface_hub
267266e verified
|
Raw History Blame Contribute Delete
3.48 kB
# F1 Live Race & Winner Prediction Platform
Full-stack application for live Formula 1 race tracking, lap-level telemetry ingestion, and real-time winner prediction using machine learning (XGBoost).
## Project Structure
```text
f1-live-backend/
β”œβ”€β”€ backend/ # FastAPI backend service
β”‚ β”œβ”€β”€ app/ # Application code (routes, services, providers)
β”‚ β”œβ”€β”€ models/ # XGBoost model pickle & feature schema
β”‚ β”œβ”€β”€ tests/ # Automated pytest suite
β”‚ β”œβ”€β”€ testing_pipeline/ # FastF1 historical replay & probe test harness
β”‚ β”œβ”€β”€ test_backend.py # Standalone replay test runner
β”‚ β”œβ”€β”€ requirements.txt # Python dependencies
β”‚ β”œβ”€β”€ pytest.ini # Pytest discovery config
β”‚ β”œβ”€β”€ .env # Backend environment configuration
β”‚ └── docs/ # Feature contract & architecture docs
β”‚
└── frontend/ # React + TypeScript + Vite Dashboard
└── Dashboard/ # F1 live telemetry & prediction dashboard
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ components/ # Track map, leaderboard, vitals, telemetry panels
β”‚ β”œβ”€β”€ hooks/ # usePredictions (WebSocket & REST live connection)
β”‚ β”œβ”€β”€ types/ # TypeScript schemas & contracts
β”‚ └── App.tsx # Main application layout
β”œβ”€β”€ package.json
└── vite.config.ts # Dev server with proxy to backend
```
---
## Quick Start
### 1. Backend Setup & Run
```powershell
# Navigate to backend
cd backend
# Setup virtual environment (if not already created)
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
# Run FastAPI backend with Uvicorn (port 8000)
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000
```
- API Docs / Swagger UI: `http://127.0.0.1:8000/docs`
- Health check: `http://127.0.0.1:8000/health`
- Frontend snapshot: `http://127.0.0.1:8000/live/frontend`
- WebSocket stream: `ws://127.0.0.1:8000/live/ws`
### 2. Frontend Setup & Run
```powershell
# Navigate to frontend dashboard
cd frontend\Dashboard
# Install dependencies (Node 18+)
npm install
# Run Vite dev server (port 5173 with proxy to backend)
npm run dev
```
Open `http://localhost:5173` in your browser.
---
## Live Features & Wiring
- **WebSocket Stream (`/live/ws`)**: Streams real-time snapshot every second directly to the dashboard.
- **REST Snapshot (`/live/frontend`)**: Provides zero-delay initial load and automatic polling fallback if the socket disconnects.
- **Live Leaderboard & Win Probabilities**: Real-time XGBoost winner probabilities updated lap-by-lap.
- **Live Driver Vitals**: Speed (km/h), RPM, Gear, Throttle %, Brake, DRS status.
- **Live Track & Weather Strip**: Dynamic track temperature, air temperature, rain probability, and track status flags (Clear, Caution, Safety Car).
- **Interactive Controls**: Header includes live connection status indicator, "Simulate Lap" action to trigger test predictions, and race reset.
---
## Running Tests
### Backend Tests
```powershell
cd backend
python -m pytest
```
### Frontend Build & Typecheck
```powershell
cd frontend\Dashboard
npm run build
```
---
Copyright Β© 2026 NexInteract Systems Pvt. Ltd. All rights reserved.