feat: 消费停录汇总与查结果同口径,并更新分类与 TSV
- 停录时由 details 经 build_consumption_summary 写 TSV/终端汇总,移除 consumption_log_totals 与时间窗累加 - 更新 consumable_classifier 权重、YAML 标签与 consumable_vision_algorithm - 扩展 consumption TSV 相关测试与配置注释 Made-with: Cursor
This commit is contained in:
@@ -29,6 +29,7 @@ from app.services.video.session_registry import (
|
||||
)
|
||||
from app.services.video.stream_worker import CameraStreamWorker, redact_rtsp_url
|
||||
from app.services.video.types import VideoBackendKind
|
||||
from app.schemas import SurgeryConsumptionDetail, build_consumption_summary
|
||||
from app.services.consumption_tsv_log import (
|
||||
append_consumption_log_summary,
|
||||
init_consumption_log_file,
|
||||
@@ -214,11 +215,21 @@ class CameraSessionManager:
|
||||
if isinstance(res, BaseException):
|
||||
logger.warning("surgery task finished with error: {}", res)
|
||||
|
||||
totals = dict(run.state.consumption_log_totals)
|
||||
details = list(run.state.details)
|
||||
detail_rows = [
|
||||
SurgeryConsumptionDetail(
|
||||
item_id=r.item_id,
|
||||
item_name=r.item_name,
|
||||
qty=r.qty,
|
||||
doctor_id=r.doctor_id,
|
||||
timestamp=r.timestamp,
|
||||
)
|
||||
for r in details
|
||||
]
|
||||
summ = build_consumption_summary(detail_rows)
|
||||
totals = {s.item_id: (s.item_name, s.total_quantity) for s in summ}
|
||||
append_consumption_log_summary(surgery_id, totals)
|
||||
print_consumption_summary_markdown(totals)
|
||||
|
||||
details = list(run.state.details)
|
||||
await self._archive.persist_or_archive(surgery_id, details)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user