first (part 2: other directories)
Deploy Iddaai Backend / build-and-deploy (push) Failing after 18s

This commit is contained in:
2026-04-16 15:11:25 +03:00
parent 7814e0bc6b
commit 2f0b85a0c7
203 changed files with 59989 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Test UpsetEngine on Bayern vs Augsburg match."""
import sys
sys.path.insert(0, 'ai-engine')
from features.upset_engine import get_upset_engine
from data.db import get_clean_dsn
import psycopg2
from psycopg2.extras import RealDictCursor
from datetime import datetime
# Get match data
conn = psycopg2.connect(get_clean_dsn())
cur = conn.cursor(cursor_factory=RealDictCursor)
cur.execute("""
SELECT m.id, m.home_team_id, m.away_team_id, m.score_home, m.score_away,
m.ht_score_home, m.ht_score_away, m.mst_utc,
th.name as home_name, ta.name as away_name, l.name as league
FROM matches m
JOIN teams th ON m.home_team_id = th.id
JOIN teams ta ON m.away_team_id = ta.id
JOIN leagues l ON m.league_id = l.id
WHERE m.id = 'en78ih6ec7exnpxcku3xc3das'
""")
match = cur.fetchone()
conn.close()
if match:
print('=== Bayern Munch vs Augsburg (24 Jan 2026) ===')
print(f"Actual: HT {match['ht_score_home']}-{match['ht_score_away']}, FT {match['score_home']}-{match['score_away']} (1/2 Reversal!)")
print()
# Test UpsetEngine
engine = get_upset_engine()
# Calculate upset potential using get_features
result = engine.get_features(
home_team_name=match['home_name'],
home_team_id=match['home_team_id'],
away_team_name=match['away_name'],
league_name=match['league'],
home_position=1, # Bayern is typically top
away_position=15, # Augsburg is typically lower
match_date_ms=match['mst_utc'],
total_teams=18,
)
print('UpsetEngine Results:')
print(f" Atmosphere Score: {result.get('upset_atmosphere', 0):.2f}")
print(f" Motivation Score: {result.get('upset_motivation', 0):.2f}")
print(f" Fatigue Score: {result.get('upset_fatigue', 0):.2f}")
print(f" Historical Score: {result.get('upset_historical', 0):.2f}")
print(f" TOTAL UPSET POTENTIAL: {result.get('upset_potential', 0):.2f}")
print()
# Check if upset was detected
if result.get('upset_potential', 0) > 0.5:
print("🔥 HIGH UPSET POTENTIAL DETECTED!")
elif result.get('upset_potential', 0) > 0.3:
print("⚠️ MEDIUM UPSET POTENTIAL")
else:
print("❌ LOW UPSET POTENTIAL - Model did not detect this as upset")
else:
print('Match not found')