fix(v1): wire model confidence, explicit source mode, unique event ids
A: PoseAdapter.set_confidence_threshold is applied on start, so the
settings model-confidence field actually affects inference.
B: config source.mode ('stream'|'replay') is explicit; app no longer
guesses the source type from the URL prefix.
C: FallStateMachine takes a session_id and from_config generates a
unique one per run, so event ids never collide across restarts
(no screenshot overwrite or duplicate JSONL identity in a day).
51 tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+24
-3
@@ -1,7 +1,9 @@
|
||||
"""Compose Pose, tracking, evidence policy, and temporal fall state."""
|
||||
|
||||
import itertools
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, Sequence, Tuple
|
||||
from datetime import datetime
|
||||
from typing import Dict, Optional, Sequence, Tuple
|
||||
|
||||
from v1.config import AppConfig
|
||||
from v1.evidence import PoseEvidence, assess_pose_quality, extract_evidence
|
||||
@@ -11,6 +13,17 @@ from v1.tracking import PersonTracker, TrackedPersonPose
|
||||
from v1.video_source import FramePacket, SourceStatus
|
||||
|
||||
|
||||
_SESSION_COUNTER = itertools.count(1)
|
||||
|
||||
|
||||
def new_session_id() -> str:
|
||||
"""Return a process-unique, human-readable run id for event traceability."""
|
||||
|
||||
return "{0}-{1:03d}".format(
|
||||
datetime.now().strftime("%Y%m%d-%H%M%S"), next(_SESSION_COUNTER)
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PersonAnalysis:
|
||||
tracked_pose: TrackedPersonPose
|
||||
@@ -47,8 +60,15 @@ class FallPipeline:
|
||||
self._active_track_ids = set()
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config: AppConfig, pose_adapter) -> "FallPipeline":
|
||||
"""Create one immutable runtime decision flow from validated config."""
|
||||
def from_config(
|
||||
cls, config: AppConfig, pose_adapter, session_id: Optional[str] = None
|
||||
) -> "FallPipeline":
|
||||
"""Create one immutable runtime decision flow from validated config.
|
||||
|
||||
Each run gets a unique ``session_id`` so confirmed-event IDs never collide
|
||||
across monitoring restarts within the same day (no screenshot overwrite or
|
||||
duplicate JSONL identity).
|
||||
"""
|
||||
|
||||
return cls(
|
||||
pose_adapter=pose_adapter,
|
||||
@@ -59,6 +79,7 @@ class FallPipeline:
|
||||
recovery_window_seconds=config.event.recovery_window_seconds,
|
||||
cooldown_seconds=config.event.cooldown_seconds,
|
||||
config_version=config.runtime_config_version,
|
||||
session_id=session_id or new_session_id(),
|
||||
),
|
||||
keypoint_confidence_threshold=config.event.keypoint_confidence_threshold,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user