# tvijay333/ecarepro architecture

> Architecture diagram of the GitHub repository tvijay333/ecarepro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tvijay333/ecarepro
- Repository: https://github.com/tvijay333/ecarepro

## Overview

1. This is a single-module Android application written in Kotlin, organized around a standard presentation/data split. The repo is structured for a local Android Studio workflow and is meant to be run with a Gemini API key supplied via a project-level `.env` file.

2. The app’s UI layer lives under `app/src/main/java/com/example/ui`. It is split into feature screens: `SeniorPortalScreen`, `CaregiverDashboardScreen`, `AppointmentsScreen`, `MessagingScreen`, `VideoFeedScreen`, and `AiDiagnosticsScreen`. `MainActivity` is the entry point that likely wires these screens together and acts as the host for the app’s navigation/root UI.

3. The UI styling is isolated in `ui/theme` (`Color.kt`, `Theme.kt`, `Type.kt`), which means design tokens and typography are separated from feature logic. That makes the visual system reusable across all screens.

4. State management is centralized in `HealthViewModel`. This is the boundary between the UI and business/data layers: screens should observe state and invoke actions on the ViewModel rather than touching persistence or network code directly.

5. The data layer is consolidated in `data/repository/HealthRepository`. This repository is the main orchestration point for app data, and it likely hides whether data comes from local storage or the Gemini API. From an architecture perspective, this is the key abstraction that keeps screens and ViewModel decoupled from implementation details.

6. Local persistence is represented by `data/database/AppDatabase` and `data/model/Entities.kt`. This indicates a Room-style database layer with entity definitions stored separately from the repository. The database is the app’s on-device source of truth for health-related or user-related records.

7. External AI access is encapsulated in `data/network/GeminiApiClient`. This is the app’s outbound integration boundary to Google’s Gemini service. The README confirms the app requires `GEMINI_API_KEY`, so AI functionality is a first-class dependency rather than an optional add-on.

8. The likely data flow is: screen interaction -> `HealthViewModel` -> `HealthRepository` -> either `AppDatabase` for local data or `GeminiApiClient` for AI requests -> updated state returned to the ViewModel -> UI recomposition. That gives the diagram a clean split between presentation, orchestration, persistence, and external service calls.

9. The feature set suggests a health/care coordination app rather than a generic consumer app. The named screens imply separate user experiences for seniors and caregivers, plus support for appointments, messaging, live/video feed, and AI-assisted diagnostics. Those are all presentation features built on shared data infrastructure.

10. Build and deployment are standard Android/Gradle-based. The app module uses `build.gradle.kts`, with top-level Gradle configuration and Android resources under `res`. The README also notes a debug signing configuration tweak for local execution, which affects how the app is packaged during development.

11. Quality assurance is present in three layers: local unit tests, Robolectric tests, and Android instrumented tests. There is also a screenshot test artifact, suggesting UI regression coverage is part of the project’s workflow.

12. The `assets/.aistudio` folder and `metadata.json` indicate this project was generated or managed through AI Studio tooling. That does not change runtime architecture, but it explains the repo scaffolding and the direct dependency on Gemini configuration.

