Files
nike/scripts/verify_db.py
Robert Helewka ee8436d5b8 feat: implement MCP server and dashboard for football data platform
Add complete Nike football data platform with:
- FastMCP server exposing football data tools over HTTP
- RapidAPI client for free-api-live-football-data integration
- Bootstrap web dashboard with live match/standings views
- REST API endpoints for dashboard consumption
- Docker support with multi-stage build
- Comprehensive README with architecture docs
- Minimal .gitignore replacing verbose Python template
2026-03-21 18:19:42 +00:00

72 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Quick verification of Nike DB contents."""
import os
from dotenv import load_dotenv
import psycopg2
load_dotenv('/home/robert/gitea/nike/.env')
conn = psycopg2.connect(
host=os.getenv('DB_HOST'),
port=int(os.getenv('DB_PORT', 5432)),
user=os.getenv('DB_USER'),
password=os.getenv('DB_PASSWORD'),
dbname='nike',
)
cur = conn.cursor()
tables = [
'leagues', 'teams', 'players', 'fixtures', 'standings',
'match_stats', 'match_events', 'player_season_stats',
'player_match_stats', 'followed_entities',
]
print("Nike DB Contents")
print("-" * 40)
for table in tables:
cur.execute(f"SELECT COUNT(*) FROM {table}")
count = cur.fetchone()[0]
status = "" if count > 0 else ""
print(f" {status} {table:<28} {count:>6} rows")
# TFC summary
print()
cur.execute("""
SELECT t.name, COUNT(p.id) AS players
FROM teams t
LEFT JOIN players p ON p.current_team_id = t.id
WHERE t.is_followed = TRUE
GROUP BY t.name
""")
for row in cur.fetchall():
print(f"{row[0]}: {row[1]} players in roster")
cur.execute("""
SELECT COUNT(*) FROM fixtures f
JOIN teams t ON (t.id = f.home_team_id OR t.id = f.away_team_id)
WHERE t.is_followed = TRUE
""")
fix_count = cur.fetchone()[0]
print(f" 📅 Followed team fixtures: {fix_count}")
cur.execute("""
SELECT match_date::date, home.name, away.name, home_goals, away_goals, status
FROM fixtures f
JOIN teams home ON home.id = f.home_team_id
JOIN teams away ON away.id = f.away_team_id
JOIN teams ft ON (ft.id = f.home_team_id OR ft.id = f.away_team_id)
WHERE ft.is_followed = TRUE AND f.match_date >= NOW()
ORDER BY f.match_date ASC
LIMIT 3
""")
upcoming = cur.fetchall()
if upcoming:
print()
print(" Next fixtures:")
for row in upcoming:
print(f" {row[0]} {row[1]} vs {row[2]} ({row[5]})")
cur.close()
conn.close()