Files
operating-room-monitor-server/app/domain/consumption.py
Kevin 3d7bd70355 feat: 手术视频消耗、待确认与持久化改造
- 新增 Alembic 初始迁移、领域明细模型及归档持久化与重试链路\n- 拆分视频会话注册表、分类处理、推理时间窗聚合与流处理\n- 消耗日志:TSV/Markdown 含 top2/top3;item_id 优先产品编码;待确认记「待确认」行,语音确认后落正式行并更新汇总\n- 待确认时内存/DB 明细为占位行,确认后替换;拒绝时移除占位\n- 分类 probs 先 detach/cpu 再转 NumPy,修复 MPS/CUDA 上推理被静默跳过\n- 补充集成测试、归档与设备张量等单测

Made-with: Cursor
2026-04-23 20:42:21 +08:00

27 lines
890 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""手术消耗明细的领域对象(服务端内部流转 / 持久化使用)。"""
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