docs(详细设计): 新增风险预警设计
This commit is contained in:
67
docs/详细设计/skill/前序报告汇总Skill.md
Normal file
67
docs/详细设计/skill/前序报告汇总Skill.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# 前序报告汇总Skill 设计
|
||||
|
||||
## 1. Skill 定位
|
||||
|
||||
`前序报告汇总Skill` 负责读取当前批次已经生成的完整性、字段抽取和一致性核查报告,并统一转为风险评估上下文。
|
||||
|
||||
英文实现标识建议使用 `SourceReportCollectSkill`。
|
||||
|
||||
## 2. 输入
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class SourceReportCollectInput:
|
||||
batch_id: int
|
||||
include_reports: list[str]
|
||||
```
|
||||
|
||||
## 3. 输出
|
||||
|
||||
```python
|
||||
@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. 技术实现
|
||||
|
||||
使用技术:
|
||||
|
||||
1. Django ORM
|
||||
2. JSONField
|
||||
3. 报告版本号
|
||||
|
||||
## 6. 异常处理
|
||||
|
||||
1. 报告不存在:加入 `missing_reports`。
|
||||
2. 报告 schema 不完整:加入警告。
|
||||
3. 报告过期:加入 `stale_reports`。
|
||||
|
||||
## 7. 测试要点
|
||||
|
||||
1. 能读取多个报告。
|
||||
2. 缺失报告能识别。
|
||||
3. 过期报告能识别。
|
||||
4. 输出 bundle 稳定。
|
||||
|
||||
Reference in New Issue
Block a user