# amirchoudhary09/check_your_mental_health architecture

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

- Interactive diagram: https://gitdiagram.com/amirchoudhary09/check_your_mental_health
- Repository: https://github.com/amirchoudhary09/check_your_mental_health

## Overview

##### Project Type & Purpose
- This is a **native Android mobile app** implementing an MVVM architecture.
- Purpose: provide mental-health services via AI chat, quizzes, 1:1 sessions with licensed psychologists, and ad-supported revenue.

##### File Structure & Code Patterns
- Single Gradle module (“app”) with standard Android hierarchy under `src/main/java` and `src/main/res`.
- Packages:
- `Authentication` (login, signup, password recovery)
- `Test` (quiz flows)
- `appointmentsRV`, `doctorsRV`, `workshopsRV` (RecyclerView adapters & data models)
- Activities & Fragments (entry points, navigation)
- MVVM: UI layer (Activities/Fragments) ↔ ViewModels (not explicit packages but implied) ↔ Data layer (Firebase).

##### Key Services & External Dependencies
- **Firebase Authentication**: email/OAuth login & user management.
- **Firebase Realtime Database**: chat messages, appointment schedules.
- **AI Chatbot Service**: an external ML/REST API for conversational support.
- **Google Ads SDK**: ad retrieval/display.
- **Real-Time Specialist Interaction**: likely WebSockets or Firebase Cloud Messaging for notifications.
- **Protected Resources**: data-extraction & backup XML rules.

##### Main Components & Their Relationships
- Mobile App
- Presentation Layer: Activities & Fragments
- ViewModel Layer: state holders, business logic
- Repository/Data Layer: interfaces to Firebase & AI service
- Firebase
- Auth Module
- Realtime Database
- Cloud Messaging (notifications)
- External AI Chatbot API
- Psychologist Scheduling Backend (could be part of Firebase or a separate microservice)
- Google Ads Service
- Local Persistence (e.g., SharedPreferences or local DB – implied by data‐extraction rules)

##### Architectural Patterns & Design Principles
- **MVVM**: clear separation of concerns.
- **Repository Pattern**: abstract data-source access (Firebase, AI, local).
- **Dependency Injection** (if used – look for Hilt/Dagger).
- **RecyclerViews** for listing doctors, appointments, workshops.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile App Layers
    subgraph "Mobile App"
        subgraph "Presentation Layer" 
            MainActivity["MainActivity"]:::frontend
            FirstFragment["FirstFragment"]:::frontend
            SecondFragment["SecondFragment"]:::frontend
            ThirdFragment["ThirdFragment"]:::frontend
            AIActivity["AIActivity"]:::frontend
            NotificationsActivity["NotificationsActivity"]:::frontend
            ProfileActivity["ProfileActivity"]:::frontend
            ProgressActivity["ProgressActivity"]:::frontend
            SplashScreen["SplashScreen"]:::frontend
            Login["Login"]:::frontend
            SignUp["SignUp"]:::frontend
            ForgetPassword["ForgetPassword"]:::frontend
            TestMainActivity["TestMainActivity"]:::frontend
            TestInstructions["TestInstructions"]:::frontend
            AppointmentsAdapter["AppointmentsAdapter"]:::frontend
            DoctorsAdapter["DoctorsAdapter"]:::frontend
            WorkshopsAdapter["WorkshopsAdapter"]:::frontend
            MainActivityDoctors["MainActivityDoctors"]:::frontend
        end
        subgraph "ViewModel Layer"
            ViewModels["ViewModels"]:::frontend
        end
        subgraph "Repository Layer"
            Repository["Repository"]:::frontend
            GoogleServicesJson["google-services.json"]:::local
            AndroidManifest["AndroidManifest.xml"]:::local
            BackupRules["backup_rules.xml"]:::local
            DataExtractionRules["data_extraction_rules.xml"]:::local
            BuildGradle["build.gradle.kts"]:::local
        end
    end

    %% Firebase Services
    subgraph "Firebase"
        Auth["Firebase Auth Module"]:::firebase
        RealtimeDB["Realtime Database"]:::firebase
        FCM["Cloud Messaging"]:::firebase
    end

    %% External Services
    subgraph "External Services"
        AIChat["AI Chatbot Service"]:::external
        AdsSDK["Google Ads SDK"]:::external
        SchedulingBackend["Scheduling Backend"]:::external
    end

    %% Local Persistence
    LocalDB["Local Persistence"]:::local

    %% Connections
    MainActivity -->|uses| ViewModels
    FirstFragment -->|uses| ViewModels
    SecondFragment -->|uses| ViewModels
    ThirdFragment -->|uses| ViewModels
    AIActivity -->|uses| ViewModels
    NotificationsActivity -->|uses| ViewModels
    ProfileActivity -->|uses| ViewModels
    ProgressActivity -->|uses| ViewModels
    SplashScreen -->|uses| ViewModels
    Login -->|uses| ViewModels
    SignUp -->|uses| ViewModels
    ForgetPassword -->|uses| ViewModels
    TestMainActivity -->|uses| ViewModels
    TestInstructions -->|uses| ViewModels
    AppointmentsAdapter -->|uses| ViewModels
    DoctorsAdapter -->|uses| ViewModels
    WorkshopsAdapter -->|uses| ViewModels
    MainActivityDoctors -->|uses| ViewModels

    ViewModels -->|calls| Repository
    Repository -->|via Firebase SDK| Auth
    Repository -->|via Firebase SDK| RealtimeDB
    Repository -->|via Firebase SDK| FCM
    Repository -->|HTTPS REST| AIChat
    Repository -->|SDK| AdsSDK
    Repository -->|HTTPS REST| SchedulingBackend
    Repository -->|stores| LocalDB

    %% Click Events
    click MainActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/MainActivity.kt"
    click FirstFragment "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/FirstFragment.kt"
    click SecondFragment "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/SecondFragment.kt"
    click ThirdFragment "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/ThirdFragment.kt"
    click AIActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/AIActivity.kt"
    click NotificationsActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/NotificationsActivity.kt"
    click ProfileActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/ProfileActivity.kt"
    click ProgressActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/ProgressActivity.kt"
    click SplashScreen "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/SplashScreen.kt"
    click Login "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/Authentication/Login.kt"
    click SignUp "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/Authentication/SignUp.kt"
    click ForgetPassword "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/Authentication/Forgetpassword.kt"
    click TestMainActivity "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/Test/TestMainActivity.kt"
    click TestInstructions "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/Test/TestInstructions.kt"
    click AppointmentsAdapter "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/appointmentsRV/AppointmentsAdapter.kt"
    click DoctorsAdapter "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/doctorsRV/DoctorsAdapter.kt"
    click WorkshopsAdapter "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/workshopsRV/WorkshopsAdapter.kt"
    click MainActivityDoctors "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/java/com/example/homescreen/doctorsRV/MainActivityDoctors.kt"
    click GoogleServicesJson "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/google-services.json"
    click AndroidManifest "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/AndroidManifest.xml"
    click BackupRules "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/res/xml/backup_rules.xml"
    click DataExtractionRules "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/src/main/res/xml/data_extraction_rules.xml"
    click BuildGradle "https://github.com/amirchoudhary09/check_your_mental_health/blob/master/app/build.gradle.kts"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef firebase fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#90EE90,stroke:#333,stroke-width:1px
    classDef local fill:#D3D3D3,stroke:#333,stroke-width:1px
```
