# abdelrahmanmohmmed/complaints architecture

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

- Interactive diagram: https://gitdiagram.com/abdelrahmanmohmmed/complaints
- Repository: https://github.com/abdelrahmanmohmmed/complaints

## Overview

Feedback Management System provides role-based feedback management, channel integrations, dashboards and reports, with multilingual AI classification and prioritization. The main backend workflow is channel ingestion into feedback records, followed by scheduled preprocessing and AI analysis; users access management and analytics through the web application. The README documents the product capabilities and roles, while sampled backend sources show scheduling, ingestion and analysis. Several UI pages and backend routers are unsampled, so their detailed API interactions are not asserted.

Main entry points: [`backend/app/main.py`](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/main.py) (FastAPI application), [`backend/app/services/combined_service.py`](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/combined_service.py) (Scheduled analysis job), [`frontend/src/app/routes.ts`](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/routes.ts) (Role-based routes), [`backend/app/services/feedback_ingestion.py`](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/feedback_ingestion.py) (Channel ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes["Role-based routes<br/>[routes.ts]"]
  node_feedback_ui["Feedback views<br/>[FeedbackList.tsx]"]
  node_dashboard_ui["Dashboards<br/>[Dashboard.tsx]"]
  node_reports_ui["Reports<br/>[Reports.tsx]"]
  node_integrations_ui["Integration settings"]
  node_auth_context["Auth context<br/>[AuthContext.tsx]"]
  node_auth_service["Auth service<br/>[authService.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_router["Authentication routes<br/>[auth.py]"]
  node_feedback_router["Feedback routes<br/>[feedback.py]"]
  node_integration_router["Integration routes<br/>[integration.py]"]
  node_other_routes["Company and user routes"]
end

subgraph group_pipeline["Feedback processing"]
  node_ingestion["Channel ingestion"]
  node_email_fetch["Email fetching"]
  node_twitter_scrape["Twitter collection<br/>[scrap_twitter.py]"]
  node_combined["Scheduled analysis job"]
  node_preprocessing["Text preprocessing<br/>[router.py]"]
end

subgraph group_identity["Identity and data"]
  node_database[("PostgreSQL data<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
end

subgraph group_ml["AI analysis"]
  node_arabic_ai["Arabic predictor"]
  node_english_ai["English predictor"]
  node_priority["Priority scoring<br/>[priority.py]"]
end

node_user(("Product user"))
node_external_channels{{"Feedback platforms"}}

node_user -->|"uses"| node_routes
node_routes -->|"routes to"| node_feedback_ui
node_routes -->|"routes to"| node_dashboard_ui
node_routes -->|"routes to"| node_reports_ui
node_routes -->|"routes to"| node_integrations_ui
node_user -.->|"authenticates"| node_auth_context
node_auth_context -->|"calls"| node_auth_service
node_auth_service -->|"requests"| node_api_client
node_api_app -->|"registers"| node_auth_router
node_api_app -->|"registers"| node_feedback_router
node_api_app -->|"registers"| node_integration_router
node_api_app -->|"registers"| node_other_routes
node_api_app -->|"schedules"| node_ingestion
node_api_app -->|"schedules"| node_combined
node_integration_router -->|"invokes"| node_ingestion
node_integration_router -->|"invokes"| node_twitter_scrape
node_ingestion -->|"fetches feedback"| node_external_channels
node_ingestion -->|"uses"| node_email_fetch
node_ingestion -->|"deduplicates records"| node_models
node_combined -->|"queries and updates"| node_database
node_combined -->|"processes records"| node_models
node_combined -->|"preprocesses text"| node_preprocessing
node_combined -->|"predicts Arabic"| node_arabic_ai
node_combined -->|"predicts English"| node_english_ai
node_arabic_ai -->|"uses scoring"| node_priority
node_english_ai -->|"uses scoring"| node_priority
node_api_app -->|"creates schema"| node_database
node_auth_router -->|"queries users"| node_database
node_auth_router -->|"reads and updates"| node_models

click node_routes "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/routes.ts"
click node_feedback_ui "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/FeedbackList.tsx"
click node_dashboard_ui "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/Dashboard.tsx"
click node_reports_ui "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/Reports.tsx"
click node_integrations_ui "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/IntegrationSettings.tsx"
click node_auth_context "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/contexts/AuthContext.tsx"
click node_auth_service "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/services/authService.ts"
click node_api_client "https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/services/api.ts"
click node_api_app "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/main.py"
click node_auth_router "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/auth.py"
click node_feedback_router "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/feedback.py"
click node_integration_router "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/integration.py"
click node_other_routes "https://github.com/abdelrahmanmohmmed/complaints/tree/master/backend/app/routers"
click node_ingestion "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/feedback_ingestion.py"
click node_email_fetch "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/get_email_messages.py"
click node_twitter_scrape "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/scrap_twitter.py"
click node_combined "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/combined_service.py"
click node_preprocessing "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/preprocessing/router.py"
click node_database "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/database.py"
click node_models "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/models.py"
click node_arabic_ai "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/arabic_predictor.py"
click node_english_ai "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/english_predictor.py"
click node_priority "https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/priority.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_routes,node_feedback_ui,node_dashboard_ui,node_reports_ui,node_integrations_ui,node_auth_context,node_auth_service,node_api_client,node_user toneBlue
class node_api_app,node_auth_router,node_feedback_router,node_integration_router,node_other_routes toneAmber
class node_ingestion,node_email_fetch,node_twitter_scrape,node_combined,node_preprocessing toneMint
class node_database,node_models toneRose
class node_arabic_ai,node_english_ai,node_priority,node_external_channels toneIndigo
```

## Components

### Web application

- [Role-based routes](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/routes.ts): `frontend/src/app/routes.ts`
- [Feedback views](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/FeedbackList.tsx): `frontend/src/app/pages/FeedbackList.tsx`
- [Dashboards](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/Dashboard.tsx): `frontend/src/app/pages/Dashboard.tsx`
- [Reports](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/Reports.tsx): `frontend/src/app/pages/Reports.tsx`
- [Integration settings](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/pages/IntegrationSettings.tsx): `frontend/src/app/pages/IntegrationSettings.tsx`
- [Auth context](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/app/contexts/AuthContext.tsx): `frontend/src/app/contexts/AuthContext.tsx`
- [Auth service](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [API client](https://github.com/abdelrahmanmohmmed/complaints/blob/master/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [FastAPI application](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Feedback routes](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/feedback.py): `backend/app/routers/feedback.py`
- [Integration routes](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/routers/integration.py): `backend/app/routers/integration.py`
- [Company and user routes](https://github.com/abdelrahmanmohmmed/complaints/tree/master/backend/app/routers): `backend/app/routers`

### Feedback processing

- [Channel ingestion](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/feedback_ingestion.py): `backend/app/services/feedback_ingestion.py`
- [Email fetching](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/get_email_messages.py): `backend/app/services/get_email_messages.py`
- [Twitter collection](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/scrap_twitter.py): `backend/app/services/scrap_twitter.py`
- [Scheduled analysis job](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/services/combined_service.py): `backend/app/services/combined_service.py`
- [Text preprocessing](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/preprocessing/router.py): `backend/app/preprocessing/router.py`

### Identity and data

- [PostgreSQL data](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/database.py): `backend/app/database.py`
- [Domain records](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/models.py): `backend/app/models.py`

### AI analysis

- [Arabic predictor](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/arabic_predictor.py): `backend/app/ai/arabic_predictor.py`
- [English predictor](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/english_predictor.py): `backend/app/ai/english_predictor.py`
- [Priority scoring](https://github.com/abdelrahmanmohmmed/complaints/blob/master/backend/app/ai/priority.py): `backend/app/ai/priority.py`

### Other components

- **Product user**
- **Feedback platforms**

## Connections

- Product user → Role-based routes: uses (evidence: `frontend/src/app/routes.ts`)
- Role-based routes → Feedback views: routes to (evidence: `frontend/src/app/routes.ts`)
- Role-based routes → Dashboards: routes to (evidence: `frontend/src/app/routes.ts`)
- Role-based routes → Reports: routes to (evidence: `frontend/src/app/routes.ts`)
- Role-based routes → Integration settings: routes to (evidence: `frontend/src/app/routes.ts`)
- Product user → Auth context: authenticates
- Auth context → Auth service: calls (evidence: `frontend/src/app/contexts/AuthContext.tsx`)
- Auth service → API client: requests (evidence: `frontend/src/services/authService.ts`)
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Feedback routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Integration routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Company and user routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Channel ingestion: schedules (evidence: `backend/app/main.py`)
- FastAPI application → Scheduled analysis job: schedules (evidence: `backend/app/main.py`)
- Integration routes → Channel ingestion: invokes (evidence: `backend/app/routers/integration.py`)
- Integration routes → Twitter collection: invokes (evidence: `backend/app/routers/integration.py`)
- Channel ingestion → Feedback platforms: fetches feedback (evidence: `backend/app/services/feedback_ingestion.py`)
- Channel ingestion → Email fetching: uses (evidence: `backend/app/services/feedback_ingestion.py`)
- Channel ingestion → Domain records: deduplicates records (evidence: `backend/app/services/feedback_ingestion.py`)
- Scheduled analysis job → PostgreSQL data: queries and updates (evidence: `backend/app/services/combined_service.py`)
- Scheduled analysis job → Domain records: processes records (evidence: `backend/app/services/combined_service.py`)
- Scheduled analysis job → Text preprocessing: preprocesses text (evidence: `backend/app/services/combined_service.py`)
- Scheduled analysis job → Arabic predictor: predicts Arabic (evidence: `backend/app/services/combined_service.py`)
- Scheduled analysis job → English predictor: predicts English (evidence: `backend/app/services/combined_service.py`)
- Arabic predictor → Priority scoring: uses scoring (evidence: `backend/app/ai/arabic_predictor.py`)
- English predictor → Priority scoring: uses scoring (evidence: `backend/app/ai/english_predictor.py`)
- FastAPI application → PostgreSQL data: creates schema (evidence: `backend/app/main.py`)
- Authentication routes → PostgreSQL data: queries users (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Domain records: reads and updates (evidence: `backend/app/routers/auth.py`)
