feat: add validator for post fueling and car abandon

This commit is contained in:
ziesorx 2025-09-23 22:11:39 +07:00
parent 7a38933bb0
commit 4002febed2
4 changed files with 128 additions and 5 deletions

View file

@ -352,17 +352,27 @@ class StableCarValidator:
def should_skip_same_car(self,
vehicle: TrackedVehicle,
session_cleared: bool = False) -> bool:
session_cleared: bool = False,
permanently_processed: Dict[int, float] = None) -> bool:
"""
Determine if we should skip processing for the same car after session clear.
Args:
vehicle: The tracked vehicle
session_cleared: Whether the session was recently cleared
permanently_processed: Dict of permanently processed vehicles
Returns:
True if we should skip this vehicle
"""
# Check if this vehicle was permanently processed (never process again)
if permanently_processed and vehicle.track_id in permanently_processed:
process_time = permanently_processed[vehicle.track_id]
time_since = time.time() - process_time
logger.debug(f"Skipping permanently processed vehicle {vehicle.track_id} "
f"(processed {time_since:.1f}s ago)")
return True
# If vehicle has a session_id but it was cleared, skip for a period
if vehicle.session_id is None and vehicle.processed_pipeline and session_cleared:
# Check if enough time has passed since processing