feat: Feature 2.1 — Parlay Scan with correlation detection + monetization
POST /api/scan/parlay — authenticated parlay analysis: - Supabase JWT auth middleware (auth.getUser verification) - 5 correlation types detected between legs (same_game, same_team, same_player_conflicting, positive_correlation, blowout_cascade) - Overall parlay grading (A/B/C/D) with correlation penalty adjustments - Free tier: 5 scans/month, atomic scan count increment - Scan 5: full analysis + personalized upgrade pitch - Scan 6+: 403 block with upgrade pitch - Pitch personalization from scan history (top stats, grades, tier rec) - DB writes: picks + scan_sessions per scan 30 new tests, 158 total (131 Node.js + 27 Python), all passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+38
-48
@@ -4,47 +4,36 @@
|
||||
2026-03-21
|
||||
|
||||
## Current Phase
|
||||
Phase 1 — Foundation (COMPLETE)
|
||||
Phase 2 — Core Product (IN PROGRESS)
|
||||
|
||||
## What Has Shipped
|
||||
|
||||
### Feature 1.1 — Odds API Integration (COMPLETE)
|
||||
- GET /api/odds/nba — live NBA player props from DraftKings, FanDuel, BetMGM
|
||||
- GET /api/odds/ncaab — NCAAB props (with off-season detection)
|
||||
- Normalizer: pairs Over/Under outcomes, maps 8 market types, filters to 3 books
|
||||
- Spreads market added for blowout risk detection (Feature 1.3)
|
||||
- Redis cache: 15-min TTL, stale fallback on API failure
|
||||
- Quota tracking via response headers, 429 when exhausted
|
||||
- Query filters: stat_type, player (partial match), book
|
||||
### Phase 1 — Foundation (COMPLETE)
|
||||
- Feature 1.1 — Odds API Integration
|
||||
- Feature 1.2 — NBA_API Stats Wrapper (FastAPI microservice)
|
||||
- Feature 1.3 — Prop Analysis Engine (6-step grading pipeline)
|
||||
- Feature 1.4 — Database Schema (6 tables, RLS, triggers in Supabase)
|
||||
|
||||
### Feature 1.2 — NBA_API Stats Wrapper (COMPLETE)
|
||||
- FastAPI microservice in nba-service/ on port 8000
|
||||
- GET /stats/season-avg (24hr cache), /stats/last-n (1hr), /stats/splits (6hr), /players/search (7-day)
|
||||
- PRA computed as derived stat, 0.6s rate limiting with retry
|
||||
- 27 Python tests passing
|
||||
|
||||
### Feature 1.3 — Prop Analysis Engine (COMPLETE)
|
||||
- POST /api/analyze/prop — single prop analysis with full 6-step pipeline
|
||||
- POST /api/analyze/batch — multi-prop analysis for parlay scanner
|
||||
- 6-step pipeline: season avg → recent form → situational splits → cross-book lines → kill conditions → grade
|
||||
- Grading: composite score → A/B/C/D with confidence 30-95
|
||||
- 6 kill conditions: low_minutes, small_sample, b2b_high_usage, blowout_risk, split_conflict, no_opponent_data
|
||||
- Full reasoning output: step-by-step breakdown with signals
|
||||
- Cross-book line comparison identifies best/worst lines
|
||||
|
||||
### Feature 1.4 — Database Schema (COMPLETE)
|
||||
- 6 tables applied to Supabase: 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
|
||||
### Feature 2.1 — Parlay Scan (COMPLETE)
|
||||
- POST /api/scan/parlay — full parlay analysis with auth
|
||||
- Supabase JWT auth middleware (auth.getUser() verification)
|
||||
- 5 correlation types: same_game_opposing, same_game_same_team, same_player_conflicting, positive_correlation, blowout_cascade
|
||||
- Overall parlay grading (A/B/C/D) with correlation penalty adjustments
|
||||
- Free tier: 5 scans/month with atomic scan count (race-condition safe)
|
||||
- Scan 5: full analysis + personalized upgrade pitch
|
||||
- Scan 6+: 403 with upgrade pitch, no analysis
|
||||
- Paid tiers (analyst/desk): unlimited scans
|
||||
- Upgrade pitch personalization from scan history (stat types, grades, player patterns)
|
||||
- Tier recommendation: analyst for casual, desk for power users
|
||||
- Database writes: picks table (per leg) + scan_sessions table (per scan)
|
||||
- Founder pricing highlighted in all pitches
|
||||
|
||||
## Test Summary
|
||||
- Node.js: 101 tests passing (unit + integration)
|
||||
- Node.js: 131 tests passing (unit + integration)
|
||||
- Python: 27 tests passing
|
||||
- Total: 128 tests, all green
|
||||
- Total: 158 tests, all green
|
||||
|
||||
## What's Next
|
||||
- Feature 2.1 — Parlay Scan (depends: 1.3 + 1.4)
|
||||
- Feature 2.2 — Real-Time Line Movement + Cascade Detection (depends: 1.1)
|
||||
- Feature 1.5 — Bet Submission (depends: 1.4)
|
||||
|
||||
@@ -54,24 +43,25 @@ Phase 1 — Foundation (COMPLETE)
|
||||
## Session Log
|
||||
|
||||
### Session 1 — 2026-03-21
|
||||
- Made live Odds API test call, documented raw response format in DECISIONS.md
|
||||
- Built Feature 1.1: oddsNormalizer.js, oddsService.js, routes/odds.js, teamMap.js, redis.js, app.js
|
||||
- 28 tests (unit + integration), all passing
|
||||
- Logged DECISION-001 (API response format) and DECISION-002 (credit conservation)
|
||||
- Built Feature 1.1: Odds API Integration (28 tests)
|
||||
- Credits used: 2 of 500 (498 remaining)
|
||||
|
||||
### Session 2 — 2026-03-21
|
||||
- Built Feature 1.2: FastAPI microservice wrapping nba_api (27 Python tests)
|
||||
- Built Feature 1.4: Full database schema SQL (37 tests), applied manually via Supabase SQL Editor
|
||||
- Logged DECISION-003 (Python microservice) and DECISION-004 (Supabase Auth)
|
||||
- Created startup script, Supabase client module, schema verification script
|
||||
- Built Feature 1.2: FastAPI microservice (27 Python tests)
|
||||
- Built Feature 1.4: Database schema (37 tests), applied to Supabase
|
||||
|
||||
### Session 3 — 2026-03-21
|
||||
- Built Feature 1.3: Prop Analysis Engine
|
||||
- propAnalyzer.js (orchestrator), grader.js, killConditions.js, nbaStatsClient.js, signals.js
|
||||
- routes/analyze.js (POST /api/analyze/prop + /batch)
|
||||
- Added spreads market to Odds API fetch (zero extra credits)
|
||||
- 36 new tests (unit + integration)
|
||||
- Logged DECISION-005 (spreads for blowout risk)
|
||||
- Phase 1 Foundation is now COMPLETE
|
||||
- Total: 128 tests (101 Node.js + 27 Python), all green
|
||||
- Built Feature 1.3: Prop Analysis Engine (36 new tests)
|
||||
- Phase 1 Foundation COMPLETE
|
||||
|
||||
### Session 4 — 2026-03-21
|
||||
- Built Feature 2.1: Parlay Scan
|
||||
- auth.js (Supabase JWT middleware)
|
||||
- correlationEngine.js (5 correlation types)
|
||||
- parlayGrader.js (parlay-level grading with correlation penalties)
|
||||
- upgradePitch.js (personalized monetization pitch from scan history)
|
||||
- parlayScanService.js (orchestrator: auth → count → analyze → correlate → grade → persist → pitch)
|
||||
- routes/scan.js (POST /api/scan/parlay)
|
||||
- 30 new tests (unit + integration)
|
||||
- Logged DECISION-006 (auth via Supabase getUser) and DECISION-007 (atomic scan count)
|
||||
- Total: 158 tests (131 Node.js + 27 Python), all green
|
||||
|
||||
Reference in New Issue
Block a user