# -*- coding: utf-8 -*-
import os
DET = r"D:\work buddy\2026-11-05-14-15-52\details"
CSS = "body{font-family:-apple-system,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;max-width:960px;margin:0 auto;padding:24px;color:#222;line-height:1.65;background:#fafafa}h1{font-size:22px;border-bottom:3px solid #1a3a6c;padding-bottom:10px}h2{font-size:16px;color:#1a3a6c;margin-top:28px;background:#eef2f8;padding:8px 12px;border-left:4px solid #1a3a6c}ul{margin:8px 0;padding-left:22px}li{margin:4px 0}.meta{background:#fff;border:1px solid #dde;border-radius:6px;padding:12px 16px;margin:14px 0}.meta b{color:#1a3a6c}a{color:#1a6fc4}.badge{display:inline-block;background:#1a3a6c;color:#fff;padding:2px 8px;border-radius:10px;font-size:12px;margin-left:8px}.warn{background:#fff8e1;border-left:4px solid #f0a020;padding:8px 12px;margin:12px 0}"

def page(title, badge, rows, sections, warn):
    rh = "<br>".join("<b>%s</b>：%s" % (k, v) for k, v in rows)
    sh = ""
    for h, items in sections:
        sh += "<h2>%s</h2><ul>" % h + "".join("<li>%s</li>" % x for x in items) + "</ul>"
    return '<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>%s</title><style>%s</style></head><body><h1>%s <span class="badge">%s</span></h1><div class="meta">%s</div>%s<div class="warn">%s</div></body></html>' % (title, CSS, title.split("|")[0].strip(), badge, rh, sh, warn)

# 1. UCLA MFE
rows1 = [
 ("English name", "Master of Financial Engineering (M.F.E., Anderson School of Management)"),
 ("Duration", "16 months full-time in-person (August start, next December graduation; 4 quarters + summer internship)"),
 ("STEM", "Yes (STEM-designated, F-1 OPT extended 24 months, total 36 months)"),
 ("Deadline", "Round 1: 2026-11-30; Round 2: 2027-01-31; Round 3 TBD"),
 ("Language", "TOEFL iBT / IELTS Academic (UCLA Graduate Division standard)"),
 ("Test", "GMAT/GRE required (admitted range, not minimum threshold)"),
 ("Tuition", "Class of 2026-27 total tuition $100,719 (4 quarters x $25,179.75); plus health insurance $10,022.64 and student fees $1,989.21"),
 ("Website", '<a href="https://www.anderson.ucla.edu/degree-programs/master-of-financial-engineering" target="_blank">Anderson MFE official page</a>'),
]
sec1 = [
 ("Degree and structure", [
  "UCLA Anderson MFE is a 16-month STEM-designated full-time in-person program, August intake, next December graduation.",
  "72 units total: core 32 units (8 courses) + electives 24 units + Applied Finance Project 4 units + Career Development 8 units + Field Experience/internship 4 units.",
  "Cohort-based, no acceleration; one intake per year.",
  "4:1 student-faculty ratio; Class of 2025 employment rate 91%, average total compensation $155,484.",
 ]),
 ("Core curriculum", [
  "Core 8 courses: MGMTMFE 400-403, 407-409, 413 (derivatives, stochastic processes, risk modeling, Python/R, machine learning)",
  "Applied Finance Project (MGMTMFE 410): team project with real financial institutions",
  "Field Experience (MGMTMFE 411): summer internship, S/U grading",
  "Career Development Series (MGMTMFE 415A-D): 8 units",
  "Electives 24 units: finance, quant, data science tracks",
 ]),
 ("Application requirements", [
  "Online application (UCLA Graduate Division)",
  "Bachelor's degree, strong quantitative background (math/engineering/physics/CS/econ)",
  "Resume / Essays / transcripts",
  "3 letters of recommendation",
  "GMAT/GRE",
  "TOEFL/IELTS (international students)",
 ]),
 ("Prerequisites", [
  "For 0-3 years work experience quantitative fresh/junior graduates",
  "Required: calculus, linear algebra, probability, statistics, Python/C++ programming",
 ]),
 ("Cost and funding", [
  "Tuition $100,719 (2026-27 intake)",
  "Non-refundable $2,000 enrollment deposit after admission",
  "Scholarships/TA opportunities TBD",
 ]),
 ("Notes", [
  "Excluded: UCLA MBA / FEMBA / EMBA not in this database",
  "F-1 STEM eligible for 36 months OPT",
  "Admitted range, not minimum threshold",
 ]),
]
w1 = "Semi-verified page: degree/duration/STEM/tuition/rounds/core structure verified from Anderson official site and UCLA Graduate Programs bulletin; section-level sub-scores, scholarships, class size TBD. Admitted range, not minimum threshold."
open(os.path.join(DET, "ucla-mfe.html"), "w", encoding="utf-8").write(page("UCLA | Master of Financial Engineering (MFE, 16 months, STEM, Anderson)", "MFE", rows1, sec1, w1))

