feat: consumption log top1 + elapsed since recording; RTSP play once

- Add top1_name/top1_conf to TSV and show top1–3 in pending markdown
- Add 相对开录 column and pass since_recording_start from surgery start
- Track surgery_started_wall and format_elapsed_mmss_since in session registry
- Remove ffmpeg stream_loop from synthetic/demo fake RTSP (play once)
- Fix fake_rtsp_from_file poll loop indentation; update README
- Extend consumption TSV tests; add face test PNGs under tests/faces

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-27 09:22:46 +08:00
parent 8a6bfe9100
commit e4c6127619
13 changed files with 130 additions and 40 deletions

View File

@@ -12,7 +12,7 @@
from __future__ import annotations
from loguru import logger
import time
from app.baked import pipeline as bp
from app.services.consumable_vision_algorithm import (
@@ -28,6 +28,7 @@ from app.services.video.inference_aggregator import WindowInferenceReady
from app.services.video.session_registry import (
SurgerySessionRegistry,
SurgerySessionState,
format_elapsed_mmss_since,
)
@@ -83,6 +84,10 @@ class VisionClassificationHandler:
camera_id=camera_id,
wall_start_epoch=ready.wall_lo,
wall_end_epoch=ready.wall_hi,
since_recording_start=format_elapsed_mmss_since(
state.surgery_started_wall,
at_epoch=ready.wall_hi,
),
)
async def handle(
@@ -182,11 +187,7 @@ class VisionClassificationHandler:
)
if cid is None:
return
logger.info(
"Enqueued pending consumable confirmation id={} top_key={}",
cid,
top_key,
)
at_ep = ready.wall_hi if ready is not None else time.time()
if ready is not None and surgery_id and camera_id and (
bp.CONSUMPTION_TSV_LOG_ENABLED
or bp.CONSUMPTION_LOG_MARKDOWN_TERMINAL
@@ -201,6 +202,10 @@ class VisionClassificationHandler:
wall_end_epoch=ready.wall_hi,
tsv_enabled=bp.CONSUMPTION_TSV_LOG_ENABLED,
markdown_terminal=bp.CONSUMPTION_LOG_MARKDOWN_TERMINAL,
since_recording_start=format_elapsed_mmss_since(
state.surgery_started_wall,
at_epoch=at_ep,
),
)
await self._registry.append_pending_consumption_detail(
state=state,