How amirghari/task-beat works
Main System Components
• UI Layer: This includes all screens and Compose UI components as found in the “ui” package (e.g., screens such as HomeScreen, ChatScreen, HeartRateScreen, etc.) and the theme components.
• ViewModel Layer: Represented by various viewmodels (e.g., ChatViewModel, HeartRateViewModel, SignInViewModel, and home-related viewmodels) that manage the state and business logic for the UI.
• Data/Repository Layer: Illustrated by repositories in “data” (e.g., DataRepository, OfflineDataRepository) alongside the dependency injection management (AppContainer) that connects UI/viewmodels with data sources.
• Data Storage: Two main parts:
• Local Storage (Room Database) – encapsulating the Room database, DAOs (HealthDao, UserDao), and type converters.
• Remote Storage – using Firebase Firestore and Firebase Authentication for user data syncing and security.
• Network Layer: Includes network call logic such as the Retrofit creation for remote API interactions (e.g., ModelDownloadApi) and any external integrations.
• AI Module: Highlight the use of the Gemini Gemma-2-2B model for health recommendations and task suggestions, which may be coupled with data from both local and remote sources.
• Additional Components: Workers (e.g., FetchAndUpdateDBWorker) to handle background processes and any integration with Firebase Cloud Messaging for notifications.
Relationships and Data Flow
• UI components (screens) interacting with their corresponding ViewModels.
• ViewModels retrieving or updating data via the Repository.
• The Repository coordinating communication with both the local Room database and Firebase/remote services.
• The network layer connecting the Repository with external APIs (like for downloading models or AI data).
• The background worker interacting with both the Repository and local storage to keep data in sync.
• AI integration feeding recommendations back into the Repository and ViewModel, influencing UI presentation.
Architectural Patterns
• Repository Pattern: Emphasize how data management is abstracted away from the UI, providing a single unified interface over local database and remote APIs.
• Dependency Injection: Indicate how components like AppContainer are used to inject dependencies into various modules.
Relevant Technologies and Frameworks
• Use labels for each component such as “Jetpack Compose UI”, “Android ViewModel with LiveData”, “Room Database”, “Firebase Authentication/Firestore”, “Retrofit for API calls”, and “Gemini Gemma-2-2B (AI Integration)”.