# 2. UCLA Biostatistics MS
rows2 = [
 ("English name", "Master of Science in Biostatistics (Fielding School of Public Health)"),
 ("Duration", "2 years full-time in-person (6 academic quarters; waiver exam may shorten to 1 year)"),
 ("STEM", "TBD (Biostatistics typically STEM-designated)"),
 ("Deadline", "2026-12-01 (Fall intake, SOPHAS application)"),
 ("Language", "TOEFL iBT / IELTS Academic (UCLA Graduate Division standard)"),
 ("Test", "GRE Optional (2027 cycle policy TBD)"),
 ("Tuition", "TBD (UCLA Graduate Division rate; FSPH program-level rate TBD)"),
 ("Website", '<a href="https://ph.ucla.edu/degree-programs/master-science/ms-biostatistics" target="_blank">Fielding Biostatistics MS</a>'),
]
sec2 = [
 ("Degree and structure", [
  "UCLA Fielding Biostatistics MS is a 2-year academic research-oriented program for students pursuing PhD or biostatistics research careers.",
  "70 units (about 18 graduate/upper-division courses), at least 5 graduate-level (200/500 series) courses.",
  "Waiver exam may exempt first-year courses; 1-year completion possible (no fractional quarters).",
  "Capstone: written Master's Report + comprehensive exam at start of year 2.",
 ]),
 ("Core curriculum", [
  "Biostatistics 200A/B/C: Methods in Biostatistics",
  "Biostatistics 202A/B: Theoretical Principles of Biostatistics",
  "Biostatistics 216: Mathematical Methods for Biostatistics",
  "Biostatistics 244: Master's Seminar",
  "Biostatistics 402A/B: Biostatistical Consulting",
  "Biostatistics 596: Directed Individual Study / Master's Report (4 units)",
  "Epidemiology 100 or 200A (4 units)",
  "PH C201 or HPM M242 (public health breadth, 4 units)",
  "Electives 24 units: Biostatistics 202C/203A/203B/212-215/230-241/406/410/411/413",
 ]),
 ("Application requirements", [
  "SOPHAS application + UCLA Graduate Division supplementary application",
  "Bachelor's degree (math/physical/biological/social science backgrounds welcome)",
  "Resume / SOP / 3 letters of recommendation",
  "GRE Optional",
  "TOEFL/IELTS (international students)",
 ]),
 ("Prerequisites", [
  "Required: 2 years college math (calculus 31A/B, 32A/B, 33A/B) + linear algebra (Math 115A)",
  "Recommended: programming experience + statistics/biostatistics software experience",
  "PhD track recommended: additional Real Analysis (Math 131A/B)",
 ]),
 ("Cost and funding", [
  "Tuition TBD",
  "PhD track students typically funded; MS self-funded, limited scholarships",
 ]),
 ("Notes", [
  "Excluded: MPH in Biostatistics is a professional degree, distinct from this academic MS",
  "Excluded: UCLA MASDS / Data Science in Biomedicine confirmed online/part-time -> excluded",
  "F-1 students should confirm STEM designation for OPT extension",
 ]),
]
w2 = "Semi-verified page: degree/duration/curriculum structure/prerequisites verified from Fielding official site and Graduate Programs bulletin; tuition, GRE policy, STEM designation status TBD. Admitted range, not minimum threshold."
open(os.path.join(DET, "ucla-biostat-ms.html"), "w", encoding="utf-8").write(page("UCLA | MS in Biostatistics (2 years, academic research, Fielding)", "Biostat", rows2, sec2, w2))

