# sonalipandey2007/psychological-assistance-well-being-system architecture

> Architecture diagram of the GitHub repository sonalipandey2007/psychological-assistance-well-being-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sonalipandey2007/psychological-assistance-well-being-system
- Repository: https://github.com/sonalipandey2007/psychological-assistance-well-being-system

## Overview

PAWS is a Flask backend for victim check-ins, distress screening, case tracking, and role-based officer and counsellor workflows. Victims submit check-ins; the victim routes gather history, invoke analysis, and persist scores and alerts. Staff routes retrieve risk and case information and record follow-up. The sampled source supports these route-to-analysis and route-to-database relationships; several route excerpts are partial, and the README is empty, so unsampled behavior is not inferred.

Main entry points: [`app.py`](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/app.py) (Flask application), [`database/db.py`](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/database/db.py) (Database access), [`routes/auth.py`](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/auth.py) (Authentication), [`routes/victim.py`](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/victim.py) (Victim workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_app["Flask application<br/>[app.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_protected_routes["Protected routes<br/>[protected.py]"]
end

subgraph group_screening["Victim screening"]
  node_victim_routes["Victim workflows<br/>[victim.py]"]
  node_distress["Distress engine<br/>[distress_engine.py]"]
  node_nlp["Text analysis<br/>[nlp_analysis.py]"]
  node_behaviour["Engagement analysis"]
end

subgraph group_cases["Case tracking"]
  node_case_routes["Case tracking<br/>[case.py]"]
end

subgraph group_staff["Staff workflows"]
  node_officer_routes["Officer workflows<br/>[officer.py]"]
  node_counsellor_routes["Counsellor workflows<br/>[counsellor.py]"]
end

subgraph group_storage["Persistence"]
  node_db_access["Database access<br/>[db.py]"]
  node_mysql[("MySQL database")]
end

node_victim_actor(("Victim"))
node_staff_actor(("Officer or counsellor"))

node_victim_actor -->|"submits requests"| node_app
node_staff_actor -->|"submits requests"| node_app
node_app -->|"registers"| node_victim_routes
node_app -->|"registers"| node_case_routes
node_app -->|"registers"| node_auth
node_app -->|"registers"| node_protected_routes
node_app -->|"registers"| node_officer_routes
node_app -->|"registers"| node_counsellor_routes
node_victim_routes -->|"uses guards"| node_auth
node_officer_routes -->|"uses guards"| node_auth
node_counsellor_routes -->|"uses guards"| node_auth
node_auth -->|"queries users"| node_db_access
node_victim_routes -->|"analyzes check-in"| node_distress
node_distress -->|"analyzes text"| node_nlp
node_distress -->|"scores engagement"| node_behaviour
node_victim_routes -->|"reads and writes"| node_db_access
node_case_routes -->|"reads and writes"| node_db_access
node_officer_routes -->|"queries records"| node_db_access
node_counsellor_routes -->|"reads and updates"| node_db_access
node_protected_routes -->|"database access"| node_db_access
node_db_access -->|"connects"| node_mysql

click node_app "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/app.py"
click node_auth "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/auth.py"
click node_protected_routes "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/protected.py"
click node_victim_routes "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/victim.py"
click node_distress "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/distress_engine.py"
click node_nlp "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/nlp_analysis.py"
click node_behaviour "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/behaviour_analysis.py"
click node_case_routes "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/case.py"
click node_officer_routes "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/officer.py"
click node_counsellor_routes "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/counsellor.py"
click node_db_access "https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/database/db.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_app,node_auth,node_protected_routes toneBlue
class node_victim_routes,node_distress,node_nlp,node_behaviour toneAmber
class node_case_routes toneMint
class node_officer_routes,node_counsellor_routes toneRose
class node_db_access,node_mysql,node_victim_actor,node_staff_actor toneIndigo
```

## Components

### API and access

- [Flask application](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/app.py): `app.py`
- [Authentication](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/auth.py): `routes/auth.py`
- [Protected routes](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/protected.py): `routes/protected.py`

### Victim screening

- [Victim workflows](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/victim.py): `routes/victim.py`
- [Distress engine](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/distress_engine.py): `ai/distress_engine.py`
- [Text analysis](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/nlp_analysis.py): `ai/nlp_analysis.py`
- [Engagement analysis](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/ai/behaviour_analysis.py): `ai/behaviour_analysis.py`

### Case tracking

- [Case tracking](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/case.py): `routes/case.py`

### Staff workflows

- [Officer workflows](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/officer.py): `routes/officer.py`
- [Counsellor workflows](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/routes/counsellor.py): `routes/counsellor.py`

### Persistence

- [Database access](https://github.com/sonalipandey2007/psychological-assistance-well-being-system/blob/main/database/db.py): `database/db.py`
- **MySQL database**

### Other components

- **Victim**
- **Officer or counsellor**

## Connections

- Victim → Flask application: submits requests
- Officer or counsellor → Flask application: submits requests
- Flask application → Victim workflows: registers
- Flask application → Case tracking: registers
- Flask application → Authentication: registers
- Flask application → Protected routes: registers
- Flask application → Officer workflows: registers
- Flask application → Counsellor workflows: registers
- Victim workflows → Authentication: uses guards
- Officer workflows → Authentication: uses guards
- Counsellor workflows → Authentication: uses guards
- Authentication → Database access: queries users
- Victim workflows → Distress engine: analyzes check-in
- Distress engine → Text analysis: analyzes text
- Distress engine → Engagement analysis: scores engagement
- Victim workflows → Database access: reads and writes
- Case tracking → Database access: reads and writes
- Officer workflows → Database access: queries records
- Counsellor workflows → Database access: reads and updates
- Protected routes → Database access: database access
- Database access → MySQL database: connects
