iris_backend / backend /check_db_clustering.py
Saandraahh's picture
Implemented clustering
4b3a33f
import os
from supabase import create_client, Client
from dotenv import load_dotenv
load_dotenv()
url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_SERVICE_ROLE_KEY") or os.environ.get("SUPABASE_KEY")
client: Client = create_client(url, key)
def check_clustering_status():
print("Checking profiles table for cluster labels...")
resp = client.table("profiles").select("id, cluster_label").limit(20).execute()
data = resp.data
if not data:
print("No profiles found.")
return
# Count how many have labels
labeled = [d for d in data if d.get("cluster_label")]
print(f"Sample size: {len(data)}")
print(f"Profiles with cluster_label: {len(labeled)}")
if labeled:
print("Sample labels:")
for d in labeled[:5]:
print(f" - {d['id']}: {d['cluster_label']}")
else:
print("No profiles have cluster labels in this sample.")
if __name__ == "__main__":
check_clustering_status()