Main entry points: [`app/src/main/java/com/example/MainActivity.kt`](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/MainActivity.kt) (MainActivity), [`app/src/main/java/com/example/ui/viewmodel/HealthViewModel.kt`](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/viewmodel/HealthViewModel.kt) (HealthViewModel), [`app/src/main/java/com/example/data/repository/HealthRepository.kt`](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/repository/HealthRepository.kt) (HealthRepository), [`app/src/main/java/com/example/ui/screens/SeniorPortalScreen.kt`](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/SeniorPortalScreen.kt) (Senior Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_mainactivity["MainActivity<br/>entry activity<br/>[MainActivity.kt]"]
  node_healthviewmodel["HealthViewModel<br/>state holder<br/>[HealthViewModel.kt]"]
  node_seniorportal["Senior Portal<br/>screen"]
  node_caregiverdash["Caregiver Dashboard<br/>screen"]
  node_appointments["Appointments<br/>screen"]
  node_messaging["Messaging<br/>screen<br/>[MessagingScreen.kt]"]
  node_videofeed["Video Feed<br/>screen<br/>[VideoFeedScreen.kt]"]
  node_aidiagnostics["AI Diagnostics<br/>screen"]
  node_theme["App Theme<br/>design system<br/>[Theme.kt]"]
end

subgraph group_data["Data"]
  node_healthrepo["HealthRepository"]
  node_appdb[("AppDatabase<br/>room database<br/>[AppDatabase.kt]")]
  node_entities["Entities<br/>data models<br/>[Entities.kt]"]
  node_gemini["Gemini API Client<br/>ai client<br/>[GeminiApiClient.kt]"]
end

subgraph group_project["Project"]
  node_build["Gradle Build<br/>build config<br/>[build.gradle.kts]"]
  node_resources["Android Resources"]
  node_env["Gemini Key<br/>env config<br/>[.env.example]"]
end

subgraph group_testing["Testing"]
  node_unit["Unit Tests<br/>test suite<br/>[ExampleUnitTest.kt]"]
  node_robolectric["Robolectric<br/>test suite"]
  node_screenshot["Screenshot Test<br/>ui regression"]
  node_instrumented["Instrumented Test<br/>android test"]
end

node_mainactivity -->|"hosts"| node_seniorportal
node_mainactivity -->|"hosts"| node_caregiverdash
node_mainactivity -->|"hosts"| node_appointments
node_mainactivity -->|"hosts"| node_messaging
node_mainactivity -->|"hosts"| node_videofeed
node_mainactivity -->|"hosts"| node_aidiagnostics
node_seniorportal -->|"reads/writes"| node_healthviewmodel
node_caregiverdash -->|"reads/writes"| node_healthviewmodel
node_appointments -->|"reads/writes"| node_healthviewmodel
node_messaging -->|"reads/writes"| node_healthviewmodel
node_videofeed -->|"reads/writes"| node_healthviewmodel
node_aidiagnostics -->|"reads/writes"| node_healthviewmodel
node_healthviewmodel -->|"delegates"| node_healthrepo
node_healthrepo -->|"uses"| node_appdb
node_healthrepo -->|"calls"| node_gemini
node_appdb -->|"maps"| node_entities
node_healthrepo -.->|"stores"| node_entities
node_healthrepo -.->|"configures"| node_env
node_theme -.->|"backs"| node_resources
node_unit -.->|"covers"| node_healthrepo
node_robolectric -.->|"covers"| node_mainactivity
node_screenshot -.->|"covers"| node_theme
node_instrumented -.->|"covers"| node_mainactivity

click node_mainactivity "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/MainActivity.kt"
click node_healthviewmodel "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/viewmodel/HealthViewModel.kt"
click node_seniorportal "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/SeniorPortalScreen.kt"
click node_caregiverdash "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/CaregiverDashboardScreen.kt"
click node_appointments "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/AppointmentsScreen.kt"
click node_messaging "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/MessagingScreen.kt"
click node_videofeed "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/VideoFeedScreen.kt"
click node_aidiagnostics "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/AiDiagnosticsScreen.kt"
click node_theme "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/theme/Theme.kt"
click node_healthrepo "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/repository/HealthRepository.kt"
click node_appdb "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/database/AppDatabase.kt"
click node_entities "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/model/Entities.kt"
click node_gemini "https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/network/GeminiApiClient.kt"
click node_build "https://github.com/tvijay333/ecarepro/blob/main/app/build.gradle.kts"
click node_resources "https://github.com/tvijay333/ecarepro/tree/main/app/src/main/res"
click node_env "https://github.com/tvijay333/ecarepro/blob/main/.env.example"
click node_unit "https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/ExampleUnitTest.kt"
click node_robolectric "https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/ExampleRobolectricTest.kt"
click node_screenshot "https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/GreetingScreenshotTest.kt"
click node_instrumented "https://github.com/tvijay333/ecarepro/blob/main/app/src/androidTest/java/com/example/ExampleInstrumentedTest.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mainactivity,node_healthviewmodel,node_seniorportal,node_caregiverdash,node_appointments,node_messaging,node_videofeed,node_aidiagnostics,node_theme toneBlue
class node_healthrepo,node_appdb,node_entities,node_gemini toneAmber
class node_build,node_resources,node_env toneMint
class node_unit,node_robolectric,node_screenshot,node_instrumented toneRose
```

## Components

### Presentation

App entry point, UI screens, theming, and view model

- [MainActivity](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/MainActivity.kt): entry activity · Android entry point that hosts the app UI and navigation root · `app/src/main/java/com/example/MainActivity.kt`
- [HealthViewModel](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/viewmodel/HealthViewModel.kt): state holder · Central UI state and action boundary between screens and data · `app/src/main/java/com/example/ui/viewmodel/HealthViewModel.kt`
- [Senior Portal](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/SeniorPortalScreen.kt): screen · Primary senior-focused experience · `app/src/main/java/com/example/ui/screens/SeniorPortalScreen.kt`
- [Caregiver Dashboard](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/CaregiverDashboardScreen.kt): screen · Caregiver-focused overview and coordination screen · `app/src/main/java/com/example/ui/screens/CaregiverDashboardScreen.kt`
- [Appointments](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/AppointmentsScreen.kt): screen · Scheduling and appointment management UI · `app/src/main/java/com/example/ui/screens/AppointmentsScreen.kt`
- [Messaging](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/MessagingScreen.kt): screen · Communication and chat UI · `app/src/main/java/com/example/ui/screens/MessagingScreen.kt`
- [Video Feed](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/VideoFeedScreen.kt): screen · Live or streamed monitoring feed UI · `app/src/main/java/com/example/ui/screens/VideoFeedScreen.kt`
- [AI Diagnostics](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/screens/AiDiagnosticsScreen.kt): screen · AI-assisted diagnostic and recommendation UI · `app/src/main/java/com/example/ui/screens/AiDiagnosticsScreen.kt`
- [App Theme](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/ui/theme/Theme.kt): design system · Shared colors, typography, and theme configuration · `app/src/main/java/com/example/ui/theme/Theme.kt`

### Data

Local persistence and external AI integration

- [HealthRepository](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/repository/HealthRepository.kt): repository · Main data orchestration layer for app state and requests · `app/src/main/java/com/example/data/repository/HealthRepository.kt`
- [AppDatabase](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/database/AppDatabase.kt): room database · Local on-device persistence boundary · `app/src/main/java/com/example/data/database/AppDatabase.kt`
- [Entities](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/model/Entities.kt): data models · Persistence entity definitions for stored health records · `app/src/main/java/com/example/data/model/Entities.kt`
- [Gemini API Client](https://github.com/tvijay333/ecarepro/blob/main/app/src/main/java/com/example/data/network/GeminiApiClient.kt): ai client · Outbound integration to Gemini for AI-powered features · `app/src/main/java/com/example/data/network/GeminiApiClient.kt`

### Project

Build, resources, and repo scaffolding

- [Gradle Build](https://github.com/tvijay333/ecarepro/blob/main/app/build.gradle.kts): build config · Android and Kotlin build configuration for the app module and project · `app/build.gradle.kts`
- [Android Resources](https://github.com/tvijay333/ecarepro/tree/main/app/src/main/res): resources · App assets, strings, themes, icons, and XML resources · `app/src/main/res`
- [Gemini Key](https://github.com/tvijay333/ecarepro/blob/main/.env.example): env config · Project-level environment setup for GEMINI_API_KEY · `.env.example`

### Testing

Unit, Robolectric, and instrumented test coverage

- [Unit Tests](https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/ExampleUnitTest.kt): test suite · Local JVM tests · `app/src/test/java/com/example/ExampleUnitTest.kt`
- [Robolectric](https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/ExampleRobolectricTest.kt): test suite · Android-like JVM test coverage · `app/src/test/java/com/example/ExampleRobolectricTest.kt`
- [Screenshot Test](https://github.com/tvijay333/ecarepro/blob/main/app/src/test/java/com/example/GreetingScreenshotTest.kt): ui regression · Visual regression coverage for UI output · `app/src/test/java/com/example/GreetingScreenshotTest.kt`
- [Instrumented Test](https://github.com/tvijay333/ecarepro/blob/main/app/src/androidTest/java/com/example/ExampleInstrumentedTest.kt): android test · Device or emulator-based integration test · `app/src/androidTest/java/com/example/ExampleInstrumentedTest.kt`

## Connections

- MainActivity → Senior Portal: hosts · Main activity composes the primary screen flow
- MainActivity → Caregiver Dashboard: hosts · Main activity can route into caregiver-facing views
- MainActivity → Appointments: hosts · Main activity exposes scheduling UI
- MainActivity → Messaging: hosts · Main activity exposes messaging UI
- MainActivity → Video Feed: hosts · Main activity exposes monitoring UI
- MainActivity → AI Diagnostics: hosts · Main activity exposes AI-assisted diagnostics UI
- Senior Portal → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- Caregiver Dashboard → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- Appointments → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- Messaging → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- Video Feed → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- AI Diagnostics → HealthViewModel: reads/writes · Screen observes state and sends actions through the view model
- HealthViewModel → HealthRepository: delegates · View model forwards business and data operations to repository
- HealthRepository → AppDatabase: uses · Repository reads and writes local persistent records
- HealthRepository → Gemini API Client: calls · Repository sends AI requests through the Gemini client
- AppDatabase → Entities: maps · Database persists entity definitions
- HealthRepository → Entities: stores · Repository works with persisted domain records
- HealthRepository → Gemini Key: configures · Gemini access depends on the project API key configuration
- App Theme → Android Resources: backs · Theme and design tokens align with app resources
- Unit Tests → HealthRepository: covers · Local tests validate repository behavior
- Robolectric → MainActivity: covers · Robolectric exercises Android-facing UI logic
- Screenshot Test → App Theme: covers · Visual regression checks the shared styling system
- Instrumented Test → MainActivity: covers · Instrumented tests validate runtime app behavior