# 3. UCLA HPM MS
rows3 = [
 ("English name", "Master of Science in Health Policy and Management (Fielding School of Public Health)"),
 ("Duration", "2 years full-time in-person (6 quarters; accelerated 1-year option for prior doctoral degree)"),
 ("STEM", "TBD"),
 ("Deadline", "2026-12-01 (Fall intake, SOPHAS application)"),
 ("Language", "TOEFL iBT / IELTS Academic (UCLA Graduate Division standard)"),
 ("Test", "GRE Optional"),
 ("Tuition", "TBD (UCLA Graduate Division rate)"),
 ("Website", '<a href="https://ph.ucla.edu/degree-programs/master-science/ms-health-policy-and-management" target="_blank">Fielding HPM MS</a>'),
]
sec3 = [
 ("Degree and structure", [
  "UCLA Fielding HPM MS is a 2-year academic research-oriented program for students pursuing PhD or health economics/health policy/medical quality research careers.",
  "Distinct from MPH in Health Management (professional, 2 years): this MS emphasizes research methods and PhD preparation.",
  "Accelerated 1-year option for students with prior MD/PhD/JD/DDS or equivalent doctoral degree.",
  "Capstone: Major Research (research report/thesis).",
 ]),
 ("Core curriculum", [
  "HLT POL 200A: Health Systems Organization and Financing I",
  "Biostatistics 211A/B: Applied Regression",
  "Epidemiology 100: Introduction to Epidemiology",
  "HLT POL 225A/B: Health Services Research Design",
  "HLT POL 237C: Health Services Research Methodology",
  "HLT POL 423: Practices of Evaluation in Health Services",
  "Electives 8 courses (32 units): health economics, technology assessment, cost-effectiveness, demography, political economy",
 ]),
 ("Application requirements", [
  "SOPHAS application + UCLA Graduate Division supplementary application",
  "Bachelor's degree from 4-year accredited university",
  "Resume / SOP / 3 letters of recommendation (2 academic + 1 professional, or 3 professional)",
  "GRE Optional",
  "TOEFL/IELTS (international students)",
  "Recommended: published writing sample (research paper/thesis)",
 ]),
 ("Prerequisites", [
  "No hard prerequisite courses",
  "Community health/health education work experience valued in review (not required)",
  "Research-oriented, recommended quantitative methods background (stats/econ/policy)",
 ]),
 ("Cost and funding", [
  "Tuition TBD",
  "PhD track funding opportunities TBD",
 ]),
 ("Notes", [
  "Excluded: MPH in Health Management is a professional degree, distinct from this academic MS",
  "Excluded: MHA (Healthcare Administration) is predominately online + requires 3 years work experience -> excluded",
  "Excluded: MPH/MBA dual degree, MD/MPH dual degree not in this database",
 ]),
]
w3 = "Semi-verified page: degree/duration/curriculum structure/application requirements verified from Fielding official site and Graduate Division; tuition, STEM designation status TBD. Admitted range, not minimum threshold."
open(os.path.join(DET, "ucla-hpm-ms.html"), "w", encoding="utf-8").write(page("UCLA | MS in Health Policy and Management (2 years, academic research, Fielding)", "HPM", rows3, sec3, w3))

