ArchCoder commited on
Commit
034f7bd
Β·
verified Β·
1 Parent(s): 405694e

docs : added endpoint urls

Browse files
Files changed (1) hide show
  1. README.md +323 -2
README.md CHANGED
@@ -8,6 +8,327 @@ app_port: 7860
8
  pinned: false
9
  ---
10
 
11
- # Hostel Management System API
12
 
13
- This is a Flask-based API for hostel management with ML capabilities.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  pinned: false
9
  ---
10
 
11
+ # Hostel Grievance Redressal System
12
 
13
+ ## Overview
14
+
15
+ The Hostel Grievance Redressal System is designed to efficiently manage and resolve grievances raised by residents. By leveraging AI/ML functionalities, the system aims to enhance communication, streamline grievance handling, and provide timely resolutions. This document outlines the implementation plans for various AI/ML features, system architecture, and usage instructions.
16
+
17
+ ---
18
+
19
+ ## Table of Contents
20
+
21
+ 1. [System Architecture Overview](#system-architecture-overview)
22
+ 2. [AI/ML Functionalities](#aiml-functionalities)
23
+ - [1. Intelligent Routing and Workflow Automation](#1-intelligent-routing-and-workflow-automation)
24
+ - [2. Advanced Sentiment and Emotional Intelligence Analysis](#2-advanced-sentiment-and-emotional-intelligence-analysis)
25
+ - [3. Multilingual Translation in Chatroom](#3-multilingual-translation-in-chatroom)
26
+ - [4. Worker Job Recommendation](#4-worker-job-recommendation)
27
+ 3. [Directory Structure](#directory-structure)
28
+ 4. [Conclusion](#conclusion)
29
+ 5. [License](#license)
30
+ 6. [Contact](#contact)
31
+
32
+ ---
33
+
34
+ ## System Architecture Overview
35
+
36
+ The Hostel Grievance Redressal System is built as a centralized Flask API server that hosts all AI/ML models. This architecture allows different services and applications to interact with the models by sending HTTP requests containing input data and receiving model predictions in response. Each AI/ML functionality is exposed through distinct endpoints, enabling modularity and scalability.
37
+
38
+ ### Key Components
39
+
40
+ 1. **Flask API Server**
41
+ - Central hub for all AI/ML models.
42
+ - RESTful API design for standardized interactions.
43
+ - Authentication and authorization mechanisms.
44
+
45
+ 2. **Model Endpoints**
46
+ - `/api/intelligent-routing` - Endpoint for intelligent routing and workflow automation.
47
+ - `/api/sentiment-analysis` - Endpoint for advanced sentiment and emotional intelligence analysis.
48
+ - `/api/multilingual-translation` - Endpoint for multilingual translation in chatroom.
49
+ - `/api/job-recommendation` - Endpoint for worker job recommendation.
50
+
51
+ 3. **Data Handling and Validation**
52
+ - Input validation using libraries like `pydantic` or `marshmallow`.
53
+
54
+ 4. **Scalability and Deployment**
55
+ - Docker for containerization.
56
+ - Kubernetes or cloud-based services for orchestration.
57
+
58
+ ---
59
+
60
+ ## AI/ML Functionalities
61
+
62
+ ### 1. Intelligent Routing and Workflow Automation
63
+
64
+ **Purpose:** Efficiently assign grievances to the most suitable personnel or department based on various factors.
65
+
66
+ **Model Design Pipeline:**
67
+ - Data Collection: Grievance data, staff data, historical assignments.
68
+ - Data Preprocessing: Cleaning, feature engineering, encoding.
69
+ - Model Selection: Reinforcement Learning (RL) and Multi-Criteria Decision-Making (MCDM).
70
+ - Training and Evaluation: Define environment, implement reward functions, and evaluate using metrics like resolution time.
71
+
72
+ **API Endpoint:** `https://archcoder-hostel-management-and-greivance-redres-2eeefad.hf.space/api/intelligent-routing`
73
+
74
+ **Example Input:**
75
+ ```json
76
+ {
77
+ "grievance_id": "G12346",
78
+ "category": "electricity",
79
+ "submission_timestamp": "2023-10-02T08:15:00Z",
80
+ "student_room_no": "204",
81
+ "hostel_name": "bh2",
82
+ "floor_number": 2,
83
+ "current_staff_status": [
84
+ {
85
+ "staff_id": "S67890",
86
+ "department": "electricity",
87
+ "current_workload": 3,
88
+ "availability_status": "Available",
89
+ "past_resolution_rate": 0.95
90
+ },
91
+ {
92
+ "staff_id": "S67891",
93
+ "department": "plumber",
94
+ "current_workload": 2,
95
+ "availability_status": "Available",
96
+ "past_resolution_rate": 0.90
97
+ }
98
+ ],
99
+ "floor_metrics": {
100
+ "number_of_requests": 15,
101
+ "total_delays": 1
102
+ },
103
+ "availability_data": {
104
+ "staff_availability": [
105
+ {
106
+ "staff_id": "S67890",
107
+ "time_slot": "08:00-12:00",
108
+ "availability_status": "Available"
109
+ }
110
+ ],
111
+ "student_availability": [
112
+ {
113
+ "student_id": "STU204",
114
+ "time_slot": "08:00-10:00",
115
+ "availability_status": "Unavailable"
116
+ }
117
+ ]
118
+ }
119
+ }
120
+ ```
121
+
122
+ **Example Output:**
123
+ ```json
124
+ {
125
+ "job_id": "J12346",
126
+ "assigned_worker_id": "W67890",
127
+ "assignment_timestamp": "2023-10-02T08:16:00Z",
128
+ "expected_resolution_time": "1 hour",
129
+ "location": {
130
+ "grievance_id": "G12346",
131
+ "assigned_staff_id": "S67890",
132
+ ...
133
+ }
134
+ ```
135
+
136
+ ---
137
+ ### 2. Advanced Sentiment and Emotional Intelligence Analysis
138
+
139
+ **Purpose:** Detect complex emotional states in grievances to enhance responses from administrators.
140
+
141
+ **Model Design Pipeline:**
142
+ - Data Collection: Grievance texts and emotional labels.
143
+ - Data Preprocessing: Text cleaning, tokenization, and normalization.
144
+ - Model Selection: Transformer-based models like BERT.
145
+
146
+ **API Endpoint:** `https://archcoder-hostel-management-and-greivance-redres-2eeefad.hf.space/api/sentiment-analysis`
147
+
148
+ **Example Input:**
149
+ ```json
150
+ {
151
+ "grievance_id": "G12349",
152
+ "text": "Why hasn't the maintenance team fixed the leaking roof yet?"
153
+ }
154
+ ```
155
+
156
+ **Example Output:**
157
+ ```json
158
+ {
159
+ "grievance_id": "G12349",
160
+ "predicted_emotional_label": "Anger",
161
+ ...
162
+ }
163
+ ```
164
+
165
+ ---
166
+
167
+ ### 3. Multilingual Translation in Chatroom
168
+
169
+ **Purpose:** Facilitate communication between residents and workers who speak different languages.
170
+
171
+ **Model Design Pipeline:**
172
+ - Data Collection: Multilingual conversation logs and translation pairs.
173
+ - Data Preprocessing: Cleaning, tokenization, and alignment.
174
+ - Model Selection: Neural Machine Translation (NMT) models.
175
+
176
+ **API Endpoint:** `https://archcoder-hostel-management-and-greivance-redres-2eeefad.hf.space/api/multilingual-translation`
177
+
178
+ **Example Input:**
179
+ ```json
180
+ {
181
+ "user_message": "toilet me paani nahi aa rha hain",
182
+ "source_language": "Hindi",
183
+ "target_language": "English"
184
+ }
185
+ ```
186
+
187
+ **Example Output:**
188
+ ```json
189
+ {
190
+ "translated_message": "There is no water coming in the toilet."
191
+ }
192
+ ```
193
+
194
+ ---
195
+
196
+ ### 4. Worker Job Recommendation
197
+
198
+ **Purpose:** Optimize job assignments to workers based on various factors.
199
+
200
+ **Model Design Pipeline:**
201
+ - Data Collection: Job requests, worker profiles, historical assignments.
202
+ - Data Preprocessing: Cleaning, feature engineering, encoding.
203
+ - Model Selection: Collaborative Filtering and Decision Trees.
204
+
205
+ **API Endpoint:** `https://archcoder-hostel-management-and-greivance-redres-2eeefad.hf.space/api/job-recommendation`
206
+
207
+ **Example Input:**
208
+ ```json
209
+ {
210
+ "job_id": "J12346",
211
+ "type": "Electrical",
212
+ "description": "Fan not working in room 204.",
213
+ "urgency_level": "High",
214
+ "submission_timestamp": "2023-10-02T08:15:00Z",
215
+ "hostel_name": "Hostel A",
216
+ "floor_number": 2,
217
+ "room_number": "204"
218
+ }
219
+ ```
220
+
221
+ **Example Output:**
222
+ ```json
223
+ {
224
+ "job_id": "J12346",
225
+ "assigned_worker_id": "W67890",
226
+ "current_timestamp": "2023-10-02T08:30:00Z",
227
+ "expected_resolution_time": "2023-10-02T10:00:00Z",
228
+ "location": {
229
+ "hostel_name": "Hostel A",
230
+ "floor_number": 2,
231
+ "room_number": "210"
232
+ }
233
+ }
234
+ ```
235
+
236
+ ---
237
+
238
+ # Directory Structure
239
+
240
+ ```
241
+ πŸ“ config
242
+ πŸ“„ __init__.py
243
+ πŸ“„ config.py
244
+ πŸ“ docs
245
+ πŸ“„ README.md
246
+ πŸ“„ ai_plan.md
247
+ πŸ“„ data_plan.md
248
+ πŸ“„ plan.md
249
+ πŸ“ models
250
+ πŸ“ intelligent_routing
251
+ πŸ“ saved_model
252
+ πŸ“„ model.keras
253
+ πŸ“ test_data
254
+ πŸ“„ __init__.py
255
+ πŸ“„ test_data.json
256
+ πŸ“ test_results
257
+ πŸ“„ confusion_matrix.png
258
+ πŸ“„ roc_curve.png
259
+ πŸ“„ test_report.json
260
+ πŸ“ train_data
261
+ πŸ“„ __init__.py
262
+ πŸ“„ training_data.json
263
+ πŸ“„ generate_data.py
264
+ πŸ“„ model.py
265
+ πŸ“„ test_model.py
266
+ πŸ“„ train.py
267
+ πŸ“ job_recommendation
268
+ πŸ“ saved_model
269
+ πŸ“„ model.keras
270
+ πŸ“ test_data
271
+ πŸ“„ __init__.py
272
+ πŸ“„ test_data.json
273
+ πŸ“ test_results
274
+ πŸ“„ test_report.json
275
+ πŸ“ train_data
276
+ πŸ“„ __init__.py
277
+ πŸ“„ training_data.json
278
+ πŸ“„ generate_data.py
279
+ πŸ“„ model.py
280
+ πŸ“„ test.py
281
+ πŸ“„ train.py
282
+ πŸ“ multilingual_translation
283
+ πŸ“ test_data
284
+ πŸ“„ __init__.py
285
+ πŸ“„ test_data.json
286
+ πŸ“ test_results
287
+ πŸ“„ test_report.json
288
+ πŸ“ train_data
289
+ πŸ“„ __init__.py
290
+ πŸ“„ training_data.json
291
+ πŸ“„ model.py
292
+ πŸ“„ test_model.py
293
+ πŸ“ sentiment_analysis
294
+ πŸ“ test_data
295
+ πŸ“„ __init__.py
296
+ πŸ“„ test_data.json
297
+ πŸ“ test_results
298
+ πŸ“„ test_report.json
299
+ πŸ“ train_data
300
+ πŸ“„ __init__.py
301
+ πŸ“„ training_data.json
302
+ πŸ“„ model.py
303
+ πŸ“„ test_model.py
304
+ πŸ“ test_results
305
+ πŸ“„ endpoint_test_results.json
306
+ πŸ“ utils
307
+ πŸ“„ __init__.py
308
+ πŸ“„ logger.py
309
+ πŸ“„ .env
310
+ πŸ“„ .gitignore
311
+ πŸ“„ app.py
312
+ πŸ“„ readme.md
313
+ πŸ“„ requirements.txt
314
+ πŸ“„ routes.py
315
+ πŸ“„ test_endpoints.py
316
+ ```
317
+ ---
318
+
319
+ > To test the application, you can use the `test_endpoints.py` script, which provides a convenient way to verify the functionality of the API endpoints.
320
+
321
+
322
+ ## Conclusion
323
+
324
+ Implementing these AI/ML functionalities will significantly enhance the efficiency and effectiveness of the Hostel Grievance Redressal System. By leveraging advanced technologies and integrating them within a Flask API framework, the system will provide a more responsive, empathetic, and proactive approach to managing resident grievances.
325
+
326
+ ---
327
+
328
+ ## License
329
+
330
+ This project is licensed under the [MIT License](LICENSE).
331
+
332
+ ## Contact
333
+
334
+ For any questions or feedback, please contact [imt_2022089@iiitm.ac.in](mailto:imt_2022089@iiitm.ac.in).