# prince-git-hub-360/depression-detection architecture

> Architecture diagram of the GitHub repository prince-git-hub-360/depression-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prince-git-hub-360/depression-detection
- Repository: https://github.com/prince-git-hub-360/depression-detection

## Overview

This proof-of-concept collects a user’s text, voice, and face data, derives sentiment, audio features, and facial emotion, then combines them into a rule-based depression score and status. It appends results to a CSV and displays recent history and scores in Streamlit. A separate script trains and evaluates a random-forest regressor from the log. The main workflow is implemented in one file, so its stages share a source path; the graph reflects operations visible in the excerpts, not separate modules.

Main entry points: [`depression.py`](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py) (Fusion score), [`PHQ.py`](https://github.com/prince-git-hub-360/depression-detection/blob/main/PHQ.py) (Log model evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["User assessment"]
  node_text["Text input<br/>[depression.py]"]
  node_audio["Voice recording<br/>[depression.py]"]
  node_camera["Face capture<br/>[depression.py]"]
end

subgraph group_analysis["Modality analysis"]
  node_text_analysis["Text sentiment<br/>[depression.py]"]
  node_voice_features["Voice features<br/>[depression.py]"]
  node_face_emotion["Facial emotion<br/>[depression.py]"]
end

subgraph group_results["Scoring and history"]
  node_score["Fusion score<br/>[depression.py]"]
  node_csv[("Depression log CSV<br/>[depression.py]")]
  node_dashboard["Streamlit history<br/>[depression.py]"]
end

subgraph group_evaluation["Log evaluation"]
  node_phq["Log model evaluation<br/>[PHQ.py]"]
end

node_user(("User"))
node_classifier["DistilBERT classifier"]
node_deepface["DeepFace"]

node_user -->|"enters text"| node_text
node_user -->|"provides voice"| node_audio
node_user -->|"faces camera"| node_camera
node_text -->|"validates and classifies"| node_text_analysis
node_text_analysis -->|"uses pipeline"| node_classifier
node_audio -->|"extracts features"| node_voice_features
node_camera -->|"analyzes image"| node_face_emotion
node_face_emotion -->|"uses analyzer"| node_deepface
node_text_analysis -->|"contributes labels"| node_score
node_voice_features -->|"contributes pitch and energy"| node_score
node_face_emotion -->|"contributes emotion"| node_score
node_score -->|"appends result"| node_csv
node_csv -->|"loads history"| node_dashboard
node_csv -->|"loads training data"| node_phq

click node_text "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_audio "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_camera "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_text_analysis "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_voice_features "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_face_emotion "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_score "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_csv "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_dashboard "https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py"
click node_phq "https://github.com/prince-git-hub-360/depression-detection/blob/main/PHQ.py"

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_text,node_audio,node_camera,node_user toneBlue
class node_text_analysis,node_voice_features,node_face_emotion toneAmber
class node_score,node_csv,node_dashboard toneMint
class node_phq toneRose
class node_classifier,node_deepface toneIndigo
```

## Components

### User assessment

- [Text input](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Voice recording](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Face capture](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`

### Modality analysis

- [Text sentiment](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Voice features](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Facial emotion](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`

### Scoring and history

- [Fusion score](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Depression log CSV](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`
- [Streamlit history](https://github.com/prince-git-hub-360/depression-detection/blob/main/depression.py): `depression.py`

### Log evaluation

- [Log model evaluation](https://github.com/prince-git-hub-360/depression-detection/blob/main/PHQ.py): `PHQ.py`

### Other components

- **User**
- **DistilBERT classifier**
- **DeepFace**

## Connections

- User → Text input: enters text (evidence: `depression.py`)
- User → Voice recording: provides voice (evidence: `depression.py`)
- User → Face capture: faces camera (evidence: `depression.py`)
- Text input → Text sentiment: validates and classifies (evidence: `depression.py`)
- Text sentiment → DistilBERT classifier: uses pipeline (evidence: `depression.py`)
- Voice recording → Voice features: extracts features (evidence: `depression.py`)
- Face capture → Facial emotion: analyzes image (evidence: `depression.py`)
- Facial emotion → DeepFace: uses analyzer (evidence: `depression.py`)
- Text sentiment → Fusion score: contributes labels (evidence: `depression.py`)
- Voice features → Fusion score: contributes pitch and energy (evidence: `depression.py`)
- Facial emotion → Fusion score: contributes emotion (evidence: `depression.py`)
- Fusion score → Depression log CSV: appends result (evidence: `depression.py`)
- Depression log CSV → Streamlit history: loads history (evidence: `depression.py`)
- Depression log CSV → Log model evaluation: loads training data (evidence: `PHQ.py`)
