3.0 KiB
3.0 KiB
Project Review
Purpose
The virtual health assistant is built as an event-driven desktop system that converts binary health predictions into a continuously updated risk visualization.
Primary goals:
- receive predictions in near real time via MQTT,
- persist events locally,
- compute rolling risk levels,
- provide immediate visual feedback in the UI,
- export machine-readable state for external avatar integration.
End-to-End Pipeline
MqttClientServicesubscribes to the configured topic.- Payloads are forwarded to
BinaryEventService. - Payloads are validated (
valid,_id,prediction). - Accepted predictions are stored by
DataPersistenceService. StatisticsServicecomputes the current ratio from the latest 20 entries.EvaluationServicemaps ratio toProblemLevel.AppStatenotifies UI controllers and views.AnimationFileServicewritesanimation.json.
Functional Scope
- Desktop monitoring UI with two views (stream + dashboard)
- MQTT-driven event ingestion
- SQLite event persistence
- Rolling ratio analytics
- Level classification (
NONE,WARNING,HIGH,DISASTER) - Optional external process orchestration (simulator + Unreal launcher)
- Startup configuration validation and structured logging
Design Highlights
- Separation of concerns
Startup/shutdown orchestration lives inbootstrap; business logic inservice; view orchestration incontroller. - Config-first runtime behavior
MQTT, simulator, Unreal, and animation output are controlled via properties. - Fail-fast startup validation
AppConfigValidatorblocks startup when enabled integrations are misconfigured. - Testability by construction
Multiple services support dependency injection in tests (for example process launchers and MQTT client instances).
Quality and Verification
Automated tests cover:
- App state transitions and listener notifications
- Payload validation and duplicate-id handling
- Ratio and threshold evaluation behavior
- SQLite persistence integration behavior
- MQTT subscribe/publish/callback flow
- Process startup/shutdown command sequencing and startup report behavior
- Animation file mapping and overwrite behavior
See Testing for details and command examples.
Current Limitations
- Runtime database is deleted on shutdown (
ApplicationShutdownManager), so historical data is not retained. - Default Unreal-related paths are machine-specific and must be adapted for new environments.
- UI behavior is not covered by end-to-end GUI tests.
- Duplicate payload protection is based on the last seen
_idonly (consecutive duplicates).
Improvement Roadmap
- Make database cleanup optional through configuration.
- Add profile-based configuration (local/dev/demo) to reduce machine-specific defaults.
- Add UI-level automated checks (or contract tests around controller/view boundaries).
- Improve duplicate handling (e.g., bounded cache of recent IDs).
- Add metrics/telemetry for startup health and message throughput.