# nithish23013509/smart-public-grievance-managment-system architecture

> Architecture diagram of the GitHub repository nithish23013509/smart-public-grievance-managment-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nithish23013509/smart-public-grievance-managment-system
- Repository: https://github.com/nithish23013509/smart-public-grievance-managment-system

## Overview

This repository is a public-grievance web application with a React client and a Python department-recommendation service. A citizen submits a text or voice grievance with optional location and supporting image; the client sends it to the documented backend, where grievances are stored and AI classification/routing is available. Citizens track progress, while officers and administrators manage complaints and review AI recommendations. The tree does not include the documented Spring backend or database implementation, so these appear only as external systems; duplicate detection is a README capability but its implementation is not identifiable here.

Main entry points: [`frontend/src/services/complaintService.js`](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/complaintService.js) (Complaint API service), [`frontend/src/routes/AppRoutes.jsx`](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/routes/AppRoutes.jsx) (Role-based routes), [`frontend/src/pages/citizen`](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/citizen) (Citizen pages), [`frontend/src/services/api.js`](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/api.js) (HTTP API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Citizen client"]
  node_routes["Role-based routes<br/>[AppRoutes.jsx]"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_citizen_pages["Citizen pages"]
  node_notifications["Notifications and profile"]
  node_location["Complaint location map"]
  node_speech["Speech input<br/>[speechService.js]"]
end

subgraph group_operations["Complaint operations"]
  node_admin_pages["Admin pages"]
  node_officer_pages["Officer pages"]
  node_ai_review["AI review display<br/>[AiReviewDetail.jsx]"]
  node_ai_analytics["AI analytics"]
end

subgraph group_ai["AI recommendation"]
  node_nlp_api["Python NLP service<br/>[app.py]"]
  node_recommend["Category and department recommendation"]
  node_decision["Confidence decision"]
  node_model_work["Model preparation and training"]
end

subgraph group_services["Client services"]
  node_complaint_service["Complaint API service"]
  node_auth_service["Authentication service<br/>[authService.js]"]
  node_department_service["Department service"]
  node_location_service["Location service<br/>[locationService.js]"]
  node_notification_service["Notification service"]
  node_api_client["HTTP API client<br/>[api.js]"]
end

node_citizen(("Citizen"))
node_backend["Spring Boot API"]
node_database[("MySQL grievance store")]

node_citizen -->|"uses"| node_routes
node_routes -->|"routes to"| node_citizen_pages
node_routes -->|"routes to"| node_admin_pages
node_routes -->|"routes to"| node_officer_pages
node_routes -->|"routes to"| node_notifications
node_citizen_pages -->|"submits and tracks"| node_complaint_service
node_citizen_pages -->|"renders"| node_location
node_citizen_pages -->|"loads locations"| node_location_service
node_citizen_pages -->|"uses speech input"| node_speech
node_officer_pages -->|"reviews complaints"| node_complaint_service
node_ai_review -->|"loads and submits review"| node_complaint_service
node_ai_review -->|"loads departments"| node_department_service
node_admin_pages -->|"manages complaints"| node_complaint_service
node_ai_analytics -.->|"requests analytics"| node_complaint_service
node_notifications -.->|"loads notifications"| node_notification_service
node_auth -->|"authenticates"| node_auth_service
node_auth_service -->|"sends auth requests"| node_api_client
node_complaint_service -->|"sends complaint requests"| node_api_client
node_department_service -->|"sends department requests"| node_api_client
node_location_service -->|"sends location requests"| node_api_client
node_api_client -->|"calls REST API"| node_backend
node_backend -->|"reads and writes"| node_database
node_backend -->|"requests NLP routing"| node_nlp_api
node_nlp_api -->|"dispatches recommendation"| node_recommend
node_recommend -->|"gets decision"| node_decision
node_model_work -.->|"supplies trained models"| node_recommend

click node_routes "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_auth "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/context/AuthContext.jsx"
click node_citizen_pages "https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/citizen"
click node_admin_pages "https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/admin"
click node_officer_pages "https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/officer"
click node_notifications "https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages"
click node_location "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/components/complaint/ComplaintLocationMap.jsx"
click node_speech "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/speechService.js"
click node_ai_review "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/pages/officer/AiReviewDetail.jsx"
click node_ai_analytics "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/pages/admin/AiAnalyticsDashboard.jsx"
click node_complaint_service "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/complaintService.js"
click node_auth_service "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/authService.js"
click node_department_service "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/departmentService.js"
click node_location_service "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/locationService.js"
click node_notification_service "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/notificationService.js"
click node_api_client "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/api.js"
click node_nlp_api "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/app.py"
click node_recommend "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/recommendation_service.py"
click node_decision "https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/recommendation_decision.py"
click node_model_work "https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/ai-department-recommendation/ml"

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_auth,node_citizen_pages,node_notifications,node_location,node_speech toneBlue
class node_admin_pages,node_officer_pages,node_ai_review,node_ai_analytics,node_database toneAmber
class node_nlp_api,node_recommend,node_decision,node_model_work,node_backend toneMint
class node_complaint_service,node_auth_service,node_department_service,node_location_service,node_notification_service,node_api_client toneRose
class node_citizen toneIndigo
```

## Components

### Citizen client

- [Role-based routes](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [Authentication state](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Citizen pages](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/citizen): `frontend/src/pages/citizen`
- [Notifications and profile](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages): `frontend/src/pages`
- [Complaint location map](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/components/complaint/ComplaintLocationMap.jsx): `frontend/src/components/complaint/ComplaintLocationMap.jsx`
- [Speech input](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/speechService.js): `frontend/src/services/speechService.js`

### Complaint operations

- [Admin pages](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Officer pages](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/frontend/src/pages/officer): `frontend/src/pages/officer`
- [AI review display](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/pages/officer/AiReviewDetail.jsx): `frontend/src/pages/officer/AiReviewDetail.jsx`
- [AI analytics](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/pages/admin/AiAnalyticsDashboard.jsx): `frontend/src/pages/admin/AiAnalyticsDashboard.jsx`

### AI recommendation

- [Python NLP service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/app.py): `ai-department-recommendation/ml/app.py`
- [Category and department recommendation](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/recommendation_service.py): `ai-department-recommendation/ml/recommendation_service.py`
- [Confidence decision](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/ai-department-recommendation/ml/recommendation_decision.py): `ai-department-recommendation/ml/recommendation_decision.py`
- [Model preparation and training](https://github.com/nithish23013509/smart-public-grievance-managment-system/tree/main/ai-department-recommendation/ml): `ai-department-recommendation/ml`

### Client services

- [Complaint API service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/complaintService.js): `frontend/src/services/complaintService.js`
- [Authentication service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`
- [Department service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/departmentService.js): `frontend/src/services/departmentService.js`
- [Location service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/locationService.js): `frontend/src/services/locationService.js`
- [Notification service](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/notificationService.js): `frontend/src/services/notificationService.js`
- [HTTP API client](https://github.com/nithish23013509/smart-public-grievance-managment-system/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Other components

- **Citizen**
- **Spring Boot API**
- **MySQL grievance store**

## Connections

- Citizen → Role-based routes: uses (evidence: `README.md`)
- Role-based routes → Citizen pages: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Admin pages: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Officer pages: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Notifications and profile: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Citizen pages → Complaint API service: submits and tracks (evidence: `frontend/src/pages/citizen/CreateComplaint.jsx`)
- Citizen pages → Complaint location map: renders (evidence: `frontend/src/pages/citizen/CreateComplaint.jsx`)
- Citizen pages → Location service: loads locations (evidence: `frontend/src/pages/citizen/CreateComplaint.jsx`)
- Citizen pages → Speech input: uses speech input (evidence: `frontend/src/pages/citizen/CreateComplaint.jsx`)
- Officer pages → Complaint API service: reviews complaints (evidence: `frontend/src/pages/officer/AiReviewQueue.jsx`)
- AI review display → Complaint API service: loads and submits review (evidence: `frontend/src/pages/officer/AiReviewDetail.jsx`)
- AI review display → Department service: loads departments (evidence: `frontend/src/pages/officer/AiReviewDetail.jsx`)
- Admin pages → Complaint API service: manages complaints (evidence: `frontend/src/pages/admin/AdminComplaintDetails.jsx`)
- AI analytics → Complaint API service: requests analytics
- Notifications and profile → Notification service: loads notifications (evidence: `frontend/src/pages/Notifications.jsx`)
- Authentication state → Authentication service: authenticates (evidence: `frontend/src/context/AuthContext.jsx`)
- Authentication service → HTTP API client: sends auth requests (evidence: `frontend/src/services/authService.js`)
- Complaint API service → HTTP API client: sends complaint requests (evidence: `frontend/src/services/complaintService.js`)
- Department service → HTTP API client: sends department requests (evidence: `frontend/src/services/departmentService.js`)
- Location service → HTTP API client: sends location requests (evidence: `frontend/src/services/locationService.js`)
- HTTP API client → Spring Boot API: calls REST API (evidence: `README.md`)
- Spring Boot API → MySQL grievance store: reads and writes (evidence: `README.md`)
- Spring Boot API → Python NLP service: requests NLP routing (evidence: `README.md`)
- Python NLP service → Category and department recommendation: dispatches recommendation (evidence: `ai-department-recommendation/ml/app.py`)
- Category and department recommendation → Confidence decision: gets decision (evidence: `ai-department-recommendation/ml/recommendation_service.py`)
- Model preparation and training → Category and department recommendation: supplies trained models (evidence: `ai-department-recommendation/ml/app.py`)
