Overview
The ML pipeline is complete and tested (PR #61) but not yet integrated with the main application. This issue tracks connecting the ML components to the live reading pipeline.
Current State
✅ Complete:
- ML pipeline implementation in
backend/ml/
- 48/48 tests passing
- Per-device state isolation
- Kalman filtering, anomaly detection, curve fitting, MPC
❌ Not Connected:
- Not called from
backend/main.py reading handler
- Not exposed via API endpoints
- Not displayed in frontend UI
- State lost on service restart
Proposed Integration
Phase 1: Basic Integration
- Add
MLPipelineManager to backend/main.py
- Process readings through ML pipeline in
handle_tilt_reading()
- Broadcast ML results via WebSocket
- Display filtered values on dashboard
Phase 2: State Persistence
- Hydrate ML state from database on startup (last 48 hours)
- Ensures predictions work immediately after restart
- Option: Store ML results in new
ml_results table
Phase 3: UI Integration
- Show Kalman-filtered values on dashboard
- Display FG predictions and completion estimates
- Anomaly alerts (stuck fermentation, temperature spikes)
- MPC temperature trajectory visualization
Data Storage Strategy
Current approach: In-Memory
- ML state lives in RAM (per-device history buffers)
- ~157 KB per device for 2-week fermentation
- Lost on service restart
Recommended: Hydrate from DB
Implementation Notes
- Keep ML processing async/non-blocking
- Feature flags for gradual rollout (
MLConfig)
- WebSocket message type:
ml_update
- Consider caching filtered values for API endpoints
Related
Acceptance Criteria
Priority
Medium - ML pipeline is functional but not user-visible. Can be done incrementally after PR #61 merges.
Overview
The ML pipeline is complete and tested (PR #61) but not yet integrated with the main application. This issue tracks connecting the ML components to the live reading pipeline.
Current State
✅ Complete:
backend/ml/❌ Not Connected:
backend/main.pyreading handlerProposed Integration
Phase 1: Basic Integration
MLPipelineManagertobackend/main.pyhandle_tilt_reading()Phase 2: State Persistence
ml_resultstablePhase 3: UI Integration
Data Storage Strategy
Current approach: In-Memory
Recommended: Hydrate from DB
Implementation Notes
MLConfig)ml_updateRelated
ML_VALIDATION_GUIDE.mdAcceptance Criteria
Priority
Medium - ML pipeline is functional but not user-visible. Can be done incrementally after PR #61 merges.