feat: 手术视频消耗、待确认与持久化改造
- 新增 Alembic 初始迁移、领域明细模型及归档持久化与重试链路\n- 拆分视频会话注册表、分类处理、推理时间窗聚合与流处理\n- 消耗日志:TSV/Markdown 含 top2/top3;item_id 优先产品编码;待确认记「待确认」行,语音确认后落正式行并更新汇总\n- 待确认时内存/DB 明细为占位行,确认后替换;拒绝时移除占位\n- 分类 probs 先 detach/cpu 再转 NumPy,修复 MPS/CUDA 上推理被静默跳过\n- 补充集成测试、归档与设备张量等单测 Made-with: Cursor
This commit is contained in:
1
app/domain/__init__.py
Normal file
1
app/domain/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""领域对象:与 HTTP / 持久化层无关的业务数据结构。"""
|
||||
26
app/domain/consumption.py
Normal file
26
app/domain/consumption.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""手术消耗明细的领域对象(服务端内部流转 / 持久化使用)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class SurgeryConsumptionStored:
|
||||
"""内存 / 数据库持久化用的明细行(含 source,仅服务端内部使用,不随 HTTP 返回)。
|
||||
|
||||
HTTP 层面的表示为 ``app.schemas.SurgeryConsumptionDetail``;
|
||||
转换由上层(pipeline)在返回给客户端前完成,以隔离领域与 API。
|
||||
|
||||
``pending_confirmation_id``:非空表示该行仍为医生待确认占位(``item_name`` 一般为「待确认」);
|
||||
确认后由注册表替换为最终耗材行并清空此字段。
|
||||
"""
|
||||
|
||||
item_id: str
|
||||
item_name: str
|
||||
qty: int
|
||||
doctor_id: str
|
||||
timestamp: datetime
|
||||
source: str = "vision"
|
||||
pending_confirmation_id: str | None = None
|
||||
Reference in New Issue
Block a user