#!/usr/bin/env python3
"""Build 5 detail pages for round 174: Caltech MSEE / Caltech MS Aero / UChicago Harris MPP / UChicago MSCAPP / Vanderbilt MSCS."""
import os

DETAILS = [
    {
        "file": "details/caltech-msee.html",
        "school": "加州理工学院",
        "school_code": "caltech",
        "program_cn": "电子工程理学硕士（MSEE · 1 年 · terminal MS · 自费）",
        "program_en": "Master of Science in Electrical Engineering (MSEE)",
        "degree": "M.S. in E.E.",
        "duration": "1 academic year (3 terms)",
        "stem": True,
        "ddl": "申请窗口 11/15 - 12/15，Fall 入学（精确日期待补）",
        "lang": "TOEFL / IELTS / PTE / Duolingo 均接受；Caltech 不设最低分（官方 FAQ：no minimum requirement），但要求 strong English proficiency",
        "test": "GRE encouraged（非强制；不同 option 政策略有差异，详见 EE 系页）",
        "tuition": "USD 71,022/年（2026-27 学费 + mandatory fees；PhD 学生全奖覆盖，terminal MS 经济资助极少）",
        "url_official": "https://catalog.caltech.edu/current/information-for-graduate-students/special-regulations-for-graduate-options/electrical-engineering-ee/",
        "cards": [
            ("学位与学制", [
                "MSEE 是 Caltech 官方认可的 terminal master's，每年仅招极少量外部申请者",
                "学制 1 个 academic year（3 个 term），135 units（其中 100 级及以上课程）",
                "无 thesis 要求；principal criteria 是数学/物理导向课程准备与课程项目能力",
                "学校官方明确：The Institute does not normally admit an applicant to the master's degree in a field in which the applicant already has a master's degree from another U.S. institution",
                "Financial aid is seldom offered to those who intend to complete their graduate work with a master's degree（自费为主）",
                "joint B.S./M.S. degree is not available in EE"
            ]),
            ("核心课程与学分", [
                "135 units 由 EE graduate adviser 批准选课",
                "课程为数学/物理导向（graduate-level EE）",
                "具体核心课程清单：系站页面暂不可达，待补",
                "GPA 要求：approved master's candidacy courses GPA ≥ 1.9（Caltech 4.0 制）"
            ]),
            ("申请要求", [
                "在线申请：gradoffice.caltech.edu/admissions",
                "申请窗口 11/15 - 12/15（Fall 入学）",
                "3 封推荐信（官方 FAQ 明确要求）",
                "本科成绩单（科学或工程相关背景）",
                "Statement of Purpose 描述研究兴趣与导师匹配",
                "GRE 非强制（EE 系官方 catalog 鼓励提交）",
                "国际生：TOEFL / IELTS / PTE / Duolingo；无最低分，但 strong English capability 是隐含门槛",
                "录取高度竞争，优先给计划读 PhD 的学生（MSEE 通常是 PhD 途中退出选项）"
            ]),
            ("先修与背景", [
                "本科 science or engineering 背景（与申请 option 相关）",
                "数学/物理导向课程准备是 MSEE 的 principal evaluation criteria",
                "无硬性先修课程清单（系站页面暂不可达，待补）"
            ]),
            ("费用与资助", [
                "Tuition + mandatory fees: USD 71,022/年（2026-27）",
                "学费按 term 分三期缴纳：Fall 9/28/2026、Winter 1/4/2027、Spring 3/29/2027",
                "PhD 学生学费 + 生活费全奖；terminal MS 经济资助极少",
                "健康保险 Caltech 补贴约 80%，学生承担剩余部分",
                "住宿、生活费等详见 gradoffice.caltech.edu/financialsupport/budget"
            ]),
            ("录取提示", [
                "Caltech 官方 FAQ 明确：Very few departments admit directly for the MS degree；EE 是仅有的 3 个 terminal MS option 之一（Aeronautics / EE / Space Engineering）",
                "录取高度竞争，faculty 评估 research interest match 为核心",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "国际生须参加 Orientation 期间的 ESL 一对一评估，可能被要求修 ESL 课程"
            ])
        ]
    },
    {
        "file": "details/caltech-ms-aero.html",
        "school": "加州理工学院",
        "school_code": "caltech",
        "program_cn": "航空理学硕士（GALCIT · 1 年 · 无 thesis · terminal MS）",
        "program_en": "Master of Science in Aeronautics (GALCIT)",
        "degree": "M.S. in Aeronautics",
        "duration": "1 year (135 units)",
        "stem": True,
        "ddl": "申请窗口 11/15 - 12/15，Fall 入学（精确日期待补）",
        "lang": "TOEFL / IELTS / PTE / Duolingo 均接受；无最低分，要求 strong English capability",
        "test": "GRE optional（GALCIT 官方：Submission of GRE exam scores is optional for the 2024 admissions process in aerospace）",
        "tuition": "USD 71,022/年（2026-27；terminal MS 自费，PhD 全奖）",
        "url_official": "https://www.catalog.caltech.edu/archive/2024-25/information-for-graduate-students/special-regulations-for-graduate-options/aerospace-ae/",
        "cards": [
            ("学位与学制", [
                "M.S. in Aeronautics 是 Caltech GALCIT 提供的 terminal master's，1-year 项目",
                "135 units，其中至少 81 units 须从 aeronautics curricular track 中选修",
                "无 research requirement，无 thesis requirement（官方明确）",
                "课程必须在 1 年内完成",
                "Graduate program at GALCIT is primarily focused on Ph.D.-level research and so priority in admission is given to those who plan to ultimately perform Ph.D.-level research"
            ]),
            ("核心课程与学分", [
                "5 门 core courses（具体课程清单：系站页面暂不可达，待补）",
                "135 units total，至少 81 units from aeronautics curricular track",
                "剩余 units 可从 aerospace engineering 相关研究生课程选修"
            ]),
            ("申请要求", [
                "在线申请：gradoffice.caltech.edu/admissions",
                "申请窗口 11/15 - 12/15，Fall 入学",
                "本科成绩单（science or engineering）",
                "3 封推荐信",
                "English proficiency 证明（TOEFL/IELTS/PTE/Duolingo）",
                "GRE optional（2024 政策，最新政策待系站确认）"
            ]),
            ("先修与背景", [
                "本科 baccalaureate degree equivalent to Caltech（science/engineering）",
                "课程准备：本科数学、物理、工程基础",
                "无硬性先修课程清单（系站页面暂不可达，待补）"
            ]),
            ("费用与资助", [
                "Tuition + mandatory fees: USD 71,022/年（2026-27）",
                "学费按 term 分三期缴纳",
                "Terminal MS 经济资助极少；PhD 学生全奖覆盖学费 + 生活费",
                "健康保险 Caltech 补贴约 80%"
            ]),
            ("录取提示", [
                "Caltech 官方 FAQ 明确：Aeronautics 是仅有的 3 个 terminal MS option 之一",
                "录取 priority 给计划读 PhD 的学生；terminal MS 录取名额极少",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "国际生 Orientation 期间须参加 ESL 评估"
            ])
        ]
    },
    {
        "file": "details/uchicago-harris-mpp.html",
        "school": "芝加哥大学",
        "school_code": "uchicago",
        "program_cn": "公共政策硕士（MPP · 2 年 · flagship · Harris 学院）",
        "program_en": "Master of Public Policy (MPP, Harris School of Public Policy)",
        "degree": "MPP",
        "duration": "2 years (6 quarters)",
        "stem": False,
        "ddl": "Autumn Quarter 入学；申请轮次见 Harris Admissions（精确轮次与日期待补）",
        "lang": "TOEFL iBT / IELTS Academic（Harris 官方：具体分数要求待系站确认；UChicago 研究生院标准 TOEFL 90+/IELTS 7.0 起）",
        "test": "GRE required 或满足 4 项 waiver 条件之一（简历含 5+ 年全职工作经验 / 本科工程学位且 GPA ≥ 3.0 / 硕士学位量化背景 / 美国研究生课程完成）",
        "tuition": "Harris MPP 学费约 USD 70,000+/年（精确数字待 Harris 系站确认）",
        "url_official": "https://harris.uchicago.edu/academics/degrees/master-public-policy-mpp",
        "cards": [
            ("学位与学制", [
                "MPP 是 Harris School of Public Policy 的 flagship 项目，2 年（6 quarters）",
                "6 门 core courses taught sequentially（必须按顺序修，错过 Autumn 第一季度无法进入第二季度）",
                "Autumn Quarter 入学（不可 Spring/Fall 入学，官方 FAQ 明确）",
                "课程内容：economic models、policy simulation、evidence-based recommendations、R 数据分析、policy trade-off analysis、political economy"
            ]),
            ("核心课程与学分", [
                "6 门 core courses（具体课程清单：Harris 系站待补）",
                "Elective flexibility 最高（Harris 旗舰项目中 elective 最多）",
                "Summer internship 是项目隐含要求（Year 1 后）"
            ]),
            ("申请要求", [
                "在线 Graduate Application",
                "Resume（含工作经验、教育、社区服务、专业荣誉）",
                "Motivation Statement（300 词：Why Harris? Why public policy?）",
                "可选 Short Essay（二选一）：Policy 题 500 词 / Community 题 300 词",
                "本科成绩单（unofficial 申请时提交，录取后 official）",
                "Letters of Recommendation（具体数量待系站确认，通常 2-3 封）",
                "GRE required 或满足 4 项 waiver 条件之一",
                "TOEFL/IELTS（国际生）"
            ]),
            ("先修与背景", [
                "不限本科专业（接受 humanities/social science/STEM 各种背景）",
                "隐含偏好：定量分析能力、公共事务兴趣",
                "无硬性先修课程要求"
            ]),
            ("费用与资助", [
                "Harris MPP 学费约 USD 70,000+/年（精确数字待 Harris 系站确认）",
                "奖学金：merit-based scholarship 自动考虑，无需单独申请",
                "Assistantship / work-study 机会",
                "Summer internship 通常有薪（非 Harris 保证）"
            ]),
            ("录取提示", [
                "Harris 项目家族：MPP 2-year flagship / MA 1-year / MSCAPP 2-year / MSDAP 11-month summer / MACRM 2-year PhD-bound / MSCEP 11-month climate/energy",
                "MPP 适合想在 policy analysis 方向深耕、elective 灵活的学生",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "排除项：Harris Evening Master's Program (EMP) 是 part-time evening，mid-career 15 个月 → 排除"
            ])
        ]
    },
    {
        "file": "details/uchicago-mscapp.html",
        "school": "芝加哥大学",
        "school_code": "uchicago",
        "program_cn": "计算分析与公共政策理学硕士（MSCAPP · 2 年 · Harris × CS 联合 · STEM）",
        "program_en": "Master of Science in Computational Analysis and Public Policy (MSCAPP)",
        "degree": "MSCAPP",
        "duration": "2 years (6 quarters)",
        "stem": True,
        "ddl": "Autumn Quarter 入学；申请轮次见 Harris Admissions（精确日期待补）",
        "lang": "TOEFL iBT / IELTS Academic（具体分数要求待 Harris 系站确认）",
        "test": "GRE required 或满足 4 项 waiver 条件之一",
        "tuition": "Harris MSCAPP 学费约 USD 70,000+/年（精确数字待系站确认）",
        "url_official": "https://harris.uchicago.edu/academics/degrees/ms-computational-analysis-public-policy-mscapp",
        "cards": [
            ("学位与学制", [
                "MSCAPP 是 Harris School of Public Policy 与 Department of Computer Science 联合提供的 2-year 项目",
                "全美最早的计算分析与公共政策交叉项目之一",
                "Autumn Quarter 入学",
                "Year 1 summer internship（隐含要求）",
                "毕业生方向：civic technologists、data scientists、policy researchers"
            ]),
            ("核心课程与学分", [
                "11 门 core courses（C- 及以上）",
                "Statistics I + II（PPHA 31002/31202 + PPHA 31102/31301）",
                "Computer Science with Applications I + II（CAPP 30121/30122）",
                "Databases for Public Policy（CAPP 30235）",
                "Machine Learning for Public Policy I + II（CAPP 30250/30521，或 CAPP 30524 单学期版）",
                "Mathematics for Computer Science and Data Analysis（CAPP 30271）",
                "Program Evaluation: Data Analytics and Research Design（PPHA 34610）",
                "Microeconomics I + II（PPHA 序列）",
                "Analytical Politics / Political Economy I（PPHA）",
                "至少 7 门 PPHA 课程"
            ]),
            ("申请要求", [
                "在线 Graduate Application（Harris 申请系统）",
                "Resume（含技术背景）",
                "Motivation Statement（300 词）",
                "可选 Short Essay（二选一：Policy 500 词 / Community 300 词）",
                "本科成绩单",
                "Letters of Recommendation",
                "GRE required 或 waiver",
                "TOEFL/IELTS（国际生）"
            ]),
            ("先修与背景", [
                "隐含偏好：编程基础、统计/定量背景",
                "无硬性先修课程要求（Year 1 从基础 CS/Statistics 教起）",
                "接受 non-CS 背景但需有 quantitative preparation"
            ]),
            ("费用与资助", [
                "Harris MSCAPP 学费约 USD 70,000+/年（精确数字待系站确认）",
                "Merit-based scholarship 自动考虑",
                "Summer internship 通常有薪"
            ]),
            ("录取提示", [
                "MSCAPP 是数据科学 + 公共政策的交叉项目，适合想做 civic tech / public sector data science 的学生",
                "Year 1 课程强度大（5-part computational series + 2 门统计 + 2 门微观）",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "与 MScA（NBC Tower Graham School）区别：MSCAPP 在 Harris × CS 联合，2 年；MScA 是 Graham School professional，12-15 个月"
            ])
        ]
    },
    {
        "file": "details/vandy-ms-cs.html",
        "school": "范德堡大学",
        "school_code": "vanderbilt",
        "program_cn": "计算机科学理学硕士（MSCS · 在校 · research-oriented · 可匹配导师）",
        "program_en": "Master of Science in Computer Science (MSCS, on-campus)",
        "degree": "MS",
        "duration": "1.5-2 years（typical；含 thesis 或 non-thesis）",
        "stem": True,
        "ddl": "Fall priority: Jan 15, 2027; Fall regular: Mar 1, 2027; Spring: Oct 15",
        "lang": "TOEFL iBT ~90（或 TOEFL Essentials 4.5，单项不低于 4.0）；IELTS Academic 7.0（单项不低于 6.0）；Duolingo 130",
        "test": "GRE indefinitely waived（官方：The Graduate Program for Computer Science has indefinitely waived GRE scores）",
        "tuition": "Vanderbilt Graduate School 学费约 USD 60,000+/年（精确数字待系站确认）",
        "url_official": "https://computing.vanderbilt.edu/mscs/",
        "cards": [
            ("学位与学制", [
                "MS in Computer Science 是 Vanderbilt College of Connected Computing 提供的在校硕士",
                "面向 computer science / engineering / science majors with strong computing coursework",
                "Get real research experience without committing to a Ph.D.（research-oriented master's）",
                "申请时填写感兴趣的 topics and faculty，学校匹配 adviser",
                "学制 typical 1.5-2 years（具体 thesis/non-thesis 路径待系站确认）"
            ]),
            ("核心课程与学分", [
                "课程清单：系站页面暂不可达，待补",
                "含 research component（与 faculty adviser 合作）",
                "具体学分要求待系站确认"
            ]),
            ("申请要求", [
                "在线申请：Vanderbilt Graduate School",
                "Fall 申请：Aug 1 开放；priority Jan 15，regular Mar 1",
                "Spring 申请：Oct 15",
                "Transcripts",
                "Statement of Purpose",
                "Letters of Recommendation（具体数量待系站确认）",
                "GRE waived indefinitely",
                "TOEFL iBT ~90 / IELTS 7.0 / Duolingo 130",
                "国际生：course-by-course credential evaluation（WES 或 NACES member）"
            ]),
            ("先修与背景", [
                "本科 CS / engineering / science 背景",
                "Strong computing coursework 是隐含要求",
                "申请时需填写感兴趣的 topics and faculty（match 是录取关键）"
            ]),
            ("费用与资助", [
                "Vanderbilt Graduate School 学费约 USD 60,000+/年（精确数字待系站确认）",
                "Research assistantship 机会（与 adviser 匹配后）",
                "Merit scholarship 自动考虑"
            ]),
            ("录取提示", [
                "在线 MSCS 项目当前 Admissions Paused（学校 redesiging curriculum），不要混淆",
                "在校 MSCS 与在线 MSCS 是两个独立项目；本条目仅指在校 in-person",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "Faculty match 是录取核心，申请前建议先浏览 faculty research interests"
            ])
        ]
    }
]

