AI-assisted pet health monitoring, geofencing, and connected care for Android.
- Project Overview
- Key Features
- Complete Tech Stack
- System Architecture
- Folder Structure
- Installation Guide
- Environment Variables
- Application Workflow
- API Documentation
- Database Design
- Simulator Integration
- AI and ML Section
- Screenshots
- Configuration Guide
- Deployment
- Performance Optimizations
- Security Measures
- Error Handling
- Troubleshooting
- Future Improvements
- Contributing Guide
- License
- Authors--contributors
- Acknowledgements
PetHealthApp is the production-facing Android application in this workspace. It combines wearable telemetry ingestion, pet profile management, AI-assisted health interpretation, map-based safety features, and care coordination workflows into a single Jetpack Compose app.
- Authenticates pet owners with Firebase Authentication and Google Sign-In.
- Stores owner profiles, pets, telemetry history, alerts, chats, appointments, and vet metadata in Cloud Firestore.
- Connects to a nearby simulator or collar-like device over Bluetooth Classic RFCOMM.
- Parses newline-delimited JSON telemetry packets containing vitals, activity, steps, battery, and GPS data.
- Persists sampled telemetry and derived alerts to Firestore.
- Uses a local TensorFlow Lite model plus remote LLM-based analysis to generate health insights.
- Visualizes pet status across dashboard, metrics, map, device, and profile workflows.
- Supports geofence alerts, SOS assistance, vet discovery, health report export, and owner profile customization.
The app addresses a practical gap in pet care: owners rarely have continuous visibility into health, activity, and location signals in a way that is understandable, actionable, and connected to escalation workflows.
- Turn raw telemetry into readable pet-owner insights.
- Create a closed loop from sensing to alerting to care action.
- Provide a demo-ready, recruiter-friendly Android product architecture.
- Support simulator-driven testing without requiring production hardware.
An owner pairs the app with a simulator or smart collar, selects their active pet, monitors live vitals, receives anomaly summaries, checks whether the pet has moved outside a safe zone, exports a health report, and escalates to vet support when needed.
Raw sensor streams are noisy and not directly useful to pet owners. Most monitoring concepts also fail without onboarding, persistence, map safety, and downstream care workflows.
PetHealthApp uses a layered Android MVVM design:
- Compose UI for product-facing flows
- ViewModels for orchestration and session-aware state
- Repository layer for Firebase, Bluetooth, storage, and AI integrations
- Local rule engine and TFLite model for baseline-aware health scoring
- Remote LLM summary generation for owner-friendly explanations
| Feature | Description | Status | Related Module |
|---|---|---|---|
| Email/password authentication | Firebase Auth login and signup with protected navigation | Implemented | AuthRepository, AuthViewModel, LoginScreen, SignupScreen |
| Google Sign-In | Uses Play Services and Firebase credentials for social auth | Implemented | AuthRepository, AuthViewModel |
| Splash auth gate | Routes users to login or dashboard based on live auth session | Implemented | SplashScreen, MainActivity |
| Owner profile management | Stores owner name, city, avatar, emergency contact, vet number, notifications, SOS preferences | Implemented | ProfileScreen, AuthRepository |
| Pet creation and editing | Add/edit pet profile with metadata and image | Implemented | AddPetScreen, PetRepository, PetViewModel |
| Active pet selection | Shared active pet context powers dashboard, map, device, and AI flows | Implemented | PetViewModel, MainActivity |
| Storj-backed image storage | Attempts object upload to Storj with fallback behavior | Implemented | StorjImageRepository, PetRepository, AuthRepository |
| Bluetooth pairing and connection | Lists bonded devices and connects over Bluetooth Classic SPP | Implemented | BluetoothService, DeviceViewModel |
| Simulator config sync | Sends control payloads back to simulator for interval, accuracy, issue injection, and activity overrides | Implemented | SimulatorConfig, BluetoothService, DeviceViewModel |
| Live telemetry parsing | Parses data and ack packets safely from JSON |
Implemented | PetHealthData, BluetoothEvent, BluetoothService |
| Dashboard monitoring | Shows recent vitals, alerts, AI summary, and geofence awareness | Implemented | DashboardScreen, DeviceViewModel |
| Metrics history | Displays log trends and historical summaries | Implemented | MetricsScreen, HealthRepository |
| AI detailed insight windows | Generates detail summaries over selectable time windows | Implemented | AIRepository, AiInsightScreen |
| TFLite anomaly intelligence | Computes baseline-aware health score and anomaly flags on-device | Implemented | PetAiEngine |
| LLM health narrative | Uses xAI Grok or Groq chat completions for owner-readable health guidance | Implemented | AIRepository |
| Health log persistence | Batches telemetry and alerts into Firestore collections | Implemented | HealthRepository |
| PDF health report export | Generates branded PDF reports and shares them via FileProvider | Implemented | HealthReportExporter, MetricsScreen |
| Geofencing | Persists home location and radius, detects out-of-zone conditions | Implemented | MapRepository, MapViewModel, MapScreen |
| OSM map view | Displays map and live location using osmdroid/OpenStreetMap | Implemented | MapScreen, MapViewModel |
| SOS assistance | Presents emergency workflow with owner-defined defaults and contact paths | Implemented | MapScreen, MapViewModel |
| Nearby vet placeholders | Exposes nearest-vet list and emergency support workflow | Implemented | MapViewModel, VetRepository, VetDiscoveryScreen |
| Vet discovery | Reads vet catalog and sorts by distance | Implemented | VetRepository, VetViewModel |
| Real-time chat | Creates or reuses pet/vet/user-specific chat documents | Implemented | ChatRepository, ChatViewModel, ChatScreen |
| Appointment booking | Creates appointment records and observes appointment history | Implemented | AppointmentRepository, AppointmentViewModel, AppointmentScreen |
| Feature gate for empty state | Prevents access to core health flows until a pet is added | Implemented | MainActivity, PetFeatureGate |
| Category | Technology | Notes |
|---|---|---|
| Language | Kotlin | Android source language |
| UI | Jetpack Compose | Main UI toolkit |
| Design system | Material 3 | Themed Compose surfaces and controls |
| Navigation | Navigation Compose | Route-driven navigation graph |
| Image loading | Coil Compose | Remote and inline image rendering |
| Category | Technology | Notes |
|---|---|---|
| Authentication | Firebase Authentication | Email/password and Google Sign-In |
| Database | Cloud Firestore | Stores user, pet, logs, alerts, chats, appointments, vets |
| File storage | Storj S3-compatible object storage | Pet and owner image upload target |
| Category | Technology | Notes |
|---|---|---|
| Primary cloud DB | Firestore | Realtime document database |
| Local cache | Android DataStore Preferences | Location cache persistence |
| Category | Technology | Notes |
|---|---|---|
| On-device inference | TensorFlow Lite | pet_model.tflite packaged in assets |
| Rule engine | Custom Kotlin heuristics | Severity scoring and baseline drift protection |
| Remote LLM | xAI Grok or Groq | Chat-completions style JSON output |
| Category | Technology | Notes |
|---|---|---|
| Bluetooth transport | RFCOMM / SPP | Newline-delimited JSON packets |
| Maps | osmdroid + OpenStreetMap | Live map tiles and overlays |
| HTTP client | OkHttp | LLM requests and Storj upload signing/request flow |
| Share/export | Android Intent + FileProvider | PDF sharing |
| Category | Technology | Notes |
|---|---|---|
| Identity provider | Firebase Auth | Session state and credential lifecycle |
| Social login | Google Sign-In | Requires GOOGLE_WEB_CLIENT_ID |
| Category | Technology | Notes |
|---|---|---|
| External peer | simulator Android app |
Sends telemetry and accepts config messages |
| Protocol | Pet Simulator Bluetooth Protocol v2.1 | Includes vitals, steps, temperature, issue injection |
| Category | Technology | Notes |
|---|---|---|
| Build system | Gradle Kotlin DSL | Android app build |
| Packaging | APK | Release APK artifacts already exist in workspace |
| Distribution target | Android devices | No server deployment layer in repo |
| Category | Technology | Notes |
|---|---|---|
| Build language | Kotlin DSL (.gradle.kts) |
Build configuration |
| JDK target | Java 17 | Compile/runtime compatibility |
| Android SDK | Compile/target SDK 34 | Modern Android target |
| Testing baseline | JUnit / Espresso / Compose UI test deps | Present in Gradle, limited test code currently checked in |
graph TD
Owner["Pet Owner"] --> UI["Jetpack Compose UI"]
UI --> VM["ViewModels"]
VM --> Repo["Repositories"]
Repo --> BT["Bluetooth Service"]
Repo --> FS["Firebase Auth / Firestore"]
Repo --> ST["Storj Object Storage"]
Repo --> AI["LLM Provider (xAI or Groq)"]
Repo --> MAP["OpenStreetMap via osmdroid"]
Repo --> DS["DataStore Cache"]
BT <--> SIM["Simulator / Collar Device"]
Repo --> TFL["TensorFlow Lite Engine"]
graph LR
MainActivity --> AuthVM["AuthViewModel"]
MainActivity --> PetVM["PetViewModel"]
MainActivity --> DeviceVM["DeviceViewModel"]
MainActivity --> MapVM["MapViewModel"]
MainActivity --> PetHealthVM["PetHealthViewModel"]
AuthVM --> AuthRepo["AuthRepository"]
PetVM --> PetRepo["PetRepository"]
DeviceVM --> BluetoothRepo["BluetoothService"]
DeviceVM --> HealthRepo["HealthRepository"]
DeviceVM --> AIRepo["AIRepository"]
DeviceVM --> TFLite["PetAiEngine"]
MapVM --> MapRepo["MapRepository"]
AuthRepo --> Firestore
PetRepo --> Firestore
HealthRepo --> Firestore
MapRepo --> Firestore
sequenceDiagram
participant Simulator
participant Bluetooth as BluetoothService
participant DeviceVM as DeviceViewModel
participant TFLite as PetAiEngine
participant HealthRepo as HealthRepository
participant LLM as AIRepository
participant UI as Dashboard/Metrics
Simulator->>Bluetooth: JSON data packet
Bluetooth->>DeviceVM: BluetoothEvent.Data
DeviceVM->>TFLite: analyzeLive(current, previous)
DeviceVM->>HealthRepo: saveHealthLogAndAlert(throttled)
DeviceVM->>LLM: generateInsight(...)
HealthRepo-->>DeviceVM: history + alerts streams
DeviceVM-->>UI: StateFlow updates
graph TD
DeviceScreen["Device Screen"] --> DeviceVM["DeviceViewModel"]
DeviceVM --> Outgoing["Config JSON"]
Outgoing --> Simulator["PetSimulatorApp"]
Simulator --> Incoming["Telemetry JSON"]
Incoming --> DeviceVM
DeviceVM --> Dashboard["Dashboard"]
DeviceVM --> Metrics["Metrics"]
DeviceVM --> Map["Map Geofence"]
DeviceVM --> Firestore["health_logs / alerts"]
- The app is effectively client-centric: there is no custom backend service in this repository.
- Firestore functions as the shared cloud persistence layer.
- Bluetooth is used only for local device-to-app telemetry/control exchange.
- AI is hybrid: local TFLite for scoring, remote LLM for explanation.
main app/
├── app/
│ ├── build.gradle.kts
│ ├── google-services.json
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── assets/
│ │ └── pet_model.tflite
│ ├── java/com/pethealthapp/
│ │ ├── MainActivity.kt
│ │ ├── data/
│ │ ├── domain/
│ │ ├── ui/
│ │ │ ├── components/
│ │ │ ├── navigation/
│ │ │ ├── screens/
│ │ │ └── theme/
│ │ └── viewmodel/
│ └── res/
│ ├── drawable/
│ ├── mipmap*/
│ ├── values/
│ └── xml/
├── gradle/
│ └── wrapper/
├── build.gradle.kts
├── design.md
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
├── project_documentation.md
└── settings.gradle.kts
| Folder | Purpose | Important Files |
|---|---|---|
app/src/main/java/com/pethealthapp |
App entry and source root | MainActivity.kt |
data |
External integration and persistence layer | AuthRepository.kt, PetRepository.kt, HealthRepository.kt, BluetoothService.kt, AIRepository.kt, StorjImageRepository.kt, HealthReportExporter.kt |
domain |
Shared models, state carriers, AI result structures | PetHealthData.kt, SimulatorConfig.kt, HealthLog.kt, AiInsight.kt, Appointment.kt |
viewmodel |
Screen/application orchestration layer | AuthViewModel.kt, PetViewModel.kt, DeviceViewModel.kt, MapViewModel.kt |
ui/screens |
Product-facing screens | DashboardScreen.kt, MetricsScreen.kt, MapScreen.kt, DeviceScreen.kt, ProfileScreen.kt, AiInsightScreen.kt |
ui/components |
Reusable Compose pieces | ScreenScaffold.kt, MetricCard.kt, PetBottomNavigationBar.kt, PetListCard.kt |
ui/navigation |
Route definitions and destination metadata | AppRoute.kt, AppDestination.kt |
ui/theme |
App styling | Color.kt, Theme.kt, Type.kt |
assets |
Packaged ML assets | pet_model.tflite |
res/xml |
Android provider/path config | file_paths.xml |
gradle/wrapper |
Gradle bootstrap | gradle-wrapper.jar, gradle-wrapper.properties |
This module is an Android client application. It does not include a custom backend server, but it does require Firebase configuration and optional AI/storage credentials for full functionality.
| Requirement | Recommended Version | Notes |
|---|---|---|
| Android Studio | Hedgehog or newer | For Compose + SDK 34 workflows |
| JDK | 17 | Matches project compile target |
| Android SDK | 34 | Required by Gradle config |
| Physical Android device | Recommended | Needed for Bluetooth pairing and real map/location testing |
| Firebase project | Required for auth/database | Must supply valid google-services.json |
| Optional LLM API key | xAI or Groq | Enables AI summaries |
| Optional Storj credentials | S3-compatible | Enables image uploads instead of fallback |
git clone <your-repository-url>
cd "<repo-root>/main app"Open the main app folder as a Gradle project.
Dependencies are resolved automatically by Gradle. From terminal:
./gradlew assembleDebugOn Windows:
.\gradlew.bat assembleDebug- Place a valid Firebase configuration file at:
app/google-services.json
- Add required keys to
local.properties. - Sync Gradle.
Create or configure a Firebase project with:
- Authentication enabled
- Firestore enabled
- Matching package name:
com.pethealthapp
Suggested Firestore collections used by the app:
userspetshealth_logsalertsvetschatsappointments
- Install and run the companion app in
../simulator. - Start the simulator server.
- Pair the two Android devices if needed.
- Use the Device screen in PetHealthApp to connect to a bonded simulator device.
Typical first-run flow:
- Launch app.
- Sign up or log in.
- Complete owner profile.
- Add at least one pet.
- Select the active pet.
- Open Device screen and connect to simulator.
Debug build:
./gradlew assembleDebugRelease build:
./gradlew assembleRelease- Replace placeholder Firebase config
- Verify Firestore rules
- Provide real Google web client ID
- Configure one AI provider key
- Configure Storj if image upload is required
- Test Bluetooth permissions on Android 12+
- Validate map/location permissions on physical devices
This project reads secrets from local.properties and injects them into BuildConfig.
| Variable | Purpose | Required | Example |
|---|---|---|---|
GROQ_API_KEY |
Enables Groq-based LLM summary generation | No | gsk_... |
GROK_API_KEY |
Enables xAI Grok-based LLM summary generation | No | xai-... |
GROK_BASE_URL |
Overrides Grok endpoint | No | https://api.x.ai/v1/chat/completions |
GROK_MODEL |
Selects xAI model | No | grok-3-mini |
GOOGLE_WEB_CLIENT_ID |
Required for Google Sign-In credential exchange | Yes for Google login | 123456.apps.googleusercontent.com |
STORJ_ENDPOINT |
Storj S3-compatible endpoint | No | https://gateway.storjshare.io |
STORJ_BUCKET |
Storj bucket for image assets | No | pethealth-assets |
STORJ_ACCESS_KEY |
Storj access key | No | ACCESS_KEY |
STORJ_SECRET_KEY |
Storj secret key | No | SECRET_KEY |
STORJ_PUBLIC_BASE_URL |
Public URL prefix for uploaded assets | No | https://link.storjshare.io/raw/... |
STORJ_REGION |
S3 signing region | No | us-east-1 |
sdk.dir=C\:\\Users\\you\\AppData\\Local\\Android\\Sdk
GOOGLE_WEB_CLIENT_ID=1234567890-abcdef.apps.googleusercontent.com
GROK_API_KEY=
GROQ_API_KEY=gsk_example
GROK_BASE_URL=https://api.x.ai/v1/chat/completions
GROK_MODEL=grok-3-mini
STORJ_ENDPOINT=https://gateway.storjshare.io
STORJ_BUCKET=pethealth-assets
STORJ_ACCESS_KEY=example_access_key
STORJ_SECRET_KEY=example_secret_key
STORJ_PUBLIC_BASE_URL=
STORJ_REGION=us-east-1MainActivityconfigures osmdroid and starts Compose.SplashScreenappears.AuthViewModel.observeAuthState()decides authenticated vs unauthenticated route.- If authenticated,
PetViewModel.observePets(userId)begins streaming pet records. - Active pet ID is pushed into
DeviceViewModelandMapViewModel.
flowchart TD
A["User Action"] --> B["Compose Screen"]
B --> C["ViewModel Function"]
C --> D["Repository"]
D --> E["Firestore / Bluetooth / LLM / Storj"]
E --> F["Result / Flow / Callback"]
F --> C
C --> G["StateFlow update"]
G --> B
- User selects bonded device in Device screen.
BluetoothService.connect()opens RFCOMM socket with UUID00001101-0000-1000-8000-00805F9B34FB.listenForEvents()reads newline-delimited JSON.PetHealthData.fromJsonObjectOrNull()validates packet.DeviceViewModelupdates UI state.- TFLite analysis computes score/anomaly.
- Firestore logging is throttled and batch-written.
- AI insight is requested on dashboard open or anomaly trigger.
There is no custom application server. Communication paths are:
- Firebase Auth for identity
- Firestore for cloud persistence
- LLM HTTP APIs for summaries
- Storj-compatible HTTP requests for object upload
graph TD
Telemetry["Latest telemetry"] --> Baseline["PetAiEngine baseline analysis"]
History["Recent health logs"] --> Baseline
Baseline --> Score["Health score / status / anomaly"]
Score --> Prompt["AIRepository JSON prompt assembly"]
History --> Prompt
PetProfile["Pet profile"] --> Prompt
Prompt --> LLM["xAI Grok or Groq"]
LLM --> Insight["AiInsight / AiInsightDetail"]
- Live packet enters
DeviceViewModel - Previous packet is used for delta features
- Log persistence is throttled to reduce write volume
- History and alerts are streamed back from Firestore
- Metrics screen can export selected time-window data into PDF
This repository does not expose REST endpoints. Its operational APIs are:
- Bluetooth protocol between app and simulator
- Firebase data contract
- LLM request contract
| Method | Endpoint / Channel | Purpose | Request | Response |
|---|---|---|---|---|
Bluetooth write |
RFCOMM JSON line | Set simulator behavior | {"type":"config","health_mode":"normal","interval":5,"location_interval":2,"accuracy":"balanced","override_activity":false,"forced_activity":"rest","simulate_issue":"none"} |
{"type":"ack","status":"applied"} or ignored |
| Method | Endpoint / Channel | Purpose | Request | Response |
|---|---|---|---|---|
Bluetooth read |
RFCOMM JSON line | Receive simulated device data | N/A | {"type":"data","heart_rate":92,"spo2":97,"activity":"walking","temperature":38.4,"steps":1450,"battery_percentage":84,"latitude":12.9716,"longitude":77.5946,"accuracy":6.8,"timestamp":1713960000000} |
| Collection | Purpose | Key Fields |
|---|---|---|
users |
Owner profile and preferences | email, ownerName, city, emergencyContact, preferredVetNumber, activePetId, homeLocation, radius, isUserWithPet |
pets |
Pet profiles | userId, name, type, breed, dob, weight, imageUrl, imageBase64, createdAt |
health_logs |
Historical telemetry | petId, heart_rate, spo2, activity, temperature, steps, battery_percentage, accuracy, latitude, longitude, timestamp |
alerts |
Derived risk events | petId, message, severity, timestamp |
vets |
Vet catalog | name, phone, latitude, longitude, address, metadata |
chats |
Chat threads | userId, petId, vetId, messages |
appointments |
Vet booking records | userId, petId, vetId, date, time, status |
| Method | Provider | Purpose | Request | Response |
|---|---|---|---|---|
POST |
xAI / Groq chat completions | Generate summary insight | JSON prompt with pet data, baseline, history, AI analysis | Strict JSON object with summary/severity/recommendation/confidence |
POST |
xAI / Groq chat completions | Generate detailed insight | Windowed telemetry sample and AI summary | Strict JSON object with health insight, plan, recommendations, severity, confidence |
erDiagram
USERS ||--o{ PETS : owns
PETS ||--o{ HEALTH_LOGS : records
PETS ||--o{ ALERTS : triggers
USERS ||--o{ CHATS : participates
PETS ||--o{ CHATS : contextualizes
VETS ||--o{ CHATS : serves
USERS ||--o{ APPOINTMENTS : books
PETS ||--o{ APPOINTMENTS : concerns
VETS ||--o{ APPOINTMENTS : receives
| Model | Explanation |
|---|---|
users |
Core identity extension record for Firebase user session |
pets |
Primary business entity representing monitored animals |
health_logs |
Time-series telemetry snapshots used by metrics and AI |
alerts |
Short-lived or historical anomaly/geofence event records |
vets |
Directory data used for discovery and escalation |
chats |
Thread-level communication documents between owner and vet context |
appointments |
Scheduling artifacts tied to user, pet, and vet |
- Reads are mostly listener-based with
callbackFlow. - Writes are direct or batched.
- The app often sorts in memory after snapshot retrieval.
- Active pet selection acts as the main routing key for downstream features.
The production app is designed to operate with the sibling simulator module in this repository.
- Drive realistic live demo flows without custom hardware
- Validate Bluetooth connectivity, parsing, and control messages
- Exercise AI, alerting, and geofence logic using synthetic events
| Field | Meaning |
|---|---|
health_mode |
Baseline physiology mode: normal, stress, rest |
interval |
Non-location simulation interval |
location_interval |
GPS update/transmit interval |
accuracy |
Location priority mode |
override_activity |
Whether app should force the simulator’s activity state |
forced_activity |
Forced state when override is enabled |
simulate_issue |
Injected issue: none, fever, lethargy, hyperactivity |
sequenceDiagram
participant App as Main App
participant Sim as Simulator
App->>Sim: Connect over SPP UUID
App->>Sim: config JSON
Sim-->>App: ack JSON
loop Continuous stream
Sim-->>App: data JSON
App->>App: parse, analyze, persist, visualize
end
| Layer | Technology | Purpose |
|---|---|---|
| On-device model | TensorFlow Lite (pet_model.tflite) |
Baseline-aware classification and health scoring |
| Heuristic fallback | Kotlin feature scoring | Backup if interpreter inference fails |
| LLM narrative | xAI Grok or Groq | Human-friendly explanation and recommendations |
The local model computes normalized features from:
- Heart rate
- SpO2
- Temperature
- Activity level
- Heart-rate delta
- Temperature delta
- SpO2 delta
- Stress ratio
- Build or retrieve rolling baseline for active pet.
- Convert latest telemetry and previous telemetry into model features.
- Normalize values using packaged mean/std arrays.
- Run TFLite interpreter if available, otherwise use heuristic probabilities.
- Map class to
Normal,Warning, orCritical. - Compute health score and top contributing factors.
- Protect baseline from drifting during anomalies.
The remote AI layer is explicitly instructed to return strict JSON only. The app then sanitizes:
- severity
- confidence
- structured recommendations
- Dashboard summary card
- Detailed AI insight screen
- PDF report narrative
- Alert context and owner guidance
(Add screenshot here)
(Add screenshot here)
(Add screenshot here)
(Add screenshot here)
(Add screenshot here)
(Add screenshot here)
| File | Purpose |
|---|---|
build.gradle.kts |
Root Android build configuration |
app/build.gradle.kts |
Main module dependencies, SDK versions, BuildConfig keys |
settings.gradle.kts |
Includes :app module |
local.properties |
Local SDK path and secrets |
app/google-services.json |
Firebase project binding |
app/src/main/AndroidManifest.xml |
Permissions, FileProvider, app metadata |
app/src/main/res/xml/file_paths.xml |
FileProvider export paths |
| Config | Current Value / Behavior |
|---|---|
compileSdk |
34 |
targetSdk |
34 |
minSdk |
24 |
| Compose compiler extension | 1.5.14 |
| LLM cache duration | 5 minutes |
| Bluetooth protocol | SPP UUID 00001101-0000-1000-8000-00805F9B34FB |
| Log observation window | Default 60 days for history reads |
- AI provider selection via API keys
- Storj endpoint and bucket
- Bluetooth simulator config defaults
- Map geofence radius persistence
- PDF report generation behavior
- Configure Firebase and
local.properties - Build
assembleDebug - Install on Android device or emulator
This repo does not deploy a server. Production deployment means shipping the Android client with valid cloud services attached.
Typical steps:
- Create release keystore
- Configure signing in Gradle or Android Studio
- Build
assembleRelease - Upload APK/AAB to your distribution channel
Not applicable in the current repository. No Dockerfiles were found and there is no backend service container to deploy.
Cloud responsibilities are limited to managed services:
- Firebase project setup
- Firestore rules/indexing
- Authentication providers
- Optional Storj bucket provisioning
- Optional xAI or Groq API access
| Area | Optimization |
|---|---|
| AI requests | Short-term cache for quick insight and detailed insight generation |
| Bluetooth stream | Lightweight JSON line parsing and reconnect attempts |
| Firestore writes | Throttled telemetry persistence and batched log/alert writes |
| Baseline model | Incremental per-pet baseline update instead of full recomputation |
| History analysis | Window-based sampling for large telemetry sets |
| UI rendering | StateFlow-driven Compose updates and reusable screen scaffolds |
| Local persistence | DataStore cache for lightweight location reuse |
| Area | Current Measure |
|---|---|
| Authentication | Firebase Authentication session handling |
| Secret injection | Secrets loaded from local properties into BuildConfig |
| File sharing | FileProvider used for PDF URIs instead of raw file paths |
| Validation | JSON parsing and field coercion for incoming Bluetooth data |
| Access control | Firestore-backed ownership logic by userId and petId |
| Input handling | Friendly validation in auth and pet flows |
- No end-to-end encrypted Bluetooth payload layer
- Firestore security rule definitions are not included in this folder
- Secrets are client-side for demo/prototype convenience
- Safe JSON parsing with null/fallback behavior
- Reconnect attempts for Bluetooth disconnects
- Friendly error mapping in ViewModels
- Fallback AI summaries when remote AI fails
- Storj fallback paths when upload fails
- Empty-state gating when pets are missing
- Defensive handling for missing permissions and disabled Bluetooth
- Android
Logstatements in Bluetooth, AI, and simulator integration paths - User-facing messages stored in UI state
- Runtime fallback rather than hard crash for most external failures
| Problem | Cause | Solution |
|---|---|---|
| Google Sign-In fails | Missing or incorrect GOOGLE_WEB_CLIENT_ID |
Add the correct web client ID to local.properties and verify Firebase setup |
| Login works but Firestore features fail | Firestore disabled or rules blocking access | Enable Firestore API and review Firestore rules |
| App opens but dashboard is locked | No pet has been added yet | Create a pet profile in Profile or Add Pet flow |
| Pet images do not upload | Storj credentials missing or endpoint invalid | Configure Storj keys or allow fallback behavior |
| Bluetooth device list is empty | No bonded simulator device | Pair the simulator device in Android system Bluetooth settings |
| Bluetooth connect fails immediately | Simulator not started or wrong device selected | Start simulator first and connect to the correct bonded device |
| Telemetry never appears after connection | Simulator not streaming or JSON invalid | Verify simulator is connected and watch simulator logs |
| AI insight unavailable | No GROK_API_KEY or GROQ_API_KEY configured |
Add one provider key to local.properties |
| AI insight feels stale | Cache still active | Wait for cache expiry or trigger a different detailed window |
| Map loads but pet marker does not move | No incoming location packets yet | Confirm simulator location permissions and live stream |
| Geofence alerts do not fire | isUserWithPet enabled or home location not set |
Disable companion mode and set home location/radius |
| PDF export fails | FileProvider issue or no report data | Confirm logs exist and app manifest/file paths are intact |
| Owner avatar not saved | Storage upload failure or Firestore write failure | Verify Storj settings and Firestore permissions |
| Appointments screen is empty | No appointment records exist for active pet | Book an appointment after selecting a pet |
| Vet list is empty | vets collection not populated yet |
Seed or add vet records in Firestore |
| Roadmap Item | Value | Priority |
|---|---|---|
| Dedicated backend service | Move secrets and business logic off-device | High |
| Background telemetry ingestion | Support foreground service or WorkManager-like syncing | High |
| Better Firestore query/index strategy | Reduce in-memory sorting and client-side filtering | High |
| Breed-aware baselines | Improve anomaly accuracy per animal profile | High |
| Real nearby-vet API | Replace placeholder vet proximity data | Medium |
| Scalable chat schema | Move from document-array messages to subcollections | Medium |
| Rich charting | Improve analytics visuals in Metrics | Medium |
| Push notifications | Alert owners when severe events occur | Medium |
| Multi-pet comparative dashboard | Better support households with several pets | Medium |
| Wearable hardware integration | Replace simulator dependency with production device firmware | High |
| Rule engine tuning console | Expose threshold tuning for demo or clinical scenarios | Low |
feature/<short-description>fix/<short-description>docs/<short-description>refactor/<short-description>
- Create a branch from the main integration branch.
- Keep changes scoped to one feature or fix.
- Test auth, pet selection, and affected feature flows.
- Include screenshots for UI changes.
- Document any new
local.propertiesvariables or Firestore fields.
- Follow Kotlin and Compose idioms already present in the project.
- Keep business logic in repositories/ViewModels, not screens.
- Prefer domain models and typed state over raw map access in UI.
- Preserve safe parsing and fallback behaviors around external systems.
- Manual validation on physical Android devices for Bluetooth/location flows
- Regression testing for auth routing, pet gating, and dashboard state
- Simulator pairing and telemetry confirmation for device-related changes
No explicit license file was found in this module. Treat the codebase as proprietary or internal until a project license is added.
- Product / Mobile Engineering: Mudit Sharma
- AI / Data Intelligence: Mudit Sharma
- Simulator / Protocol Engineering: Mudit Sharma
- UX / Visual Design: Mudit Sharma
- Android and Jetpack Compose ecosystem
- Firebase Authentication and Cloud Firestore
- TensorFlow Lite for embedded inference
- OpenStreetMap and osmdroid for open map rendering
- Storj for S3-compatible asset storage
- xAI and Groq for structured LLM summaries
- The companion
simulatormodule for repeatable integration testing