# mohammad-zaben/human_rights_monitor architecture

> Architecture diagram of the GitHub repository mohammad-zaben/human_rights_monitor, 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/mohammad-zaben/human_rights_monitor
- Repository: https://github.com/mohammad-zaben/human_rights_monitor

## Overview

Human Rights Monitor is a FastAPI backend for submitting and managing human-rights incident reports, victims and witnesses, cases, and user accounts. The principal workflow is an API client submitting a report or case; the relevant route validates the payload, stores uploaded evidence, generates an identifier, and persists the record in MongoDB. Authenticated users can query and update records, while case workflows include lawyer assignment and status tracking. README capabilities for users and victim/witness resources are represented, though their route implementations were not sampled.

Main entry points: [`app/database.py`](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/database.py) (MongoDB access), [`app/main.py`](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/main.py) (FastAPI app), [`app/routes/cases.py`](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/cases.py) (Case management), [`app/routes/incident_report.py`](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/incident_report.py) (Incident reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry and auth"]
  node_main["FastAPI app<br/>[main.py]"]
  node_authroutes["Auth routes<br/>[auth.py]"]
  node_oauth["Token validation<br/>[oauth.py]"]
  node_jwt["JWT utilities<br/>[jwt.py]"]
  node_hashing["Password hashing<br/>[hashing.py]"]
end

subgraph group_records["Monitoring records"]
  node_cases["Case management<br/>[cases.py]"]
  node_case_model["Case schema<br/>[cases.py]"]
  node_reports["Incident reports<br/>[incident_report.py]"]
  node_report_model["Report schema<br/>[incident_report.py]"]
  node_evidence["Evidence uploads<br/>[evidence.py]"]
  node_incident_model["Incident data schema<br/>[incident_report.py]"]
end

subgraph group_identity["Users and people"]
  node_users["User management<br/>[users.py]"]
  node_user_model["User schema<br/>[users.py]"]
  node_people["Victim witness records<br/>[victim_witness.py]"]
  node_people_model["Victim witness schema<br/>[victim_witness.py]"]
end

subgraph group_persistence["Persistence and evidence"]
  node_db[("MongoDB access<br/>[database.py]")]
  node_ids["ID generation<br/>[id_genarator.py]"]
  node_cloudinary["Cloudinary setup"]
end

node_client(("API client"))
node_mongo[("MongoDB")]
node_media[("Cloudinary")]

node_client -->|"sends requests"| node_main
node_main -->|"routes auth"| node_authroutes
node_main -->|"routes users"| node_users
node_main -->|"routes cases"| node_cases
node_main -->|"routes reports"| node_reports
node_main -->|"routes people"| node_people
node_main -->|"connects at startup"| node_db
node_authroutes -->|"reads users"| node_db
node_authroutes -->|"verifies password"| node_hashing
node_authroutes -->|"creates token"| node_jwt
node_oauth -->|"verifies token"| node_jwt
node_cases -->|"validates identity"| node_oauth
node_reports -->|"validates identity"| node_oauth
node_users -->|"validates identity"| node_oauth
node_people -->|"validates identity"| node_oauth
node_cases -->|"validates cases"| node_case_model
node_reports -->|"validates reports"| node_report_model
node_cases -->|"stores uploads"| node_evidence
node_reports -->|"stores uploads"| node_evidence
node_cases -->|"generates case ID"| node_ids
node_reports -->|"generates report ID"| node_ids
node_cases -->|"reads and writes"| node_db
node_reports -->|"reads and writes"| node_db
node_users -->|"reads and writes"| node_db
node_people -->|"reads and writes"| node_db
node_evidence -->|"stores metadata"| node_db
node_ids -->|"updates counters"| node_db
node_db -->|"queries"| node_mongo
node_cloudinary -.->|"configures integration"| node_media
node_evidence -.->|"may use"| node_cloudinary

click node_main "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/main.py"
click node_authroutes "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/auth.py"
click node_oauth "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/oauth.py"
click node_jwt "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/jwt.py"
click node_hashing "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/hashing.py"
click node_cases "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/cases.py"
click node_case_model "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/cases.py"
click node_reports "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/incident_report.py"
click node_report_model "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/incident_report.py"
click node_evidence "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/evidence.py"
click node_users "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/users.py"
click node_user_model "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/users.py"
click node_people "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/victim_witness.py"
click node_people_model "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/victim_witness.py"
click node_incident_model "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/incident_report.py"
click node_db "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/database.py"
click node_ids "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/services/id_genarator.py"
click node_cloudinary "https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/services/cloudinary_config.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_main,node_authroutes,node_oauth,node_jwt,node_hashing,node_client toneBlue
class node_cases,node_case_model,node_reports,node_report_model,node_evidence,node_incident_model,node_mongo,node_media toneAmber
class node_users,node_user_model,node_people,node_people_model toneMint
class node_db,node_ids,node_cloudinary toneRose
```

## Components

### API entry and auth

- [FastAPI app](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/main.py): `app/main.py`
- [Auth routes](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/auth.py): `app/routes/auth.py`
- [Token validation](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/oauth.py): `app/auth/oauth.py`
- [JWT utilities](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/jwt.py): `app/auth/jwt.py`
- [Password hashing](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/auth/hashing.py): `app/auth/hashing.py`

### Monitoring records

- [Case management](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/cases.py): `app/routes/cases.py`
- [Case schema](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/cases.py): `app/models/cases.py`
- [Incident reports](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/incident_report.py): `app/routes/incident_report.py`
- [Report schema](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/incident_report.py): `app/models/incident_report.py`
- [Evidence uploads](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/evidence.py): `app/routes/evidence.py`
- [Incident data schema](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/incident_report.py): `app/models/incident_report.py`

### Users and people

- [User management](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/users.py): `app/routes/users.py`
- [User schema](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/users.py): `app/models/users.py`
- [Victim witness records](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/routes/victim_witness.py): `app/routes/victim_witness.py`
- [Victim witness schema](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/models/victim_witness.py): `app/models/victim_witness.py`

### Persistence and evidence

- [MongoDB access](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/database.py): `app/database.py`
- [ID generation](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/services/id_genarator.py): `app/services/id_genarator.py`
- [Cloudinary setup](https://github.com/mohammad-zaben/human_rights_monitor/blob/master/app/services/cloudinary_config.py): `app/services/cloudinary_config.py`

### Other components

- **API client**
- **MongoDB**
- **Cloudinary**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → Auth routes: routes auth
- FastAPI app → User management: routes users
- FastAPI app → Case management: routes cases
- FastAPI app → Incident reports: routes reports
- FastAPI app → Victim witness records: routes people
- FastAPI app → MongoDB access: connects at startup
- Auth routes → MongoDB access: reads users
- Auth routes → Password hashing: verifies password
- Auth routes → JWT utilities: creates token
- Token validation → JWT utilities: verifies token
- Case management → Token validation: validates identity
- Incident reports → Token validation: validates identity
- User management → Token validation: validates identity
- Victim witness records → Token validation: validates identity
- Case management → Case schema: validates cases
- Incident reports → Report schema: validates reports
- Case management → Evidence uploads: stores uploads
- Incident reports → Evidence uploads: stores uploads
- Case management → ID generation: generates case ID
- Incident reports → ID generation: generates report ID
- Case management → MongoDB access: reads and writes
- Incident reports → MongoDB access: reads and writes
- User management → MongoDB access: reads and writes
- Victim witness records → MongoDB access: reads and writes
- Evidence uploads → MongoDB access: stores metadata
- ID generation → MongoDB access: updates counters
- MongoDB access → MongoDB: queries
- Cloudinary setup → Cloudinary: configures integration
- Evidence uploads → Cloudinary setup: may use
