1.3 KiB
1.3 KiB
前序报告汇总Skill 设计
1. Skill 定位
前序报告汇总Skill 负责读取当前批次已经生成的完整性、字段抽取和一致性核查报告,并统一转为风险评估上下文。
英文实现标识建议使用 SourceReportCollectSkill。
2. 输入
@dataclass
class SourceReportCollectInput:
batch_id: int
include_reports: list[str]
3. 输出
@dataclass
class SourceReportCollectOutput:
reports: dict[str, dict]
missing_reports: list[str]
stale_reports: list[str]
validation_warnings: list[dict]
4. 核心方法
4.1 run(input) -> SourceReportCollectOutput
主入口方法。
4.2 load_report(batch_id, report_type) -> dict | None
读取报告快照。
4.3 validate_report_freshness(report) -> bool
校验报告是否过期。
4.4 build_report_bundle(reports) -> SourceReportBundle
构建报告集合。
5. 技术实现
使用技术:
- Django ORM
- JSONField
- 报告版本号
6. 异常处理
- 报告不存在:加入
missing_reports。 - 报告 schema 不完整:加入警告。
- 报告过期:加入
stale_reports。
7. 测试要点
- 能读取多个报告。
- 缺失报告能识别。
- 过期报告能识别。
- 输出 bundle 稳定。