Spjimr / check_db.py
Viske's picture
Fix fpdf crash causing missing UI updates
3491bae
Raw
History Blame Contribute Delete
1.09 kB
import os
import json
from supabase import create_client
from dotenv import load_dotenv
load_dotenv()
url = os.getenv('SUPABASE_URL')
key = os.getenv('SUPABASE_KEY')
supabase = create_client(url, key)
chats = supabase.table('chats').select('id, topics_json').order('id', desc=True).limit(5).execute().data
for chat in chats:
tj = chat.get('topics_json')
if isinstance(tj, dict) and 'aacsb_audit' in tj:
audit = tj['aacsb_audit']
print(f"Chat ID: {chat['id']}, Total Papers Evaluated: {len(audit['papers'])}")
scores = [p['score'] for p in audit['papers']]
categories = [p['final_category'] for p in audit['papers']]
print(f"Scores: {scores}")
print(f"Categories: {categories}")
print(f"Verbatim for first few NONEs:")
none_count = 0
for p in audit['papers']:
if p['final_category'] == 'NONE':
print(f" - {p['verbatim_evidence']}")
none_count += 1
if none_count > 3: break
break
else:
print('No aacsb_audit found in recent chats.')