| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- # -*- coding: utf-8 -*-
- """浠艾福程序升级方案 v1.0:Markdown -> 自包含 HTML(复用已验证 CSS + 链路 SVG)。"""
- import re, pathlib, markdown
- DOC = pathlib.Path(r"E:/cfc/docs")
- MD = DOC / "浠艾福程序-谷禾新版解析与五维归因升级方案-v1.0.md"
- OUT = DOC / "浠艾福程序-谷禾新版解析与五维归因升级方案-v1.0.html"
- PREV = pathlib.Path(r"E:/cfc/docs/参考资料/591336962-毛静明-五维本质归因报告-v1.0.html")
- CSS = re.search(r"<style>(.*?)</style>", PREV.read_text(encoding="utf-8"), re.S).group(1)
- CSS += """
- @media print {
- pre { white-space: pre-wrap !important; word-break: break-word; overflow: visible !important; }
- pre code { white-space: pre-wrap !important; word-break: break-word; }
- }
- """
- # 升级链路示意(现状双链路 → guhe_v2 走 Python 主路径)
- FLOW = """
- <svg viewBox="0 0 680 268" width="100%" role="img" aria-label="浠艾福解析链路升级前后对比"
- style="display:block;margin:14px 0 22px;font-family:'Noto Sans SC','Microsoft YaHei',sans-serif">
- <rect x="0" y="0" width="680" height="268" fill="#FAF8FD" rx="10"/>
- <text x="18" y="26" font-size="13" font-weight="700" fill="#5B3A8E">升级前:双链路,均无谷禾新版能力</text>
- <g font-size="10.5" fill="#2C2438">
- <rect x="18" y="40" width="150" height="46" rx="6" fill="#FFFFFF" stroke="#C9B8E4"/>
- <text x="28" y="58" font-weight="700" fill="#5B3A8E">上传 PDF</text>
- <text x="28" y="76">/api/health/report/upload</text>
- <rect x="196" y="40" width="200" height="46" rx="6" fill="#FEECEC" stroke="#DC8A8A"/>
- <text x="206" y="58" font-weight="700" fill="#9B2C2C">① Java 一步式解析</text>
- <text x="206" y="76">PdfParseService · 白名单/triplet</text>
- <rect x="424" y="40" width="238" height="46" rx="6" fill="#FEECEC" stroke="#DC8A8A"/>
- <text x="434" y="58" font-weight="700" fill="#9B2C2C">② langgraph 异步兜底</text>
- <text x="434" y="76">v5 移植 + LLM · 无物种功能库字段</text>
- </g>
- <g font-size="10.5">
- <path d="M168 63 L196 63" stroke="#9B2C2C" stroke-width="1.5" fill="none"/>
- <path d="M168 70 Q182 92 196 70" stroke="#9B2C2C" stroke-width="1.5" fill="none"/>
- </g>
- <text x="18" y="120" font-size="13" font-weight="700" fill="#5B3A8E">升级后:识别分流,guhe_v2 走 Python 主路径</text>
- <g font-size="10.5" fill="#2C2438">
- <rect x="18" y="134" width="120" height="46" rx="6" fill="#FFFFFF" stroke="#C9B8E4"/>
- <text x="28" y="152" font-weight="700" fill="#5B3A8E">上传 PDF</text>
- <text x="28" y="170">上传接口不变</text>
- <rect x="158" y="134" width="140" height="46" rx="6" fill="#FEF3E2" stroke="#B45309"/>
- <text x="168" y="152" font-weight="700" fill="#8A3F08">Java 指纹识别</text>
- <text x="168" y="170">detectGuheV2()</text>
- <rect x="318" y="134" width="164" height="46" rx="6" fill="#E9F5F1" stroke="#2F8F7A"/>
- <text x="328" y="152" font-weight="700" fill="#1F6B58">guhe_v2 → Python 主路径</text>
- <text x="328" y="170">复用 bun-report-parser v1.3.1</text>
- <rect x="502" y="134" width="160" height="46" rx="6" fill="#FFFFFF" stroke="#C9B8E4"/>
- <text x="512" y="152" font-weight="700" fill="#5B3A8E">完整 payload 落库</text>
- <text x="512" y="170">35 键 + _解析自检</text>
- </g>
- <g font-size="10.5">
- <path d="M138 157 L158 157" stroke="#B45309" stroke-width="1.5" fill="none"/>
- <path d="M298 157 L318 157" stroke="#2F8F7A" stroke-width="1.5" fill="none"/>
- <path d="M482 157 L502 157" stroke="#2F8F7A" stroke-width="1.5" fill="none"/>
- </g>
- <g font-size="10.5" fill="#2C2438">
- <rect x="18" y="202" width="196" height="46" rx="6" fill="#E9F5F1" stroke="#2F8F7A"/>
- <text x="28" y="220" font-weight="700" fill="#1F6B58">异常菌清单接口</text>
- <text x="28" y="238">/abnormal-species · 12 条 ▲ 直出</text>
- <rect x="234" y="202" width="188" height="46" rx="6" fill="#E9F5F1" stroke="#2F8F7A"/>
- <text x="244" y="220" font-weight="700" fill="#1F6B58">归一化真数据填充</text>
- <text x="244" y="238">17 份样本回归 → 百分位带</text>
- <rect x="442" y="202" width="220" height="46" rx="6" fill="#E9F5F1" stroke="#2F8F7A"/>
- <text x="452" y="220" font-weight="700" fill="#1F6B58">五维归因 + 健康计划</text>
- <text x="452" y="238">§8.1 归因禁区 / §5.8 介导链路审计</text>
- </g>
- <g font-size="10.5">
- <path d="M582 180 L582 192 L116 192 L116 202" stroke="#2F8F7A" stroke-width="1.5" fill="none"/>
- <path d="M328 192 L328 202" stroke="#2F8F7A" stroke-width="1.5" fill="none"/>
- <path d="M552 192 L552 202" stroke="#2F8F7A" stroke-width="1.5" fill="none"/>
- </g>
- <text x="18" y="264" font-size="10" fill="#6B7280">架构决策:Python 主导复用上游模块(约 2 人日) vs Java 重写解析(约 8–10 人日);归因禁区与介导链路纪律随 socratic-coach v1.8.0 一并落地</text>
- </svg>
- """
- html_body = markdown.markdown(
- MD.read_text(encoding="utf-8"),
- extensions=["tables", "fenced_code", "sane_lists", "toc", "attr_list"],
- output_format="html5",
- )
- html_body = html_body.replace("<p><strong>版本", FLOW + "<p><strong>版本", 1)
- html = f"""<!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>浠艾福程序 · 谷禾新版解析与五维归因升级方案 v1.0</title>
- <meta name="description" content="把 bun-report-parser v1.3.1 与 socratic-coach v1.8.0 能力接入浠艾福线上上传-解析-五维归因-健康计划主链路:Java 指纹识别分流 + Python 主导解析 + 异常菌清单接口 + 归一化真数据填充 + 归因禁区落地。">
- <meta name="keywords" content="浠艾福,菌群报告解析,谷禾新版,guhe_v2,五维归因,本质归因,物种功能库,归因禁区,健康计划,升级方案">
- <style>{CSS}</style>
- </head>
- <body>
- <main class="page">
- {html_body}
- </main>
- </body>
- </html>
- """
- OUT.write_text(html, encoding="utf-8")
- print("written", OUT, len(html))
- print("tables:", html.count("<table>"), "| h2:", html.count("<h2"), "| pre:", html.count("<pre"), "| svg:", html.count("<svg"))
|