# 4. NYU Stern MSQE
rows4 = [
 ("English name", "Master of Science in Quantitative Economics (NYU Stern x Graduate School of Arts and Science)"),
 ("Duration", "10 months full-time in-person (mid-July start, mid-May graduation; 6 intensive 6-week modules)"),
 ("STEM", "Yes (STEM-certified, F-1 OPT extended 24 months)"),
 ("Deadline", "TBD (Stern graduate multi-round)"),
 ("Language", "TOEFL iBT / IELTS Academic (NYU GSAS standard)"),
 ("Test", "GRE required (Math-heavy program; admitted range, not minimum threshold)"),
 ("Tuition", "33 credits x ~$1,999/credit (2021 rate, TBD) + student fees ~$528 minimum + ~$70/credit"),
 ("Website", '<a href="https://www.stern.nyu.edu/programs-admissions/masters-programs/ms-quantitative-economics" target="_blank">NYU Stern MSQE</a>'),
]
sec4 = [
 ("Degree and structure", [
  "NYU Stern x GSAS joint MSQE is a 10-month accelerated research-oriented program, mid-July intake, mid-May graduation.",
  "33 credits, 6 intensive 6-week modules (Module 4 is 3-week J-term).",
  "For PhD preparation + tech/finance research careers; 20+ full-time faculty teach.",
  "No part-time; one July intake per year.",
 ]),
 ("Core curriculum", [
  "Module 1 (Jul-Aug): Data and Computation I (Python/numpy/pandas)",
  "Module 2 (Sep-Oct): Microeconomics I",
  "Module 3 (Oct-Dec): Macroeconomics II",
  "Module 4 (Jan J-term): Game Theory II + Data and Computation II",
  "Module 5 (Jan-Mar): Macroeconomics III",
  "Module 6 (Mar-May): electives + Capstone Research Practicum",
  "Required sequences: Microeconomics I-IV, Macroeconomics I-IV, Econometrics I-III, Game Theory I-II, Data and Computation I-II",
  "Electives 4 of 6: Industrial Organization I/II, Computational Dynamics, International Economics, Econometrics III, Financial Economics",
 ]),
 ("Application requirements", [
  "Online application (NYU GSAS)",
  "Bachelor's degree, strong math background",
  "Academic transcripts / SOP / resume / 3 letters of recommendation",
  "GRE required",
  "TOEFL/IELTS (international students)",
 ]),
 ("Prerequisites", [
  "Math-heavy program, requires substantial math preparation",
  "Recommended: calculus, linear algebra, probability, statistics, intermediate micro/macro economics",
  "For research-oriented students, not general employment-oriented",
 ]),
 ("Cost and funding", [
  "Tuition TBD (2021 rate ~$1,999/credit x 33 = ~$65,967, adjusted annually)",
  "Scholarships/RA opportunities TBD",
 ]),
 ("Notes", [
  "Excluded: MA in Economics (GSAS traditional 2-year program) is a different program, do not confuse",
  "Excluded: NYU Stern MSQF (Shanghai dual degree, not STEM, no OPT eligibility) -> excluded",
  "F-1 STEM eligible for 36 months OPT",
  "Admitted range, not minimum threshold",
 ]),
]
w4 = "Semi-verified page: degree/duration/curriculum structure/STEM status verified from NYU Stern and GSAS official sites; 2026-27 exact tuition, application deadlines TBD. Admitted range, not minimum threshold."
open(os.path.join(DET, "nyu-msqe.html"), "w", encoding="utf-8").write(page("NYU | MS in Quantitative Economics (10 months, STEM, Stern x GSAS)", "MSQE", rows4, sec4, w4))

