Redis Worker Service
Role: The Logic Processor (CPU Bound)
Source: services/redis-worker
Responsibilities
This service translates "Bounding Boxes" into "Business Value".
1. Post-Processing
Raw YOLO output contains many duplicate boxes. The worker performs Non-Maximum Suppression (NMS) to filter overlapping detections and keep only the most confident ones.
2. Behavioral Analytics
It tracks the state of the horse over time (Sliding Window):
- velocity: How many pixels did the center-point move in the last second?
- posture: Is the bounding box aspect ratio horizontal (lying) or vertical (standing)?
3. Persistence & Alerting
- Aggregates metrics (e.g., "Average Agitation over 1 min").
- Inserts consolidated data points into the MySQL
Metricstable. - Publishes high-priority alerts (
STRESSED,DOWN) to the Redis Pub/Sub channel for the backend usage.