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 and acc.get("tweets"):
            t0 = acc["tweets"][0]
            print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying, first={t0['date']}, raw={repr(t0.get('createdAt',''))[:70]}")
        elif rc > 0 and rc > qc:
            # tweets present but no qualifying ones - check date of recent tweets
            print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying (no tweets in data, retweets only)")
        else:
            print(f"  @{acc['handle']}: {rc} recent, {qc} qualifying")
