87 lines
2.3 KiB
Python
Executable File
87 lines
2.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Verify ConceptArc data was uploaded correctly to the database
|
|
"""
|
|
|
|
import os
|
|
import json
|
|
import pymysql
|
|
from dotenv import load_dotenv
|
|
|
|
def load_env_config():
|
|
"""Load database configuration from .env file"""
|
|
load_dotenv()
|
|
return {
|
|
'host': os.getenv('DB_HOST'),
|
|
'user': os.getenv('DB_USER'),
|
|
'password': os.getenv('DB_PASSWORD'),
|
|
'database': os.getenv('DB_NAME'),
|
|
'port': int(os.getenv('DB_PORT', 3306)),
|
|
'charset': 'utf8mb4'
|
|
}
|
|
|
|
def main():
|
|
print("Verifying ConceptArc Upload")
|
|
print("=" * 50)
|
|
|
|
config = load_env_config()
|
|
connection = pymysql.connect(**config)
|
|
cursor = connection.cursor()
|
|
|
|
# Check arc_puzzles table
|
|
cursor.execute("""
|
|
SELECT `set`, COUNT(*)
|
|
FROM arc_puzzles
|
|
WHERE corpora = 'ConceptArc'
|
|
GROUP BY `set`
|
|
ORDER BY `set`
|
|
""")
|
|
|
|
print("\nConceptArc puzzles by category (from arc_puzzles):")
|
|
total = 0
|
|
for category, count in cursor.fetchall():
|
|
print(f" {category}: {count} puzzles")
|
|
total += count
|
|
print(f" TOTAL: {total} puzzles")
|
|
|
|
# Check arc_jsons table
|
|
cursor.execute("""
|
|
SELECT COUNT(*)
|
|
FROM arc_jsons aj
|
|
JOIN arc_puzzles ap ON aj.arc_puzzle_id = ap.id
|
|
WHERE ap.corpora = 'ConceptArc'
|
|
""")
|
|
json_count = cursor.fetchone()[0]
|
|
print(f"\nConceptArc entries in arc_jsons: {json_count}")
|
|
|
|
# Sample some puzzles
|
|
cursor.execute("""
|
|
SELECT ap.id, ap.corpora, ap.`set`, aj.json, aj.solution
|
|
FROM arc_puzzles ap
|
|
JOIN arc_jsons aj ON ap.id = aj.arc_puzzle_id
|
|
WHERE ap.corpora = 'ConceptArc'
|
|
LIMIT 3
|
|
""")
|
|
|
|
print("\n" + "=" * 50)
|
|
print("Sample ConceptArc entries:")
|
|
print("=" * 50)
|
|
|
|
for row in cursor.fetchall():
|
|
puzzle_id, corpora, category, json_data, solution = row
|
|
print(f"\nPuzzle ID: {puzzle_id}")
|
|
print(f" Corpora: {corpora}")
|
|
print(f" Category: {category}")
|
|
print(f" JSON length: {len(json_data)} chars")
|
|
print(f" Has solution: {'Yes' if solution else 'No'}")
|
|
|
|
if solution:
|
|
sol = json.loads(solution)
|
|
print(f" Solution dimensions: {len(sol)}x{len(sol[0]) if sol else 0}")
|
|
|
|
connection.close()
|
|
print("\n✓ Verification complete")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|