# josejimenez-m/mentalcareapp architecture

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

- Interactive diagram: https://gitdiagram.com/josejimenez-m/mentalcareapp
- Repository: https://github.com/josejimenez-m/mentalcareapp

## Overview

##### Main components
- UI Layer: This includes the user-facing components such as ViewControllers, Storyboards (e.g., Main.storyboard, LaunchScreen.storyboard), and UI assets. Separate modules exist in the file tree:
- Regular User Modules: For daily logging (ViewController.swift, ViewController_Add.swift), daily quotes, and the streak tracker (StreakManager.swift, StreakViewController.swift).
- Emergency and Guided Assistance Modules: Under the PanicButton folder (PanicViewController.swift and BreathingViewController.swift) for emergency contact and guided breathing exercises.

- Application Lifecycle & Configuration: These are represented by AppDelegate.swift, SceneDelegate.swift, and Info.plist — handling application configuration, state management, and system interactions.

##### Relationships and interactions
- The UI Layer interacts with underlying logic (e.g., StreakManager) that supports features like streak tracking.
- The separate view controllers (for logging, panic functionality, and administrative data visualization) interact through navigation controllers or segues as defined in storyboards, showing the modularity.
- It is likely organized following an MVC pattern where:
- Models (not directly visible in the file tree) would store or represent user data (like daily emotion logs),
- Views are defined in Storyboards and assets,
- Controllers (ViewControllers, custom manager files) handle the user interface logic.

##### Architectural patterns and design principles
- MVC or similar iOS design paradigms (possibly a blend with MVVM) are implied by the separation of controllers, dedicated functional modules (AdminFunc, PanicButton, Streak), and UI resources.
- Integration with external services: While no explicit backend API or external service integration is shown in the file tree, the README directs us to a demo and outlines features which could suggest future integration points (for instance, making emergency calls).

##### Relevant technologies
- Language and Framework: Swift, along with either SwiftUI or UIKit as the primary UI framework.
- IDE: Xcode, which influences project structure.
- Version Control: Git, although not visible directly in the tree (but worth noting for development practices).

- Modules/Components: Create distinct blocks or nodes for each major component:
- Application Core (AppDelegate, SceneDelegate, and configuration files)
- User Interface Modules:
- Daily Log & User Activity (ViewController, ViewController_Add, and Streak related files)
- Panic Button & Breathing Exercise module (PanicViewController, BreathingViewController)
- Psychologist Interface (AdminFunc folder: InteractionHistoryViewController, SentimentChartViewController, RecurringTopicsViewController, InteractionCell)
- Resources & Assets (Assets.xcassets, Storyboards)
- Data flows from the UI (user inputs) to processing components (manager classes like StreakManager)
- Navigation flows between different view controllers.
- Blue rectangles for UI components,
- Green for core application logic,
- Orange for administrative/psychologist functionalities,
- Grey for infrastructure/configuration elements.
- Notation should denote interactions (e.g., UI events triggering methods in controllers, view controllers orchestrating transitions among different modules).

- Shared resources, and if applicable, denote any communication between modules (even if abstracted as internal data passing).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Core"
        AAD["AppDelegate.swift"]:::core
        SSD["SceneDelegate.swift"]:::core
        Info["Info.plist"]:::core
    end

    subgraph "UI Layer"
        subgraph "Daily Log & User Activity"
            VC["ViewController.swift"]:::ui
            VCA["ViewController_Add.swift"]:::ui
        end
        subgraph "Streak Tracker"
            SM["StreakManager.swift"]:::ui
            SV["StreakViewController.swift"]:::ui
        end
        subgraph "Panic Button & Breathing Exercise"
            PV["PanicViewController.swift"]:::ui
            BV["BreathingViewController.swift"]:::ui
        end
        subgraph "Psychologist/Admin"
            IH["InteractionHistoryViewController.swift"]:::admin
            SC["SentimentChartViewController.swift"]:::admin
            RT["RecurringTopicsViewController.swift"]:::admin
            IC["InteractionCell.swift"]:::admin
        end
    end

    subgraph "Resources & UI Assets"
        Assets["Assets.xcassets"]:::res
        Base["Base.lproj (Storyboards)"]:::res
    end

    %% Connections
    AAD -->|"launches"| VC
    VC -->|"navigates"| VCA
    VC -->|"triggers"| SM
    SM -->|"updatesUI"| SV
    VC -->|"activates"| PV
    PV -->|"transitions"| BV
    VCA -->|"reports"| IH
    IH -->|"visualizes"| SC
    SC -->|"analyzes"| RT
    RT -->|"renders"| IC
    VC -->|"loads"| Base
    VC -->|"rendersUI"| Assets

    %% Styles
    classDef core fill:#98fb98,stroke:#000,stroke-width:2px;
    classDef ui fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef admin fill:#ffa500,stroke:#000,stroke-width:2px;
    classDef res fill:#d3d3d3,stroke:#000,stroke-width:2px;

    %% Click Events
    click AAD "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/AppDelegate.swift"
    click SSD "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/SceneDelegate.swift"
    click Info "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/Info.plist"
    click VC "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/ViewController.swift"
    click VCA "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/ViewController_Add.swift"
    click SM "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/Streak/StreakManager.swift"
    click SV "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/Streak/StreakViewController.swift"
    click PV "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/PanicButton/PanicViewController.swift"
    click BV "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/PanicButton/BreathingViewController.swift"
    click IH "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/AdminFunc/InteractionHistoryViewController.swift"
    click SC "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/AdminFunc/SentimentChartViewController.swift"
    click RT "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/AdminFunc/RecurringTopicsViewController.swift"
    click IC "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/AdminFunc/InteractionCell.swift"
    click Assets "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/Assets.xcassets"
    click Base "https://github.com/josejimenez-m/mentalcareapp/blob/main/TestAnalizer(JFL)/Base.lproj"
```
