pranit144 commited on
Commit
28007a5
·
verified ·
1 Parent(s): 7e23fe2

Upload 2 files

Browse files
Files changed (2) hide show
  1. doctor_dashboard.html +137 -0
  2. index.html +272 -0
doctor_dashboard.html ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Doctor Dashboard - Care Plan Management System</title>
7
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
8
+ <style>
9
+ :root {
10
+ --primary-blue: #0d6efd;
11
+ --light-blue: #e7f1ff;
12
+ --dark-blue: #0a58ca;
13
+ }
14
+
15
+ body {
16
+ background-color: #f8f9fa;
17
+ }
18
+
19
+ .navbar {
20
+ background-color: var(--primary-blue);
21
+ padding: 1rem;
22
+ }
23
+
24
+ .navbar-brand {
25
+ color: white !important;
26
+ font-weight: bold;
27
+ }
28
+
29
+ .container {
30
+ max-width: 1000px;
31
+ margin-top: 30px;
32
+ }
33
+
34
+ .card {
35
+ border: none;
36
+ border-radius: 15px;
37
+ box-shadow: 0 0 15px rgba(0,0,0,0.1);
38
+ margin-bottom: 20px;
39
+ }
40
+
41
+ .card-header {
42
+ background-color: var(--light-blue);
43
+ border-radius: 15px 15px 0 0 !important;
44
+ border-bottom: none;
45
+ padding: 1.5rem;
46
+ }
47
+
48
+ .emergency-alert {
49
+ background-color: #dc3545;
50
+ color: white;
51
+ padding: 15px;
52
+ border-radius: 10px;
53
+ margin-bottom: 20px;
54
+ }
55
+
56
+ .role-switcher {
57
+ position: fixed;
58
+ top: 20px;
59
+ right: 20px;
60
+ z-index: 1000;
61
+ }
62
+ </style>
63
+ </head>
64
+ <body>
65
+ <nav class="navbar">
66
+ <div class="container">
67
+ <a class="navbar-brand" href="#">Doctor Dashboard</a>
68
+ <div class="role-switcher">
69
+ <select class="form-select" id="roleSelect" onchange="switchRole()">
70
+ <option value="doctor" selected>Doctor View</option>
71
+ <option value="patient">Patient View</option>
72
+ </select>
73
+ </div>
74
+ </div>
75
+ </nav>
76
+
77
+ <div class="container">
78
+ <div class="card">
79
+ <div class="card-header">
80
+ <h3 class="mb-0">Emergency Notifications</h3>
81
+ </div>
82
+ <div class="card-body">
83
+ <div id="emergencyNotifications">
84
+ <div class="text-center" id="noNotifications">
85
+ No emergency notifications at this time
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+
92
+ <script>
93
+ function switchRole() {
94
+ const role = document.getElementById('roleSelect').value;
95
+ if (role === 'patient') {
96
+ window.location.href = '/';
97
+ }
98
+ }
99
+
100
+ async function fetchEmergencyNotifications() {
101
+ try {
102
+ const response = await fetch('/get_emergency_notifications');
103
+ const data = await response.json();
104
+
105
+ if (data.success) {
106
+ const notificationsDiv = document.getElementById('emergencyNotifications');
107
+ const noNotificationsDiv = document.getElementById('noNotifications');
108
+
109
+ if (data.notifications && data.notifications.length > 0) {
110
+ notificationsDiv.innerHTML = '';
111
+ data.notifications.forEach(notification => {
112
+ const notificationElement = document.createElement('div');
113
+ notificationElement.className = 'emergency-alert';
114
+ notificationElement.innerHTML = `
115
+ <h4>Emergency Alert</h4>
116
+ <p>Time: ${notification.timestamp}</p>
117
+ <p>Patient Feedback: ${notification.patient_feedback}</p>
118
+ `;
119
+ notificationsDiv.appendChild(notificationElement);
120
+ });
121
+ } else {
122
+ notificationsDiv.innerHTML = '<div class="text-center">No emergency notifications at this time</div>';
123
+ }
124
+ }
125
+ } catch (error) {
126
+ console.error('Error fetching notifications:', error);
127
+ }
128
+ }
129
+
130
+ // Initial fetch
131
+ fetchEmergencyNotifications();
132
+
133
+ // Poll for new notifications
134
+ setInterval(fetchEmergencyNotifications, 30000);
135
+ </script>
136
+ </body>
137
+ </html>
index.html ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Care Plan Management System</title>
7
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
8
+ <style>
9
+ :root {
10
+ --primary-blue: #0d6efd;
11
+ --light-blue: #e7f1ff;
12
+ --dark-blue: #0a58ca;
13
+ --bg-light: #f8f9fa;
14
+ }
15
+
16
+ body {
17
+ background-color: var(--bg-light);
18
+ font-family: 'Roboto', sans-serif;
19
+ }
20
+
21
+ .navbar {
22
+ background-color: var(--primary-blue);
23
+ padding: 1rem;
24
+ }
25
+
26
+ .navbar-brand {
27
+ color: white !important;
28
+ font-weight: bold;
29
+ }
30
+
31
+ .container {
32
+ max-width: 1000px;
33
+ margin-top: 30px;
34
+ }
35
+
36
+ .card {
37
+ border: none;
38
+ border-radius: 15px;
39
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
40
+ margin-bottom: 20px;
41
+ }
42
+
43
+ .card-header {
44
+ background-color: var(--light-blue);
45
+ border-radius: 15px 15px 0 0;
46
+ border-bottom: none;
47
+ padding: 1.5rem;
48
+ }
49
+
50
+ .form-control {
51
+ border-radius: 10px;
52
+ border: 2px solid #e9ecef;
53
+ padding: 0.8rem;
54
+ }
55
+
56
+ .form-control:focus {
57
+ border-color: var(--primary-blue);
58
+ box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
59
+ }
60
+
61
+ .btn-primary {
62
+ background-color: var(--primary-blue);
63
+ border: none;
64
+ padding: 0.8rem 2rem;
65
+ border-radius: 10px;
66
+ font-weight: 600;
67
+ }
68
+
69
+ .btn-primary:hover {
70
+ background-color: var(--dark-blue);
71
+ }
72
+
73
+ /* Updated Care Plan Output Styling */
74
+ #updatedPlan {
75
+ white-space: pre-wrap;
76
+ background-color: white;
77
+ padding: 20px;
78
+ border-radius: 10px;
79
+ border-left: 4px solid var(--primary-blue);
80
+ font-size: 1rem;
81
+ line-height: 1.6;
82
+ opacity: 0;
83
+ transform: translateY(20px);
84
+ transition: opacity 0.5s ease, transform 0.5s ease;
85
+ }
86
+
87
+ #updatedPlan.visible {
88
+ opacity: 1;
89
+ transform: translateY(0);
90
+ }
91
+
92
+ .role-switcher {
93
+ position: fixed;
94
+ top: 20px;
95
+ right: 20px;
96
+ z-index: 1000;
97
+ }
98
+
99
+ .emergency-alert {
100
+ background-color: #dc3545;
101
+ color: white;
102
+ padding: 15px;
103
+ border-radius: 10px;
104
+ margin-bottom: 20px;
105
+ }
106
+
107
+ /* Loading Spinner Styles */
108
+ #loadingIndicator {
109
+ display: none;
110
+ text-align: center;
111
+ margin-top: 20px;
112
+ }
113
+ </style>
114
+ </head>
115
+ <body>
116
+ <nav class="navbar">
117
+ <div class="container">
118
+ <a class="navbar-brand" href="#">Care Plan Management System</a>
119
+ <div class="role-switcher">
120
+ <select class="form-select" id="roleSelect" onchange="switchRole()">
121
+ <option value="patient">Patient View</option>
122
+ <option value="doctor">Doctor View</option>
123
+ </select>
124
+ </div>
125
+ </div>
126
+ </nav>
127
+
128
+ <div class="container">
129
+ <!-- Patient View -->
130
+ <div id="patientView">
131
+ <div class="card">
132
+ <div class="card-header">
133
+ <h3 class="mb-0">Patient Feedback Form</h3>
134
+ </div>
135
+ <div class="card-body">
136
+ <form id="feedbackForm" class="mb-4">
137
+ <div class="mb-3">
138
+ <label for="feedback" class="form-label">Current Symptoms and Feedback</label>
139
+ <textarea class="form-control" id="feedback" name="feedback" rows="4" placeholder="Please describe your current symptoms and how you're feeling..." required></textarea>
140
+ </div>
141
+
142
+ <div class="mb-3">
143
+ <label for="care_plan_pdf" class="form-label">Upload Current Care Plan (PDF)</label>
144
+ <input type="file" class="form-control" id="care_plan_pdf" name="care_plan_pdf" accept=".pdf" />
145
+ <div class="form-text">Optional: Upload your current care plan in PDF format</div>
146
+ </div>
147
+
148
+ <button type="submit" class="btn btn-primary">Submit Feedback</button>
149
+ </form>
150
+ <!-- Loading Indicator -->
151
+ <div id="loadingIndicator">
152
+ <div class="spinner-border text-primary" role="status">
153
+ <span class="visually-hidden">Loading...</span>
154
+ </div>
155
+ <p>Generating updated care plan...</p>
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <div id="responseSection" class="card d-none">
161
+ <div class="card-header">
162
+ <h3 class="mb-0">Updated Care Plan</h3>
163
+ </div>
164
+ <div class="card-body">
165
+ <div id="updatedPlan"></div>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <!-- Doctor View -->
171
+ <div id="doctorView" style="display: none;">
172
+ <div class="card">
173
+ <div class="card-header">
174
+ <h3 class="mb-0">Emergency Notifications</h3>
175
+ </div>
176
+ <div class="card-body">
177
+ <div id="emergencyNotifications"></div>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>
182
+
183
+ <script>
184
+ let currentRole = 'patient';
185
+
186
+ function switchRole() {
187
+ const role = document.getElementById('roleSelect').value;
188
+ if (role === 'doctor') {
189
+ window.location.href = '/doctor_dashboard';
190
+ }
191
+
192
+ // Update server-side role
193
+ fetch('/switch_role', {
194
+ method: 'POST',
195
+ headers: {
196
+ 'Content-Type': 'application/x-www-form-urlencoded'
197
+ },
198
+ body: `role=${role}`
199
+ });
200
+ }
201
+
202
+ async function fetchEmergencyNotifications() {
203
+ try {
204
+ const response = await fetch('/get_emergency_notifications');
205
+ const data = await response.json();
206
+
207
+ if (data.success) {
208
+ const notificationsDiv = document.getElementById('emergencyNotifications');
209
+ notificationsDiv.innerHTML = '';
210
+
211
+ data.notifications.forEach(notification => {
212
+ const notificationElement = document.createElement('div');
213
+ notificationElement.className = 'emergency-alert';
214
+ notificationElement.innerHTML = `
215
+ <h4>Emergency Alert</h4>
216
+ <p>Time: ${notification.timestamp}</p>
217
+ <p>Patient Feedback: ${notification.patient_feedback}</p>
218
+ `;
219
+ notificationsDiv.appendChild(notificationElement);
220
+ });
221
+ }
222
+ } catch (error) {
223
+ console.error('Error fetching notifications:', error);
224
+ }
225
+ }
226
+
227
+ document.getElementById('feedbackForm').addEventListener('submit', async (e) => {
228
+ e.preventDefault();
229
+
230
+ // Show loading indicator
231
+ document.getElementById('loadingIndicator').style.display = 'block';
232
+ document.getElementById('responseSection').classList.add('d-none');
233
+
234
+ const formData = new FormData(e.target);
235
+
236
+ try {
237
+ const response = await fetch('/submit_feedback', {
238
+ method: 'POST',
239
+ body: formData
240
+ });
241
+
242
+ const data = await response.json();
243
+
244
+ // Hide loading indicator
245
+ document.getElementById('loadingIndicator').style.display = 'none';
246
+
247
+ if (data.success) {
248
+ const updatedPlanDiv = document.getElementById('updatedPlan');
249
+ updatedPlanDiv.textContent = data.updated_plan;
250
+ // Add animation effect
251
+ setTimeout(() => {
252
+ updatedPlanDiv.classList.add('visible');
253
+ }, 50);
254
+ document.getElementById('responseSection').classList.remove('d-none');
255
+ } else {
256
+ alert('Error: ' + data.error);
257
+ }
258
+ } catch (error) {
259
+ document.getElementById('loadingIndicator').style.display = 'none';
260
+ alert('Error submitting feedback: ' + error);
261
+ }
262
+ });
263
+
264
+ // Poll for emergency notifications when in doctor view
265
+ setInterval(() => {
266
+ if (currentRole === 'doctor') {
267
+ fetchEmergencyNotifications();
268
+ }
269
+ }, 30000);
270
+ </script>
271
+ </body>
272
+ </html>