feat: 装配两个库(不含 CEUS 结果)

按任务书 01 实现 delivery、library、answers、runs(快照部分)、build 五个模块,
scripts/build.py、scripts/scan_library.py 与 config/build.yaml(decode_codes: false)。
交付包整表检查 T1–T4、映射表检查 T5、逐例检查 C01–C13,一例遇到第一项不过即整例跳过。

与任务书原文的出入:
- C04 报告表名随视频名配对(负责人 2026-10-16 定)。
- 按两轮独立审阅加严 C11(更多换行符、比例号冒号)、C12(同义词与词根)、
  C13(空格、周岁、中文数字、繁体);泄露扫描做 NFKC;关键图只接受能保真重编码的 PNG;
  YAML 配置拒绝重复键和空路径。
- import-linter 第 1 条拆成互不依赖与不引用其他 cadx 模块两条。

文档:结构.md 第五、六、八部分按实际更新;新增 guides/装配两个库.md;WORK_LOG 更新。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 03:00:20 -04:00
parent bcd5932a66
commit bceb01e8fa
30 changed files with 3600 additions and 18 deletions
+55 -2
View File
@@ -3,7 +3,12 @@ name = "cadx"
version = "0.0.0"
description = "胰腺囊性肿瘤多模态会诊诊断的研究代码"
requires-python = ">=3.12"
dependencies = []
dependencies = [
"openpyxl>=3.1.5",
"pillow>=12.3.0",
"pydantic>=2.14.1",
"pyyaml>=6.0.3",
]
[dependency-groups]
dev = [
@@ -12,6 +17,8 @@ dev = [
"pytest>=8.3",
"import-linter>=2.1",
"pre-commit>=4.0",
"types-pyyaml>=6.0.12.20260906",
"types-openpyxl>=3.1.5.20260827",
]
[build-system]
@@ -41,9 +48,12 @@ pythonVersion = "3.12"
typeCheckingMode = "strict"
venvPath = "."
venv = ".venv"
extraPaths = ["tests"]
[tool.pytest.ini_options]
testpaths = ["tests"]
# 测试辅助(假交付包生成器)放在 tests/ 下,按普通模块导入。
pythonpath = ["tests"]
addopts = "--strict-markers --import-mode=importlib"
markers = [
"live: 真实模型调用,花钱,需要 .env 里的密钥",
@@ -51,7 +61,7 @@ markers = [
]
# 导入边界。改契约先改 research-wiki/explanation/结构.md,再改这里;
# 不靠 ignore_imports 让违规通过。规划中的契约见结构.md 第四节,模块落地时随任务书加入。
# 不靠 ignore_imports 让违规通过。规划中的契约见结构.md 第五部分,模块落地时随任务书加入。
[tool.importlinter]
root_packages = ["cadx"]
include_external_packages = true
@@ -62,3 +72,46 @@ name = "torch 与 sam2 不进 cadx"
type = "forbidden"
source_modules = ["cadx"]
forbidden_modules = ["torch", "sam2"]
[[tool.importlinter.contracts]]
# 结构.md 第三部分依赖表:外部层与格式层的模块不依赖其他 cadx 模块。
name = "delivery、library、answers、runs 互不依赖"
type = "independence"
modules = ["cadx.delivery", "cadx.library", "cadx.answers", "cadx.runs"]
[[tool.importlinter.contracts]]
# 同上,依赖表的另一半:它们也不引用上层和其余规划中的模块(独立契约只管它们之间)。
name = "delivery、library、answers、runs 不引用其他 cadx 模块"
type = "forbidden"
source_modules = ["cadx.delivery", "cadx.library", "cadx.answers", "cadx.runs"]
forbidden_modules = [
"cadx.build", "cadx.ceus", "cadx.segment", "cadx.llm", "cadx.ledger",
"cadx.consult", "cadx.evaluate", "cadx.verdicts",
]
[[tool.importlinter.contracts]]
# 结构.md 第三部分依赖表:build 只依赖 delivery、library、answers、runs(ceus 落地时加入)。
name = "build 只引用 delivery、library、answers、runs"
type = "forbidden"
source_modules = ["cadx.build"]
forbidden_modules = [
"cadx.ceus", "cadx.segment", "cadx.llm", "cadx.ledger",
"cadx.consult", "cadx.evaluate", "cadx.verdicts",
]
allow_indirect_imports = true
[[tool.importlinter.contracts]]
# 结构.md 第五部分:交付包的 Excel 只有 delivery 碰。
name = "只有 delivery 引用 openpyxl"
type = "forbidden"
source_modules = ["cadx.library", "cadx.answers", "cadx.runs", "cadx.build"]
forbidden_modules = ["openpyxl"]
allow_indirect_imports = true
[[tool.importlinter.contracts]]
# 结构.md 第五部分:写资料库的图片(去掉元数据)只有 library 碰。
name = "只有 library 引用 PIL"
type = "forbidden"
source_modules = ["cadx.delivery", "cadx.answers", "cadx.runs", "cadx.build"]
forbidden_modules = ["PIL"]
allow_indirect_imports = true