# -*- coding: utf-8 -*-
import io, sys, os, re, json, datetime
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
idx=open("index_main.html",encoding="utf-8").read()
seg=idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
plvl=re.findall(r'lvl:"([^"]+)"',seg)
master=plvl.count("m"); phd=plvl.count("d"); programs=len(plvl)
vd=re.search(r'const VERIFIED_DETAILS=new Set\(\[(.*?)\]\);',idx,re.S).group(1)
vd_n=len(re.findall(r'"([^"]+)"',vd))
det_n=len([f for f in os.listdir("details") if f.endswith(".html")])
mtime=datetime.datetime.fromtimestamp(os.path.getmtime("index_main.html")).strftime("%Y-%m-%d %H:%M:%S")
print("实测 programs",programs,"master",master,"phd",phd,"VD",vd_n,"details",det_n,"mtime",mtime)

b=json.load(open("_heartbeat_baseline.json",encoding="utf-8"))
b["updated_at"]=mtime; b["index_main_mtime"]=mtime
b["schools"]=36; b["programs"]=programs; b["programs_master"]=master; b["programs_phd"]=phd
b["catd"]=2676; b["dead_links"]=0; b["excluded_residue"]=0
b["vd_set"]=vd_n; b["details_html"]=det_n; b["node_check"]="exit 0"

new=[
 ("vandy-ds-ms","details/vanderbilt-www-datascience-msprogram.html","Vanderbilt DS MS"),
 ("geo-dsan-ms","details/geo-data-science-analytics-ms.html","Geo DSAN MS"),
 ("geo-hids-ms","details/geo-health-informatics-data-science-ms.html","Geo HIDS MS"),
 ("geo-biostat-ms","details/geo-biostatistics-ms.html","Geo Biostat MS"),
 ("geo-dspp-ms","details/geo-data-science-for-public-policy-ms.html","Geo DSPP MS"),
]
for _,det,_ in new:
    tag=det+" 浏览器实开待后端会话恢复后补核（六卡静态核对已通过）"
    if det not in b["pending_browser_check"]:
        b["pending_browser_check"].append(tag)

notes=[
 "Vanderbilt MS Data Science（vandy-ds-ms）：核验入库。DSI；30 学分 9 个月 4 模块在校全日制 in person；Capstone 必修(0cr)；五轮截止 R1 1/15 至 R5 5/15，不收春季；TOEFL100(21)/IELTS7.0(6.5)/DET130；GRE/GMAT optional；GPA3.0；四年学士+编程证据；3 推荐信+SOP(≤3页)+CV；2025-26 学费 $72,570+保险 $4,314+杂费；奖学金 25%-100% 学费；页面未明示 STEM，stem0。排除在线在职/春季/PhD。",
 "Georgetown MS Data Science & Analytics（geo-dsan-ms）：核验入库。文理学院；30 学分全日制最快 16 个月；核心 15cr（5000/5100/5200/5300/6000）+选修 15cr；5 tracks AI/NLP/可视化/Financial/Generalist；Priority 1/15 Final 2/15；IELTS7.5/TOEFL100 不收 MyBest；GRE notreq；GPA3.0；先修多元微积分/微积分统计/编程，偏好线代/数据结构/算法；2 推荐信+SOP+CV+成绩单+$90；2026-27 每学分 $2,758 总学费 $82,740；FAQ 明示 STEM-eligible，stem1。排除 part-time/春季/PhD/在线。",
 "Georgetown MS Health Informatics & Data Science（geo-hids-ms）：半核验入库。医学院 BGE；12 个月 30 学分；STEM program；Early 1/15 Priority 5/15 Final 7/1；GRE optional 有则鼓励；GPA3.0；CS/物理/数学/生物/医学相关学位，非技术学位须编程证明；2 推荐信+SOP+CV+成绩单；语言项目级最低分待补；学费走 BGE 通用费率（≥12cr $31,416/学期，不足 $2,618/学分）；强制 capstone 业界/政府实习；方向人因/影像信息学/EHR 挖掘/数字健康。排除 part-time/PhD/其他 BGE 学位/在线。",
 "Georgetown MS Biostatistics（geo-biostat-ms）：半核验入库。DBBB 系；17 个月 30 核心+2 Practicum=32 学分；12 门核心（概率抽样/统计推断/分类/生存/线性模型/统计软件/生信 ML/实验设计临床/流病/定量报告/DS）；Early 1/15 Priority 5/15 Final 7/1；GRE notreq；GPA3.0；先修 Calc I&II+统计(B+)、多元微积分+线代；3 推荐信+SOP+CV+成绩单；语言最低分待补；学费 BGE 通用费率；部分 GRA；页面未明示 STEM，stem0。排除 Biostat PhD/part-time/在线。",
 "Georgetown MS Data Science for Public Policy（geo-dspp-ms）：核验入库。McCourt 公共政策学院；2 年 39 学分（33 核心+6 选修）+120 小时正式实习；STEM-designated；cohort 21+；Early 12/1 Priority 1/15 Final 3/1；TOEFL100(新5)/IELTS7.0；GRE Fall2027 起 notreq 但强烈推荐，接受 GMAT；无工作经验/正式先修，建议 Python/R+微积分；3 推荐信(≥1 学术 1 职业)+SOP 一页+CV+成绩单；每学分 $2,758 打包总额未列。排除 PhD/在线在职/其他 McCourt 学位。",
 "卡点待复核（本轮新增/更新）：Vandy CS graduate 站正文明示 30-credit online master's、面向 working professionals、晚间在线课，按在线/在职排除；Geo Cybersecurity Risk Management（SCS MPS）On-campus or Online、full/part-time、2–5 年、春秋夏入学，混合在职/在线性质待终检定性；Geo HIDS 与 Biostat 语言项目级最低分、HIDS/Biostat 专属打包学费待研究生院/BGE 口径回填；Vandy BME/ECE/ME/CBE/CEE 等研究型 MS/PhD 留批次 5。",
]
for n in notes:
    if n[:40] not in " ".join(b["blocked_notes"]):
        b["blocked_notes"].append(n)

b["note"]=b["note"]+" 2026-11-19 心跳第十五轮入库 5 条：Vandy DS + Geo DSAN/HIDS/Biostat/DSPP。重探：Rice CS 200；Stanford/USC Viterbi/JHU Eng 403；NYU GSAS 202 0B；UT Stat/Math 小字节 challenge 页待浏览器确认；Vandy CS 在线在职排除。"
json.dump(b,open("_heartbeat_baseline.json","w",encoding="utf-8"),ensure_ascii=False,indent=2)
print("基线已刷新：programs",b["programs"],"master",master,"phd",phd,"VD",vd_n,"details",det_n,"pending",len(b["pending_browser_check"]),"blocked",len(b["blocked_notes"]))
