"""更新 _heartbeat_baseline.json 到 r312"""
import json, os
from datetime import datetime

baseline = {
    "round": 312,
    "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
    "schools": 36,
    "programs": 1479,
    "programs_unique_ids": 1442,
    "catd": 2817,
    "vd": 1549,
    "dead_links": 0,
    "exclude_residue": 0,
    "details_on_disk": 3775,
    "main_file_mtime": datetime.fromtimestamp(os.path.getmtime('index_main.html')).strftime("%Y-%m-%d %H:%M:%S"),
    "main_file_bytes": os.path.getsize('index_main.html'),
    "blocked_notes": [
        "29 组 URL 分叉重复已在 r312 批量合并（删 37 条 PROGRAMS 记录 + 33 条 VD）",
        "r312 误删 11 条 CATD details url 已即时修复",
        "剩余 29 组中英双写同 url 待合并（保留中文 n、删英文重复）",
        "705 条半核验页待字段补全",
        "daily snapshot regex parser 漏 ~58 条待修复",
        "final_check.py by-school distribution script out of sync",
        "todo_upgrade.json queue fully drained (722/722)",
        "UChicago SSL MA mid-career 排除口径待主管确认",
        "Emory HSRP PhD deadline/GRE 待确认",
        "Cornell Biophysics T32-only 限制待主管定夺",
        "Northwestern MBS PhD deadline 待确认",
        "Georgia Tech ChBE GRE 待确认"
    ],
    "actions_this_round": [
        "r312: 批量合并 29 组 URL 分叉重复（同 id 不同 url），按字段完整度评分保留最详版，删 37 条 PROGRAMS + 33 条 VD",
        "r312: 修复全局 replace 误删的 11 条 CATD details url",
        "PROGRAMS 1516→1479 (-37), VD 1582→1549 (-33), CATD 2817 已恢复"
    ]
}
with open('_heartbeat_baseline.json', 'w', encoding='utf-8') as f:
    json.dump(baseline, f, ensure_ascii=False, indent=2)
print("baseline updated")
