How dilip-sheesh/anima works
1. Repository shape
- This is a single Android client app under frontend/app, built with Kotlin and Gradle Kotlin DSL.
- There is no backend service in the repo; the system boundary is the phone app plus external inputs from BLE hardware and Android system health APIs.
2. App entry and presentation host
- AnimaApplication is the application-level entry point.
- MainActivity is the UI host, and presentation/navigation/AnimaNavigation.kt wires the top-level screen flow.
- The UI layer is Jetpack Compose + Material 3, with theming isolated in presentation/theme.
3. Screen-level UI structure
- The app is organized into feature screens: dashboard, profile, and suggestions.
- DashboardScreen is the main status surface and uses DashboardViewModel for state.
- ProfileScreen has its own view model, and SuggestionsScreen appears to present recommendations or next actions based on detected stress state.
4. ViewModel-driven state flow
- The UI follows MVVM: screens render state, while ViewModels own derived app state and coordinate data sources.
- Statcard.kt is a reusable dashboard UI component rather than a subsystem boundary.
5. BLE sensor ingestion
- The wearable smart glasses stream physiological data over Bluetooth Low Energy.
- data/bluetooth/BluetoothService.kt is the likely connection/session layer, BluetoothManager.kt the orchestration layer, and BluetoothParser.kt the decoding layer.
- This is the primary real-time ingestion path for multi-sensor signals such as PPG, EDA, skin temperature, IMU, and eye-tracking data.
6. On-device health/context enrichment
- data/digitalwellbeing/HealthConnectManager.kt integrates with Android Health Connect.
- It supplies contextual features like sleep, steps, screen time, and app usage, which augment the live sensor stream for stress analysis.
7. Local persistence
- data/local/AppDatabase.kt, SensorDao.kt, and SensorEntity.kt indicate a Room database for storing sensor readings or derived observations.
- data/model/SensorData.kt is the app’s internal data model for sensor payloads/records.
- This local store likely supports baseline building, historical analysis, and offline continuity.
8. ML inference boundary
- domain/ml/StressModelExecutor.kt is the main domain-layer inference wrapper.
- The readme says inference runs fully on-device with TensorFlow Lite, using a two-stage pipeline: anomaly detection for baseline deviation and a personalization model for user-specific adaptation.
- This keeps ML logic separate from UI and data transport.
9. End-to-end data flow
- Sensor data enters from BLE, is parsed, optionally persisted locally, combined with Health Connect context, and fed into the stress inference layer.
- The resulting stress score and related insights are pushed upward to the dashboard and suggestions screens.
- The app is explicitly designed so no sensor data leaves the device.
10. System boundaries and external dependencies
- External dependencies that materially define the architecture are: the ESP32-based glasses over BLE, Android Health Connect, and on-device TFLite execution.
- The repo also includes standard Android test scaffolding (androidTest, test) and resource/config files, but the architectural core is the mobile app’s local sensing, inference, and visualization loop.
Main entry points: StressModelExecutor.kt Stress model · AnimaNavigation.kt App navigation · DashboardScreen.kt Dashboard · DashboardViewModel.kt Dashboard VM
Components 22
App shell
Android entrypoints and hosting activity
- Anima app · Application entrypoint for process-wide initialization
frontend/app/src/main/java/com/example/anima/AnimaApplication.kt - Main activity · Android activity that hosts the Compose UI
frontend/app/src/main/java/com/example/anima/MainActivity.kt
Presentation
Compose UI, navigation, screens, and theming
- App navigation · Top-level screen flow and route wiring
frontend/app/src/main/java/com/example/anima/presentation/navigation/AnimaNavigation.kt - Theme · Material 3 styling, colors, and background treatment
frontend/app/src/main/java/com/example/anima/presentation/theme/Theme.kt - Dashboard · Primary status surface for live stress and sensor state
frontend/app/src/main/java/com/example/anima/presentation/screens/dashboard/DashboardScreen.kt - Dashboard VM · Owns dashboard state and derived presentation data
frontend/app/src/main/java/com/example/anima/presentation/screens/dashboard/DashboardViewModel.kt - Stat card · Reusable dashboard metric component
frontend/app/src/main/java/com/example/anima/presentation/screens/dashboard/components/Statcard.kt - Profile · User profile and personalization surface
frontend/app/src/main/java/com/example/anima/presentation/screens/profile/ProfileScreen.kt - Profile VM · Manages profile state and user-specific inputs
frontend/app/src/main/java/com/example/anima/presentation/screens/profile/ProfleViewModel.kt - Suggestions · Recommendations and next actions based on stress state
frontend/app/src/main/java/com/example/anima/presentation/screens/suggestions/SuggestionsScreen.kt
Data
BLE ingestion, Health Connect context, and local persistence
- BLE manager · Coordinates Bluetooth session handling and sensor stream flow
frontend/app/src/main/java/com/example/anima/data/bluetooth/BluetoothManager.kt - BLE service · Bluetooth Low Energy connection and data transport layer
frontend/app/src/main/java/com/example/anima/data/bluetooth/BluetoothService.kt - Parser · Decodes raw BLE payloads into structured sensor records
frontend/app/src/main/java/com/example/anima/data/bluetooth/BluetoothParser.kt - Health Connect · Reads sleep, steps, screen time, and app usage context
frontend/app/src/main/java/com/example/anima/data/digitalwellbeing/HealthConnectManager.kt - App database · Local Room database for sensor history and derived observations
frontend/app/src/main/java/com/example/anima/data/local/AppDatabase.kt - Sensor DAO · Database access for sensor records
frontend/app/src/main/java/com/example/anima/data/local/SensorDao.kt - Sensor entity · Persisted sensor reading or observation row
frontend/app/src/main/java/com/example/anima/data/local/SensorEntity.kt - Sensor data · Internal sensor payload model used across the app
frontend/app/src/main/java/com/example/anima/data/model/SensorData.kt
Domain
On-device inference and business logic
- Stress model · On-device stress inference wrapper with anomaly and personalization stages
frontend/app/src/main/java/com/example/anima/domain/ml/StressModelExecutor.kt
External systems
Device and platform dependencies outside the repo
- Smart glasses · ESP32-based wearable sensor source over Bluetooth Low Energy
- Android health APIs · External Android Health Connect capability consumed by the app
- TFLite runtime · On-device TensorFlow Lite inference engine
Connections 28
- Anima app → Main activity: launches · Application starts the main UI host
- Main activity → App navigation: hosts · Main activity sets up top-level navigation
- App navigation → Dashboard: routes to · Navigation includes the dashboard surface
- App navigation → Profile: routes to · Navigation includes the profile surface
- App navigation → Suggestions: routes to · Navigation includes the suggestions surface
- Dashboard → Dashboard VM: observes · Dashboard renders view model state
- Profile → Profile VM: observes · Profile renders view model state
- Dashboard → Stat card: uses · Dashboard composes reusable stat cards
- Dashboard → Theme: styled by · Compose UI uses shared theme tokens
- Profile → Theme: styled by · Profile UI uses shared theme tokens
- Suggestions → Theme: styled by · Suggestions UI uses shared theme tokens
- BLE manager → BLE service: coordinates · Manager controls connection/session behavior
- BLE service → Parser: feeds · Raw BLE payloads are decoded into sensor data
- BLE service → Smart glasses: connects to · Bluetooth transport connects to wearable glasses
- Parser → Sensor data: produces · Decoded readings become internal sensor records
- Health Connect → Android health APIs: reads from · Health context comes from Android Health Connect
- Sensor data → App database: persists to · Sensor records can be stored locally
- App database → Sensor DAO: exposes · Room database provides DAO access
- Sensor DAO → Sensor entity: stores · DAO reads and writes sensor entities
- Sensor data → Stress model: analyzed by · Sensor stream and context feed inference
- Health Connect → Stress model: augments · Context features enrich stress analysis
- Stress model → TFLite runtime: executes on · Inference runs fully on-device in TensorFlow Lite
- Stress model → Dashboard VM: publishes · Stress outputs flow upward to dashboard state
- Stress model → Suggestions: drives · Stress insights inform recommendations
- Stress model → Profile VM: personalizes · User-specific adaptation can use profile state
- Dashboard VM → BLE manager: consumes · Dashboard state may reflect live sensor ingestion
- Dashboard VM → Health Connect: consumes · Dashboard may include contextual health signals
- Profile VM → App database: reads/writes · Profile state may be stored or retrieved locally