def build_html(d):
    stem_badge = '<span class="badge badge-stem">STEM</span>' if d["stem"] else ''
    cards_html = ''
    for title, items in d["cards"]:
        lis = '\n'.join(f'              <li>{it}</li>' for it in items)
        cards_html += f'''
          <div class="card">
            <h3>{title}</h3>
            <ul>
{lis}
            </ul>
          </div>'''
    return f'''<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>{d["program_cn"]} - {d["school"]}</title>
<link rel="stylesheet" href="../style.css">
</head>
<body>
  <header>
    <h1>{d["school"]} · {d["program_en"]}</h1>
    <p class="subtitle">{d["program_cn"]} {stem_badge}</p>
  </header>
  <section class="meta">
    <div><b>学位：</b>{d["degree"]}</div>
    <div><b>学制：</b>{d["duration"]}</div>
    <div><b>申请截止：</b>{d["ddl"]}</div>
    <div><b>语言：</b>{d["lang"]}</div>
    <div><b>标化：</b>{d["test"]}</div>
    <div><b>学费：</b>{d["tuition"]}</div>
    <div><b>官网：</b><a href="{d["url_official"]}" target="_blank">{d["url_official"]}</a></div>
  </section>
  <section class="cards">
{cards_html}
  </section>
  <footer>
    <p>本页为半核验页：核心字段已从学校官网核验，标注"待补"字段待系站恢复后补全。录取分布，非最低门槛。</p>
  </footer>
</body>
</html>
'''

for d in DETAILS:
    path = d["file"]
    with open(path, 'w', encoding='utf-8') as f:
        f.write(build_html(d))
    print(f'[OK] wrote {path}')
