feat: 完成 issue #17 [M1] 编制 LIMS/质检接口字段与推送频率清单
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""LIMS/质检接口字段清单(docs/LIMS质检接口字段清单.md)一致性检查。
|
||||
|
||||
检查项:
|
||||
1. 文档必备章节齐全(对接信息 / 批次主数据 / 质量指标字段 / 推送频率分级);
|
||||
2. qualityTag 命名约定与 PRD 5.3 工艺模板示例一致(LIMS.Ti_purity);
|
||||
3. pushFrequency 分级枚举完整(per_batch / per_shift / scheduled / realtime / manual)。
|
||||
|
||||
用法:python _check_lims_doc.py
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
DOC_PATH = os.path.join(HERE, "LIMS质检接口字段清单.md")
|
||||
|
||||
REQUIRED_SECTIONS = [
|
||||
"## 2. LIMS / 质检系统对接信息",
|
||||
"## 3. 批次与样品主数据字段",
|
||||
"## 4. 质量指标字段清单",
|
||||
"## 6. 推送频率分级",
|
||||
]
|
||||
|
||||
PUSH_FREQ = {"per_batch", "per_shift", "scheduled", "realtime", "manual"}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
failures = []
|
||||
text = open(DOC_PATH, "r", encoding="utf-8").read()
|
||||
|
||||
# 1) 必备章节
|
||||
for sec in REQUIRED_SECTIONS:
|
||||
if sec not in text:
|
||||
failures.append(f"缺少必备章节:{sec}")
|
||||
|
||||
# 2) qualityTag 命名约定与 PRD 5.3 一致
|
||||
if "LIMS.Ti_purity" not in text:
|
||||
failures.append("缺少 qualityTag 示例 LIMS.Ti_purity(PRD 5.3 对齐)")
|
||||
if "`LIMS.<指标标识>`" not in text:
|
||||
failures.append("缺少 qualityTag 命名约定 `LIMS.<指标标识>`")
|
||||
|
||||
# 3) pushFrequency 枚举完整(从文档表格行抽取枚举值)
|
||||
declared = set(re.findall(r"\b(per_batch|per_shift|scheduled|realtime|manual)\b", text))
|
||||
if declared != PUSH_FREQ:
|
||||
failures.append(f"pushFrequency 枚举不完整:{sorted(declared)} != {sorted(PUSH_FREQ)}")
|
||||
|
||||
if failures:
|
||||
print("FAIL")
|
||||
for f in failures:
|
||||
print(" -", f)
|
||||
return 1
|
||||
print("OK: 章节/qualityTag 命名/pushFrequency 枚举校验通过")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user