#!/usr/bin/env python3
"""Build 5 detail pages for round 175: Caltech Space Eng / UChicago Harris MA 1yr / Dartmouth MSCS / UChicago Crown SSA MA / Notre MSA."""
import os

DETAILS = [
    {
        "file": "details/caltech-ms-space.html",
        "school": "加州理工学院",
        "school_code": "caltech",
        "program_cn": "空间工程理学硕士（GALCIT · 1 年 · 无 thesis · terminal MS）",
        "program_en": "Master of Science in Space Engineering (GALCIT)",
        "degree": "M.S. in Space Engineering",
        "duration": "1 year (135 units)",
        "stem": True,
        "ddl": "申请窗口 12/1 - 1/15，Fall 入学（gradoffice 最新）",
        "lang": "TOEFL / IELTS / PTE / Duolingo 均接受；无最低分，要求 strong English capability",
        "test": "GRE Recommended（R，非强制；无分数不会处于录取劣势）",
        "tuition": "USD 71,022/年（2026-27；terminal MS 自费，PhD 全奖）",
        "url_official": "https://www.catalog.caltech.edu/archive/2025-26/information-for-graduate-students/special-regulations-for-graduate-options/aerospace-ae/",
        "cards": [
            ("学位与学制", [
                "M.S. in Space Engineering 是 Caltech GALCIT 提供的 terminal master's，1-year 项目",
                "135 units，5 门 core courses",
                "无 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",
                "Caltech 官方 FAQ 明确：Space Engineering 是仅有的 3 个 terminal MS option 之一（Aeronautics / EE / Space Engineering）"
            ]),
            ("核心课程与学分", [
                "5 门 core courses（具体课程清单：系站页面暂不可达，待补）",
                "135 units total",
                "剩余 units 可从 aerospace engineering / space engineering 相关研究生课程选修"
            ]),
            ("申请要求", [
                "在线申请：gradoffice.caltech.edu/admissions",
                "申请窗口 12/1 - 1/15，Fall 入学",
                "本科成绩单（science or engineering）",
                "3 封推荐信",
                "English proficiency 证明（TOEFL/IELTS/PTE/Duolingo）",
                "GRE Recommended（非强制，无分数不处于劣势）",
                "无最低 GPA 要求（官方明确：There is no minimum grade point average or other quantitative metric）",
                "每人每轮申请只能申请一个 option；录取委员会可推荐转其他 option（不另收费）"
            ]),
            ("先修与背景", [
                "本科 baccalaureate degree equivalent to Caltech（science/engineering）",
                "课程准备：本科数学、物理、工程基础",
                "无硬性先修课程清单（系站页面暂不可达，待补）"
            ]),
            ("费用与资助", [
                "Tuition + mandatory fees: USD 71,022/年（2026-27）",
                "学费按 term 分三期缴纳",
                "Terminal MS 经济资助极少；PhD 学生全奖覆盖学费 + 生活费",
                "申请费减免面向符合条件的申请者（详见 gradoffice）"
            ]),
            ("录取提示", [
                "Caltech 官方 FAQ 明确：Space Engineering 是仅有的 3 个 terminal MS option 之一",
                "录取 priority 给计划读 PhD 的学生；terminal MS 录取名额极少",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "国际生 Orientation 期间须参加 ESL 评估"
            ])
        ]
    },
    {
        "file": "details/uchicago-harris-ma.html",
        "school": "芝加哥大学",
        "school_code": "uchicago",
        "program_cn": "公共政策文学硕士（MA · 1 年加速 · 9 门课 · Harris 学院）",
        "program_en": "Master of Arts in Public Policy (MA, Harris School of Public Policy)",
        "degree": "MA",
        "duration": "1 year (3 quarters, 9 graduate-level courses)",
        "stem": False,
        "ddl": "Autumn Quarter 入学；申请轮次见 Harris Admissions（精确日期待补）",
        "lang": "TOEFL iBT / IELTS Academic（具体分数要求待 Harris 系站确认）",
        "test": "GRE required 或满足 4 项 waiver 条件之一",
        "tuition": "Harris MA 学费约 USD 70,000+/年（精确数字待 Harris 系站确认）",
        "url_official": "https://harris.uchicago.edu/academics/degrees/ma-public-policy",
        "cards": [
            ("学位与学制", [
                "MA in Public Policy 是 Harris 提供的 1-year accelerated 项目",
                "9 graduate-level courses (900 units) = 5 门 core + 4 门 elective",
                "至少 7 门 Public Policy (PPHA) 课程",
                "必须 Fall 完成 3 门 core + Winter 至少 2 门 core（顺序要求）",
                "Autumn Quarter 入学",
                "适合已有其他学位或工作经验、希望用 1 年补充 policy analysis / data science / analytical skills 的学生"
            ]),
            ("核心课程与学分", [
                "5 门 core（从 MPP 6 门 core 中任选 5 门）：",
                "PPHA 30800 Analytical Politics I: Strategic Foundations",
                "PPHA 31610 Analytical Politics II: Political Institutions",
                "Statistics Sequence I: PPHA 31002 或 PPHA 31202",
                "Statistics Sequence II: PPHA 31102 或 PPHA 31301",
                "Microeconomics Sequence I + II: PPHA 32300/32310 或 PPHA 32400/32410",
                "4 门 elective（具体清单：Harris 系站待补）",
                "GPA 要求：core courses C- 及以上；cumulative GPA 2.7+"
            ]),
            ("申请要求", [
                "在线 Graduate Application",
                "Resume（含工作经验、教育、社区服务）",
                "Motivation Statement（300 词：Why Harris? Why public policy?）",
                "可选 Short Essay（二选一：Policy 500 词 / Community 300 词）",
                "本科成绩单",
                "Letters of Recommendation",
                "GRE required 或满足 4 项 waiver 条件之一",
                "TOEFL/IELTS（国际生）"
            ]),
            ("先修与背景", [
                "不限本科专业（接受 humanities/social science/STEM 各种背景）",
                "隐含偏好：定量分析能力、公共事务兴趣",
                "无硬性先修课程要求"
            ]),
            ("费用与资助", [
                "Harris MA 学费约 USD 70,000+/年（精确数字待 Harris 系站确认）",
                "Merit-based scholarship 自动考虑",
                "1-year 项目无 summer internship（隐含）"
            ]),
            ("录取提示", [
                "Harris 项目家族：MPP 2-year flagship / MA 1-year accelerated / MSCAPP 2-year / MSDAP 11-month summer / MACRM 2-year PhD-bound / MSCEP 11-month climate/energy",
                "MA 适合已有其他学位或工作经验、希望快速补充 policy 技能的学生；本科直申更推荐 MPP 2-year",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "排除项：Harris Evening Master's Program (EMP) 是 part-time evening，mid-career → 排除"
            ])
        ]
    },
    {
        "file": "details/dartmouth-ms-cs.html",
        "school": "达特茅斯学院",
        "school_code": "dartmouth",
        "program_cn": "计算机科学理学硕士（MSCS · 13 门课 · Guarini 研究生院 · 在校）",
        "program_en": "Master of Science in Computer Science (MSCS, Guarini School)",
        "degree": "MS",
        "duration": "1.5-2 years typical（13 门 graduate courses）",
        "stem": True,
        "ddl": "Fall 2027: December 15, 2026",
        "lang": "TOEFL iBT / IELTS / Duolingo（非 US/加拿大学位者；Guarini ETS code 3351）",
        "test": "GRE Not accepted（官方明确）",
        "tuition": "Dartmouth Guarini 学费约 USD 60,000+/年（精确数字待系站确认）",
        "url_official": "https://web.cs.dartmouth.edu/graduate/apply-graduate-programs/masters-computer-science",
        "cards": [
            ("学位与学制", [
                "MS in Computer Science 是 Dartmouth Guarini School of Graduate and Advanced Studies 提供的在校硕士",
                "Coursework MS 项目：13 门 red/green/blue courses",
                "有两个 track：Standard MS CS / Digital Arts MS CS (MSDA, 2-year)",
                "4+1 AB/MS 是 Dartmouth 本校本科项目，不适用外部申请者",
                "研究方向：Machine Learning / Mobile and Wireless / NLP / Robotics / Security and Privacy / Theory"
            ]),
            ("核心课程与学分", [
                "13 门 graduate-level courses（red/green/blue courses）",
                "具体课程清单：系站页面暂不可达，待补",
                "Digital Arts concentration 需 portfolio of art/research projects"
            ]),
            ("申请要求", [
                "在线申请：Guarini School of Graduate and Advanced Studies",
                "Fall 2027 申请截止：December 15, 2026",
                "Application fee: $75（Guarini）/ $150（Digital Arts 页面）",
                "3 封推荐信（最多 4 封）",
                "Transcripts",
                "Statement of Purpose",
                "Upload 100-line sample of code in any language + 一段解释",
                "CS paper sample（conference/class/personal interest；多作者论文选自己主要贡献章节）",
                "GRE Not accepted（官方明确）",
                "TOEFL/IELTS/Duolingo（非 US/加拿大学位者；ETS code 3351）"
            ]),
            ("先修与背景", [
                "本科 CS / engineering / science 背景",
                "Strong computing coursework 是隐含要求",
                "Digital Arts track 需要 portfolio of art/research projects",
                "无硬性先修课程清单（系站页面暂不可达，待补）"
            ]),
            ("费用与资助", [
                "Dartmouth Guarini 学费约 USD 60,000+/年（精确数字待系站确认）",
                "Research/teaching assistantship 机会（与 faculty 匹配后）",
                "Merit scholarship 自动考虑"
            ]),
            ("录取提示", [
                "MSDA（Digital Arts）是 2-year MS with concentration in Digital Arts，需 portfolio",
                "Standard MSCS 是 1.5-2 year coursework 项目",
                "4+1 AB/MS 仅对 Dartmouth 本校本科开放，外部申请者不要混淆",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数"
            ])
        ]
    },
    {
        "file": "details/uchicago-crown-ssa-ma.html",
        "school": "芝加哥大学",
        "school_code": "uchicago",
        "program_cn": "社会工作社会政策与社会行政文学硕士（MA SSA · 2 年 · Crown Family School · 含 field placement）",
        "program_en": "Master of Arts in Social Work, Social Policy, and Social Administration (SSA)",
        "degree": "MA",
        "duration": "2 years full-time（含 2-year field placement / internship）",
        "stem": False,
        "ddl": "Autumn Quarter 入学；申请轮次见 Crown Family Admissions（精确日期待补）",
        "lang": "TOEFL iBT 104 overall（每个 sub-score 26）/ IELTS 7 overall（每个 sub-score 7）",
        "test": "GRE not required（官方明确）",
        "tuition": "Crown Family School MA 学费约 USD 60,000+/年（精确数字待系站确认）",
        "url_official": "https://crownschool.uchicago.edu/admissions/masters-admissions/application-requirements",
        "cards": [
            ("学位与学制", [
                "MA in Social Work, Social Policy, and Social Administration (SSA) 是 Crown Family School of Social Work, Policy, and Practice 的核心项目",
                "2-year full-time 项目",
                "CSWE (Council on Social Work Education) 认证项目",
                "含 2-year field placement（evaluated internship，跨 Autumn/Winter/Spring quarters）",
                "有 Advanced Standing 选项（要求 BSW 学位，可缩短项目）",
                "本科 GPA < 2.8 需 post-bachelor's social work employment 经历"
            ]),
            ("核心课程与学分", [
                "1st-year core required courses + 1st-year practicum",
                "2nd-year advanced coursework + 2nd field placement",
                "具体课程清单：Crown Family 系站待补",
                "Bachelor's BSW 毕业生不重复本科已修内容（Advanced Standing）"
            ]),
            ("申请要求", [
                "在线 Application",
                "Statement of Purpose（学术背景、专业经历、申请动机、长期目标）",
                "Resume/CV（学术、工作、研究、志愿者经历）",
                "Transcripts（所有本科/研究生院校；非英文需 certified translation）",
                "Letters of Recommendation（professors/research advisors/supervisors/colleagues）",
                "GRE not required（官方明确）",
                "TOEFL iBT 104 overall（每个 sub-score 26）/ IELTS 7 overall（每个 sub-score 7）",
                "语言豁免：仅 US/Canada 学位 full-time coursework；remote study / non-degree / intensive English 不豁免"
            ]),
            ("先修与背景", [
                "无本科专业硬性要求（liberal arts 背景优先）",
                "隐含偏好：economics / political science / sociology / history / cultural anthropology / psychology 基础",
                "BSW 学位可申 Advanced Standing",
                "GPA < 2.8 需 post-bachelor's social work employment"
            ]),
            ("费用与资助", [
                "Crown Family School MA 学费约 USD 60,000+/年（精确数字待系站确认）",
                "Field placement/internship 通常无薪（CSWE 要求）",
                "Merit scholarship 与 social work-specific funding 机会"
            ]),
            ("录取提示", [
                "SSA 是 social work 方向的专业硕士，毕业生方向：social work practice / policy analysis / nonprofit leadership / community development",
                "与 Harris MPP/MSCAPP 区别：SSA 侧重 social work practice 与 field placement，Harris 侧重 policy analysis 与 quantitative skills",
                "录取分布，非最低门槛——官方不公布 GPA/GRE 中位数",
                "Joint BA/MA 仅对 UChicago 本校本科开放（GPA 3.25+），外部申请者不要混淆"
            ])
        ]
    },
    {
        "file": "details/notre-msa.html",
        "school": "圣母大学",
        "school_code": "notre",
        "program_cn": "会计理学硕士（MSA · 10 个月 · 30 学分 · Mendoza 在校 · 可选 STEM 数据 analytics 方向）",
        "program_en": "Master of Science in Accountancy (MSA, Mendoza College of Business)",
        "degree": "MSA",
        "duration": "10 months / 30 credit hours",
        "stem": True,
        "ddl": "Early Action Sep 10, 2026 / R1 Oct 20, 2026 / R2 Jan 7, 2027 / R3 Mar 17, 2027（Spring 2027 申请人须 R1 前提交）",
        "lang": "TOEFL / IELTS / PTE / Duolingo（国际生；具体分数要求待 Mendoza 系站确认）",
        "test": "GMAT not required for US 本科；国际生需 GMAT 或 waiver（需展示 quantitative and academic readiness）",
        "tuition": "USD 55,660（10 个月项目总学费）",
        "url_official": "https://mendoza.nd.edu/graduate-programs/accountancy-msa",
        "cards": [
            ("学位与学制", [
                "MSA 是 Mendoza College of Business 提供的 10-month on-campus 会计硕士",
                "30 credit hours，max 18 credits/semester（6 courses/module）",
                "Spring 或 Fall 入学（August 或 January）",
                "0-2 years experience（pre-professional）",
                "可选 STEM-designated concentration in data analytics（可同时修 MBA 课程）",
                "25% 班级本科非会计专业（通过 Accounting Immersion Program summer 补齐先修）"
            ]),
            ("核心课程与学分", [
                "30 credit hours",
                "具体课程清单：Mendoza 系站待补",
                "可选 STEM concentration in data analytics（含 MBA 课程）",
                "Concentrations：Accountancy / Audit / Tax / Data Analytics（STEM）"
            ]),
            ("申请要求", [
                "在线 Application",
                "Application fee: $50（Active Duty Military / Peace Corps / Teach for America 可申请 fee waiver）",
                "Transcripts（所有院校；unofficial 申请时可接受，录取后 official）",
                "2 封推荐信（至少 1 封学术）",
                "先修课程（6 门）：Accountancy I (Financial Accounting) / Accountancy II (Managerial Accounting) / Measurement & Disclosure I (Intermediate I) / Measurement & Disclosure II (Intermediate II) / Audit & Assurance Services / Federal Taxation",
                "无会计背景：走 Accounting Immersion Program（summer 先修）",
                "GMAT not required for US 本科；国际生需 GMAT 或 waiver",
                "TOEFL/IELTS/PTE/Duolingo（国际生）"
            ]),
            ("先修与背景", [
                "6 门会计先修课程（见上）",
                "无会计背景可走 Accounting Immersion Program",
                "0-2 years experience（pre-professional）",
                "接受 non-accounting 本科背景（25% 班级）"
            ]),
            ("费用与资助", [
                "Tuition: USD 55,660（10 个月项目总学费）",
                "Merit scholarship 与 graduate assistantship 机会",
                "2021 届 100% 6 个月内接受 full-time job offer"
            ]),
            ("录取提示", [
                "MSA 是会计方向 professional master's，毕业生方向：public accounting / corporate finance / audit / tax",
                "与 MSBA/MSF 同属 Mendoza 研究生家族，4 轮申请时间一致",
                "可选 STEM concentration in data analytics 是近年新增方向，适合想做会计+数据交叉的学生",
                "录取分布，非最低门槛——官方不公布 GPA/GMAT 中位数"
            ])
        ]
    }
]

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}')
