feat: Feature 1.2 (NBA stats FastAPI service) + Feature 1.4 (database schema)

Feature 1.2: Python FastAPI microservice wrapping nba_api
- GET /stats/season-avg, /stats/last-n, /stats/splits, /players/search
- Redis caching (24hr/1hr/6hr/7day), 0.6s rate limiting, PRA derived stat
- 27 Python tests passing

Feature 1.4: Complete Supabase database schema
- 6 tables: users, picks, scan_sessions, bets, outcomes, performance
- RLS enabled on all tables with auth.uid() policies
- 3 triggers: auto-create user, updated_at, scan count reset
- 37 schema validation tests passing
- Migration SQL ready, pending manual apply (WSL2 DNS blocker)

Total: 92 tests (65 Node.js + 27 Python), all passing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-03-21 10:58:58 -04:00
parent 00409fd6cd
commit 3da1b4242c
27 changed files with 2360 additions and 16 deletions
+17
View File
@@ -0,0 +1,17 @@
import os
REDIS_URL = os.getenv("REDIS_URL", "redis://127.0.0.1:6379")
# Cache TTLs in seconds
SEASON_AVG_TTL = 86400 # 24 hours
LAST_N_TTL = 3600 # 1 hour
SPLITS_TTL = 21600 # 6 hours
PLAYER_SEARCH_TTL = 604800 # 7 days
# nba_api rate limiting
NBA_API_DELAY = 0.6 # seconds between calls
NBA_API_RETRY_DELAY = 2.0
NBA_API_TIMEOUT = 30
# Service
PORT = int(os.getenv("NBA_SERVICE_PORT", "8000"))