# 5. UCLA MSBA upgrade
rows5 = [
 ("English name", "Master of Science in Business Analytics (UCLA Anderson School of Management)"),
 ("Duration", "15 months full-time in-person (Fall start: Sep 2026 to Dec 2027; 4 quarters + summer internship)"),
 ("STEM", "Yes (STEM-certified, F-1 OPT extended 24 months)"),
 ("Deadline", "TBD (Anderson MSBA multi-round; check official site)"),
 ("Language", "TOEFL iBT 100+ / IELTS 7.0 (Anderson standard)"),
 ("Test", "GMAT/GRE accepted (admitted range, not minimum threshold)"),
 ("Tuition", "Class of 2027 total tuition $81,600 (4 quarters x $20,375 + Summer $100); plus health insurance/student fees/living expenses"),
 ("Website", '<a href="https://www.anderson.ucla.edu/degree-programs/master-of-science-in-business-analytics" target="_blank">Anderson MSBA</a>'),
]
sec5 = [
 ("Degree and structure", [
  "UCLA Anderson MSBA is a 15-month STEM-designated full-time in-person program, Fall intake (September), next December graduation.",
  "52 units total: core 38 units (Fall/Winter/Spring on-campus) + Summer Internship 4 units (MGMTMSA 411) + Applied Analytics Project 4 units + Industry Applications electives 6 units.",
  "QS 2026 Global Business Analytics Masters #2 (US #2); QS 2026 World Ranking #1.",
  "Cohort-based, no acceleration; one intake per year. 3:1 student-faculty ratio.",
 ]),
 ("Core curriculum", [
  "Fall 1: Statistical Foundations for Analytics (R), Python Workshop, Optimization (Python), SQL and Basic Data Management, Machine Learning for Decision Making (Python)",
  "Winter: Business Fundamentals for Analytics, Data Management, Prescriptive Models, Industry Seminar I",
  "Spring: Customer Analytics, Competitive Analytics, Operations Analytics, Industry Seminar II",
  "Summer (Jun-Sep): 8-10 week Applied Analytics Internship (real corporate project)",
  "Fall 2: Capstone Analytics Project + 6 units Industry Electives (Internet/Entertainment/Healthcare/Fraud Analytics, Time Series, Advanced ML, Visualization)",
 ]),
 ("Application requirements", [
  "Online application (Anderson / UCLA Graduate Division)",
  "Bachelor's degree (any major, quantitative background required)",
  "Resume / Essays / transcripts",
  "Letters of recommendation",
  "GMAT/GRE accepted",
  "TOEFL iBT 100+ / IELTS 7.0",
 ]),
 ("Prerequisites", [
  "For 0-3 years work experience fresh/junior graduates",
  "Quantitative background required: statistics, calculus, programming (Python/R/SQL any)",
  "Class of 2023 average starting salary $110,332 + average signing bonus $13,304 (26% report signing bonus)",
 ]),
 ("Cost and funding", [
  "Tuition $81,600 (2026-27 intake Class of 2027)",
  "Estimated Cost of Attendance 2026-27: ~$108,438 (program charges $61,125 + health insurance $7,515 + student fees $1,989 + food/housing $28,767 + books $2,004 + transportation $3,819 + personal $3,219)",
  "ROI: estimated payback 4.3 years; 20-year additional earnings ~$1.04M (ROI 368%)",
 ]),
 ("Notes", [
  "Excluded: UCLA MBA / FEMBA / EMBA not in this database",
  "Excluded: UCLA MASDS / Applied Statistics DS confirmed online/part-time -> excluded",
  "F-1 STEM eligible for 36 months OPT",
  "Admitted range, not minimum threshold",
 ]),
]
w5 = "Upgraded verified page: degree/duration/STEM/tuition/curriculum structure/employment data verified from Anderson official site and UCLA Graduate Programs bulletin; application round dates, exact sub-scores, scholarship details TBD. Admitted range, not minimum threshold."
open(os.path.join(DET, "ucla-ba-ms.html"), "w", encoding="utf-8").write(page("UCLA | MS in Business Analytics (15 months, STEM, Anderson, QS #2 US)", "MSBA", rows5, sec5, w5))

print("OK: 5 det files written")
for fn in ["ucla-mfe.html","ucla-biostat-ms.html","ucla-hpm-ms.html","nyu-msqe.html","ucla-ba-ms.html"]:
    p = os.path.join(DET, fn)
    print("  %s: %d bytes" % (fn, os.path.getsize(p)))
