import json
from datetime import datetime

DATE_STR = "2026-06-19"

for chunk in ["CHUNK1", "CHUNK2"]:
    path = f"/home/kiro/trend-engine/trends/x/account-monitor/scan_results_{DATE_STR}_{chunk}.json"
    with open(path) as f:
        data = json.load(f)
    print(f"=== {chunk} ===")
    for acc in data["accounts"]:
        rc = acc.get("recent_count", 0)
        qc = acc.get("qualifying_count", 0)
        if rc > 0:
            # Show the first tweet's date info regardless of qualifying
            first_tweet = acc["tweets"][0] if acc.get("tweets") else None
            if first_tweet:
                print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying, first={first_tweet['date']}, raw={repr(first_tweet.get('createdAt',''))[:70]}")
            else:
                # Recent but no tweets means retweet-only or date-ok but no engagement
                print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying (no qualifying tweets -- all below thresholds)")
        else:
            print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying")
