# -*- coding: utf-8 -*- """数据准备清单文档(docs/数据准备清单.md)一致性检查。 检查项: 1. 必备章节齐全(数据项总览 / 时间表 / 回执单模板 / 回执跟踪机制); 2. 引用的数据项模板文件(#16/#17/#19 交付物)真实存在; 3. 关键时间表节点(提前 2 周 / 首轮催办 / 二次催办)存在。 用法:python _check_data_prep_doc.py """ import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) DOC_PATH = os.path.join(HERE, "数据准备清单.md") REQUIRED_SECTIONS = [ "## 2. 数据准备项总览", "## 4. 时间表与里程碑", "## 5. 回执单模板", "## 6. 回执跟踪机制", ] # 引用的模板文档(#16/#17/#19 交付物)需真实存在 REFERENCED_DOCS = [ "DCS点表需求模板.md", "LIMS质检接口字段清单.md", "网络拓扑与隔离策略.md", ] KEY_PHRASES = ["提前 2 周", "首轮催办", "二次催办", "缺省通用点位集"] def main() -> int: failures = [] text = open(DOC_PATH, "r", encoding="utf-8").read() for sec in REQUIRED_SECTIONS: if sec not in text: failures.append(f"缺少必备章节:{sec}") for ref in REFERENCED_DOCS: if not os.path.isfile(os.path.join(HERE, ref)): failures.append(f"引用模板文档缺失:{ref}") for phrase in KEY_PHRASES: if phrase not in text: failures.append(f"缺少关键短语:{phrase}") if failures: print("FAIL") for f in failures: print(" -", f) return 1 print("OK: 章节/引用模板/时间表节点校验通过") return 0 if __name__ == "__main__": sys.exit(main())