# mythh0/detect-your-digital-addiction-and-risk architecture

> Architecture diagram of the GitHub repository mythh0/detect-your-digital-addiction-and-risk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mythh0/detect-your-digital-addiction-and-risk
- Repository: https://github.com/mythh0/detect-your-digital-addiction-and-risk

## Overview

DigitDetox gathers laptop and Android usage data, optionally tracks facial emotion, and presents device analytics and an addiction-risk estimate through a dashboard. The Flask API accepts bridge data, combines live data with demo defaults, and calls the classifier; a separate endpoint supports manual prediction. The README also describes a dark-mode schedule. The dashboard source was not excerpted, so its API connections are documented only at a high level; emotion-tracker posting details were likewise not shown.

Main entry points: [`app.py`](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/app.py) (Flask API), [`laptop_bridge.py`](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/laptop_bridge.py) (Laptop monitor), [`phone_bridge.py`](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/phone_bridge.py) (Phone monitor), [`index.html`](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/index.html) (Wellness dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_laptop_bridge["Laptop monitor<br/>[laptop_bridge.py]"]
  node_phone_bridge["Phone monitor<br/>[phone_bridge.py]"]
  node_emotion["Emotion tracker<br/>[emotion_tracker.py]"]
end

subgraph group_backend["Analysis backend"]
  node_api["Flask API<br/>[app.py]"]
  node_risk_model["Risk classifier<br/>[model.py]"]
  node_schedule["Dark-mode schedule<br/>[app.py]"]
end

subgraph group_experience["User experience"]
  node_dashboard["Wellness dashboard<br/>[index.html]"]
end

node_user(("User"))
node_laptop["Laptop device"]
node_android["Android phone"]

node_laptop -->|"provides activity"| node_laptop_bridge
node_android -->|"provides activity"| node_phone_bridge
node_laptop_bridge -->|"posts metrics"| node_api
node_phone_bridge -->|"posts metrics"| node_api
node_emotion -.->|"posts emotion"| node_api
node_api -->|"trains and predicts"| node_risk_model
node_user -->|"views insights"| node_dashboard
node_dashboard -.->|"requests analytics"| node_api
node_user -->|"configures schedule"| node_schedule

click node_laptop_bridge "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/laptop_bridge.py"
click node_phone_bridge "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/phone_bridge.py"
click node_emotion "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/emotion_tracker.py"
click node_api "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/app.py"
click node_risk_model "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/model.py"
click node_dashboard "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/index.html"
click node_schedule "https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/app.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_laptop_bridge,node_phone_bridge,node_emotion,node_user toneBlue
class node_api,node_risk_model,node_schedule toneAmber
class node_dashboard toneMint
class node_laptop,node_android toneIndigo
```

## Components

### Data collection

- [Laptop monitor](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/laptop_bridge.py): `laptop_bridge.py`
- [Phone monitor](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/phone_bridge.py): `phone_bridge.py`
- [Emotion tracker](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/emotion_tracker.py): `emotion_tracker.py`

### Analysis backend

- [Flask API](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/app.py): `app.py`
- [Risk classifier](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/model.py): `model.py`
- [Dark-mode schedule](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/app.py): `app.py`

### User experience

- [Wellness dashboard](https://github.com/mythh0/detect-your-digital-addiction-and-risk/blob/main/index.html): `index.html`

### Other components

- **User**
- **Laptop device**
- **Android phone**

## Connections

- Laptop device → Laptop monitor: provides activity (evidence: `laptop_bridge.py`)
- Android phone → Phone monitor: provides activity (evidence: `phone_bridge.py`)
- Laptop monitor → Flask API: posts metrics (evidence: `laptop_bridge.py`)
- Phone monitor → Flask API: posts metrics (evidence: `phone_bridge.py`)
- Emotion tracker → Flask API: posts emotion
- Flask API → Risk classifier: trains and predicts (evidence: `app.py`)
- User → Wellness dashboard: views insights (evidence: `README.md`)
- Wellness dashboard → Flask API: requests analytics
- User → Dark-mode schedule: configures schedule (evidence: `app.py`)
