# tylercarberry/ptsd-aid architecture

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

- Interactive diagram: https://gitdiagram.com/tylercarberry/ptsd-aid
- Repository: https://github.com/tylercarberry/ptsd-aid

## Overview

##### Main Components

a. Client-Side (Android App)
- UI Layer
- Main Activity (MainActivity.java)
- Fragment Components (MainFragment, PTSDTestFragment, ResourcesFragment, etc.)
- Dialog Components (FeedbackDialog, RatingDialog)

b. Core Features
- PTSD Test Module
- Resources Module
- VA Facilities Module
- News Module
- Trusted Contact System

c. External Services
- VA API Integration (VaClient)
- News Service Integration (NewsClient)
- Firebase Services
- Remote Config
- Cloud Messaging

##### Architecture Patterns to Highlight

- Dependency Injection (Show PtsdComponent and related modules)
- Fragment-based Navigation
- Database Systems (PhoneDatabase, WebsiteDatabase)
- Service Layer (PtsdMessagingService)

**┌─ User Interface Layer ─────────────────────────┐**
- Activities → Fragments → Dialogs → Adapters    │
- Feature Modules ───────────────────────────────┤
- PTSD Test │ Resources │ VA Facilities │ News   │
- Core Services ────────────────────────────────┤
- Dependency Injection │ Remote Config │ Utils   │
- Data Layer ──────────────────────────────────┤
- Phone DB │ Website DB │ Preferences           │
- External Services ─────────────────────────────┤
- VA API │ News Service │ Firebase              │
- ┘

##### Important Relationships

- Navigation flow between fragments
- Data flow from VA API to facilities display
- News service integration
- Firebase service connections
- Database interactions
- Dependency injection relationships

##### Implementation Details

- Maintain a hierarchical layout for clear visualization
- Version information and build configuration
- Integration with CircleCI for continuous integration

Remember to include annotations for key architectural decisions and any scalability considerations for future feature additions.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef feature fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#f1c40f,stroke:#f39c12,color:black
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    
    %% UI Layer
    subgraph UI
        MainActivity["MainActivity"]:::ui
        MainFragment["Main Fragment"]:::ui
        PTSDTestFragment["PTSD Test Fragment"]:::ui
        ResourcesFragment["Resources Fragment"]:::ui
        Dialogs["Dialog Components"]:::ui
    end
    
    %% Feature Modules
    subgraph Features
        PTSDTest["PTSD Test Module"]:::feature
        Resources["Resources Module"]:::feature
        VAFacilities["VA Facilities Module"]:::feature
        News["News Module"]:::feature
        TrustedContact["Trusted Contact System"]:::feature
    end
    
    %% Core Services
    subgraph Core
        DI["Dependency Injection"]:::core
        RemoteConfig["Remote Config"]:::core
        Utils["Utilities"]:::core
        Settings["Settings System"]:::core
    end
    
    %% Data Layer
    subgraph Data
        PhoneDB[(Phone Database)]:::data
        WebsiteDB[(Website Database)]:::data
    end
    
    %% External Services
    subgraph External
        VaClient["VA API Client"]:::external
        NewsClient["News Service Client"]:::external
        Firebase["Firebase Services"]:::external
    end
    
    %% Relationships
    MainActivity --> MainFragment
    MainActivity --> PTSDTestFragment
    MainActivity --> ResourcesFragment
    MainActivity --> Dialogs
    
    PTSDTestFragment --> PTSDTest
    ResourcesFragment --> Resources
    Resources --> WebsiteDB
    VAFacilities --> VaClient
    News --> NewsClient
    
    DI --> MainActivity
    DI --> PTSDTest
    DI --> Resources
    DI --> VAFacilities
    DI --> News
    
    Firebase --> RemoteConfig
    TrustedContact --> PhoneDB
    
    %% Click Events
    click MainActivity "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/MainActivity.java"
    click PTSDTestFragment "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/fragments/PTSDTestFragment.java"
    click ResourcesFragment "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/fragments/ResourcesFragment.java"
    click VAFacilities "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/va/facility/"
    click News "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/va/news/"
    click VaClient "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/va/facility/VaClient.java"
    click NewsClient "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/va/news/NewsClient.java"
    click Firebase "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/network/PtsdMessagingService.java"
    click RemoteConfig "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/network/RemoteConfig.java"
    click DI "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/injection/"
    click PhoneDB "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/support/phone/PhoneDatabase.java"
    click WebsiteDB "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/java/com/tytanapps/ptsd/support/website/WebsiteDatabase.java"
    click Settings "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/settings/"
    click TrustedContact "https://github.com/TylerCarberry/PTSD-Aid/blob/master/app/src/main/res/layout/change_trusted_contact_layout.xml"
    click Dialogs "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/dialog/"
    click Utils "https://github.com/TylerCarberry/PTSD-Aid/tree/master/app/src/main/java/com/tytanapps/ptsd/utils/"
```
