RAHUL-13 commited on
Commit
b328088
ยท
1 Parent(s): a4f839c

Add comprehensive project README

Browse files
Files changed (1) hide show
  1. Downloads/hackathon/civicai/README.md +292 -0
Downloads/hackathon/civicai/README.md ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CitizenCare ๐Ÿ›๏ธ
2
+
3
+ An intelligent AI-powered citizen grievance classification and tracking portal that enables seamless complaint submission, real-time status tracking, and efficient authority dashboard management.
4
+
5
+ ## ๐ŸŽฏ Features
6
+
7
+ - **Multi-Language Support**: Submit complaints in 10 Indian languages (English, Hindi, Telugu, Tamil, Kannada, Marathi, Bengali, Gujarati, Punjabi, Odia)
8
+ - **Voice & Text Input**: Record complaints directly or type them in
9
+ - **Smart Classification**: AI-powered keyword parser automatically categorizes complaints and assigns departments
10
+ - **Urgency Detection**: System intelligently identifies critical issues and triggers instant alerts
11
+ - **Real-Time Tracking**: Citizens can track complaint status with unique complaint IDs
12
+ - **Authority Dashboard**: Comprehensive dashboard for government officials to manage and resolve complaints
13
+ - **Visual Analytics**: Charts and filters to analyze complaint patterns by department and urgency
14
+ - **Secure Authentication**: Role-based access control with Supabase Auth
15
+ - **Responsive Design**: Beautiful, mobile-friendly UI with vibrant color scheme
16
+
17
+ ## ๐Ÿ› ๏ธ Tech Stack
18
+
19
+ - **Frontend**: Next.js, React, Tailwind CSS
20
+ - **Backend**: Next.js API Routes
21
+ - **Database**: Supabase (PostgreSQL) with real-time subscriptions
22
+ - **Authentication**: Supabase Auth
23
+ - **Voice Recognition**: Browser Web Speech API + OpenAI Whisper fallback
24
+ - **Email Alerts**: SendGrid (for critical complaints)
25
+ - **Charts**: Chart.js + react-chartjs-2
26
+ - **Hosting**: Vercel (recommended)
27
+
28
+ ## ๐Ÿ“‹ System Architecture
29
+
30
+ ```
31
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
32
+ โ”‚ Citizen Portal โ”‚ (index.jsx, support.jsx)
33
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
34
+ โ”‚ Voice/Text โ”‚
35
+ โ”‚ Input Handler โ”‚
36
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
37
+ โ”‚
38
+ โ–ผ
39
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
40
+ โ”‚ API Processor โ”‚ (api/process.js)
41
+ โ”‚ - Keywords โ”‚
42
+ โ”‚ - Scoring โ”‚
43
+ โ”‚ - Department โ”‚
44
+ โ”‚ - Urgency โ”‚
45
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
46
+ โ”‚
47
+ โ–ผ
48
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
49
+ โ”‚ Database โ”‚ (Supabase)
50
+ โ”‚ - Store โ”‚
51
+ โ”‚ - Realtime โ”‚
52
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
53
+ โ”‚
54
+ โ–ผ
55
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
56
+ โ”‚ Authority โ”‚ (dashboard.jsx)
57
+ โ”‚ Dashboard โ”‚
58
+ โ”‚ - View โ”‚
59
+ โ”‚ - Filter โ”‚
60
+ โ”‚ - Update โ”‚
61
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
62
+ ```
63
+
64
+ ## ๐Ÿš€ Getting Started
65
+
66
+ ### Prerequisites
67
+ - Node.js 16+ and npm
68
+ - Supabase account
69
+ - SendGrid account (for alerts)
70
+ - Git
71
+
72
+ ### Installation
73
+
74
+ 1. **Clone the repository**
75
+ ```bash
76
+ git clone https://github.com/SAI-RAHUL-ROKKAM/CitizenCare.git
77
+ cd CitizenCare
78
+ ```
79
+
80
+ 2. **Install dependencies**
81
+ ```bash
82
+ npm install
83
+ ```
84
+
85
+ 3. **Create environment file**
86
+ ```bash
87
+ cp .env.example .env.local
88
+ ```
89
+
90
+ 4. **Fill in your environment variables in `.env.local`**
91
+ ```
92
+ ANTHROPIC_API_KEY=your_key_here
93
+ OPENAI_API_KEY=your_key_here
94
+ NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
95
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_key
96
+ SENDGRID_API_KEY=your_sendgrid_key
97
+ ALERT_EMAIL=authority@yourcity.gov.in
98
+ LOCATIONIQ_KEY=your_locationiq_key
99
+ NEXT_PUBLIC_BASE_URL=http://localhost:3000
100
+ ```
101
+
102
+ 5. **Run the development server**
103
+ ```bash
104
+ npm run dev
105
+ ```
106
+
107
+ 6. **Open in browser**
108
+ ```
109
+ http://localhost:3000
110
+ ```
111
+
112
+ ## ๐Ÿ“ฑ Usage
113
+
114
+ ### For Citizens
115
+ 1. Visit `http://localhost:3000`
116
+ 2. Type or record a complaint in any supported language
117
+ 3. Click "Submit complaint"
118
+ 4. View generated complaint summary, department, and urgency
119
+ 5. Copy complaint ID to track status
120
+ 6. Use "Track complaint" tab to check real-time updates
121
+
122
+ ### For Authorities
123
+ 1. Visit `http://localhost:3000/login`
124
+ 2. Sign up or use test credentials:
125
+ - Email: `authority-test@citizencare.test`
126
+ - Password: `Test@1234`
127
+ 3. View dashboard with:
128
+ - Statistics (total, pending, resolved, critical)
129
+ - Charts by department and urgency
130
+ - Complaint list with filters
131
+ - Click any complaint to view details and update status
132
+
133
+ ## ๐Ÿ” Security
134
+
135
+ - โœ… Environment variables protected in `.env.local` (excluded from Git)
136
+ - โœ… `.env.example` contains only dummy keys
137
+ - โœ… Supabase Row Level Security (RLS) for database access control
138
+ - โœ… Role-based authentication for authority dashboard
139
+ - โœ… No API keys exposed in source code
140
+ - โœ… SendGrid alerts only for critical complaints
141
+
142
+ ## ๐Ÿ“ Project Structure
143
+
144
+ ```
145
+ CitizenCare/
146
+ โ”œโ”€โ”€ pages/
147
+ โ”‚ โ”œโ”€โ”€ _app.jsx # App wrapper
148
+ โ”‚ โ”œโ”€โ”€ index.jsx # Citizen portal (submit/track)
149
+ โ”‚ โ”œโ”€โ”€ dashboard.jsx # Authority dashboard
150
+ โ”‚ โ”œโ”€โ”€ login.jsx # Authentication
151
+ โ”‚ โ”œโ”€โ”€ support.jsx # FAQ & help center
152
+ โ”‚ โ””โ”€โ”€ api/
153
+ โ”‚ โ”œโ”€โ”€ process.js # Complaint parser & classifier
154
+ โ”‚ โ”œโ”€โ”€ status.js # Track complaint status
155
+ โ”‚ โ”œโ”€โ”€ alert.js # Send critical alerts
156
+ โ”‚ โ””โ”€โ”€ transcribe.js # Voice transcription
157
+ โ”œโ”€โ”€ lib/
158
+ โ”‚ โ””โ”€โ”€ supabase.js # Supabase client config
159
+ โ”œโ”€โ”€ styles/
160
+ โ”‚ โ””โ”€โ”€ globals.css # Global styles & animations
161
+ โ”œโ”€โ”€ .env.example # Environment template
162
+ โ”œโ”€โ”€ .gitignore # Git ignore rules
163
+ โ”œโ”€โ”€ package.json # Dependencies
164
+ โ”œโ”€โ”€ tailwind.config.js # Tailwind configuration
165
+ โ””โ”€โ”€ postcss.config.js # PostCSS configuration
166
+ ```
167
+
168
+ ## ๐Ÿง  How It Works
169
+
170
+ ### Complaint Processing Flow
171
+
172
+ 1. **Input**: Citizen submits text/voice in any language
173
+ 2. **Detection**: System detects language from Unicode script
174
+ 3. **Scoring**: Multi-keyword scoring system finds best department match
175
+ 4. **Rules**: Override rules for critical medical/safety terms
176
+ 5. **Extraction**: Location parsing using regex patterns
177
+ 6. **Classification**: Department, urgency, and action items assigned
178
+ 7. **Storage**: Complaint saved to Supabase with `status: pending`
179
+ 8. **Alerts**: If critical โ†’ SendGrid email sent to authority
180
+ 9. **Tracking**: Citizen gets unique ID to track status
181
+
182
+ ### Department Keywords
183
+
184
+ System supports keywords in 10 languages for:
185
+ - Health, Hospital
186
+ - Police
187
+ - Sanitation
188
+ - Roads, Water, Electricity
189
+ - Education
190
+ - Transport
191
+ - Municipal
192
+ - Environment
193
+ - Rescue
194
+ - Other (fallback)
195
+
196
+ ## ๐ŸŽ“ Example Test Cases
197
+
198
+ ### Test 1: Health Emergency โœ…
199
+ **Input**: "my teacher got a heart attack our school is at lalitha nagar , rajahmundry"
200
+ **Result**:
201
+ - Department: Health
202
+ - Urgency: Critical
203
+ - ETA: 12 hours
204
+
205
+ ### Test 2: Road Issue โœ…
206
+ **Input**: "large pothole near Ramaiah School on MG Road. Two bikes fell last week"
207
+ **Result**:
208
+ - Department: Roads
209
+ - Urgency: High
210
+ - ETA: 24-48 hours
211
+
212
+ ### Test 3: Sanitation โœ…
213
+ **Input**: "เค—เค‚เคฆเค—เฅ€ เค”เคฐ เค•เคšเคฐเฅ‡ เค•เฅ‡ เคขเฅ‡เคฐ เคนเคฎเคพเคฐเฅ‡ เค‡เคฒเคพเค•เฅ‡ เคฎเฅ‡เค‚"
214
+ **Result**:
215
+ - Department: Sanitation
216
+ - Urgency: Medium
217
+ - ETA: 3-5 days
218
+
219
+ ## ๐Ÿš€ Deployment
220
+
221
+ ### Deploy to Vercel (Recommended)
222
+
223
+ 1. Push code to GitHub
224
+ 2. Connect repo to Vercel
225
+ 3. Add environment variables in Vercel dashboard
226
+ 4. Deploy automatically on push
227
+
228
+ ```bash
229
+ git push origin main
230
+ # Vercel auto-deploys
231
+ ```
232
+
233
+ ### Environment Variables for Production
234
+ Set these in your hosting platform (Vercel, Netlify, etc.):
235
+ - `ANTHROPIC_API_KEY`
236
+ - `OPENAI_API_KEY`
237
+ - `NEXT_PUBLIC_SUPABASE_URL`
238
+ - `NEXT_PUBLIC_SUPABASE_ANON_KEY`
239
+ - `SENDGRID_API_KEY`
240
+ - `ALERT_EMAIL`
241
+ - `LOCATIONIQ_KEY`
242
+ - `NEXT_PUBLIC_BASE_URL` (your domain)
243
+
244
+ ## ๐Ÿ“Š Performance
245
+
246
+ - **Processing Time**: < 3 seconds for complaint classification
247
+ - **Database**: Real-time sync using Supabase subscriptions
248
+ - **Voice Input**: Supports 10 languages with offline fallback
249
+ - **Responsive**: Mobile, tablet, and desktop optimized
250
+
251
+ ## ๐Ÿ”ฎ Future Enhancements
252
+
253
+ - [ ] ML/NLP model for intent classification
254
+ - [ ] Map-based geo-visualization of complaints
255
+ - [ ] SMS/WhatsApp citizen notifications
256
+ - [ ] Advanced admin dashboard with SLA tracking
257
+ - [ ] Automated translation to English
258
+ - [ ] Chat support interface
259
+ - [ ] Gamification (badges/credits for citizens)
260
+ - [ ] Photo/video attachments
261
+ - [ ] Integration with government databases
262
+ - [ ] Analytics and reporting tools
263
+
264
+ ## ๐Ÿค Contributing
265
+
266
+ Contributions are welcome! Please:
267
+ 1. Fork the repository
268
+ 2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
269
+ 3. Commit changes (`git commit -m 'Add AmazingFeature'`)
270
+ 4. Push to branch (`git push origin feature/AmazingFeature`)
271
+ 5. Open a Pull Request
272
+
273
+ ## ๐Ÿ“ License
274
+
275
+ This project is open source and available under the MIT License.
276
+
277
+ ## ๐Ÿ“ž Support
278
+
279
+ For issues or questions:
280
+ - Create an issue on GitHub
281
+ - Check the FAQ in `/support` page
282
+ - Visit help center at `http://localhost:3000/support`
283
+
284
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Authors
285
+
286
+ - **SAI RAHUL ROKKAM** - Initial development
287
+
288
+ Built for the National Hackathon 2026
289
+
290
+ ---
291
+
292
+ **Made with โค๏ธ for better citizen-government communication**