d310h commited on
Commit
744a384
·
verified ·
1 Parent(s): 7ce2f25

add sqlite for its database

Browse files
Files changed (1) hide show
  1. index.html +116 -10
index.html CHANGED
@@ -7,7 +7,8 @@
7
  <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://unpkg.com/feather-icons"></script>
10
- <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
 
11
  <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script>
12
  <style>
13
  .wave-bg {
@@ -119,16 +120,16 @@
119
  <div class="flex flex-col items-center justify-center p-8 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50">
120
  <i data-feather="mic" class="h-10 w-10 text-gray-400 mb-3"></i>
121
  <p class="text-sm text-gray-500 mb-4">Record directly or upload an audio file</p>
122
- <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium">
123
  Start Recording
124
  </button>
125
- </div>
126
  <div class="text-center">
127
- <button class="text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center justify-center w-full">
128
  <i data-feather="upload" class="h-4 w-4 mr-2"></i>
129
  Upload Audio File
130
  </button>
131
- </div>
132
  </div>
133
  </div>
134
 
@@ -274,9 +275,58 @@
274
  </div>
275
  </div>
276
  </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
 
278
  <!-- Footer -->
279
- <footer class="bg-white border-t border-gray-200 mt-12">
280
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
281
  <div class="md:flex md:items-center md:justify-between">
282
  <div class="flex justify-center md:order-2 space-x-6">
@@ -298,10 +348,64 @@
298
  </div>
299
  </div>
300
  </footer>
301
-
302
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  // Initialize Vanta.js waves background
304
- VANTA.WAVES({
305
  el: "#wave-bg",
306
  color: 0x0066cc,
307
  waveHeight: 20,
@@ -309,9 +413,11 @@
309
  waveSpeed: 0.5,
310
  zoom: 0.8
311
  });
312
-
313
  // Initialize Feather Icons
314
  feather.replace();
315
- </script>
 
 
 
316
  </body>
317
  </html>
 
7
  <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/sql.js@1.8.0/dist/sql-wasm.js"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
12
  <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script>
13
  <style>
14
  .wave-bg {
 
120
  <div class="flex flex-col items-center justify-center p-8 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50">
121
  <i data-feather="mic" class="h-10 w-10 text-gray-400 mb-3"></i>
122
  <p class="text-sm text-gray-500 mb-4">Record directly or upload an audio file</p>
123
+ <button onclick="startRecording()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium">
124
  Start Recording
125
  </button>
126
+ </div>
127
  <div class="text-center">
128
+ <button onclick="uploadAudio()" class="text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center justify-center w-full">
129
  <i data-feather="upload" class="h-4 w-4 mr-2"></i>
130
  Upload Audio File
131
  </button>
132
+ </div>
133
  </div>
134
  </div>
135
 
 
275
  </div>
276
  </div>
277
  </main>
278
+ <!-- Transcription Modal -->
279
+ <div id="transcriptionModal" class="fixed inset-0 overflow-y-auto hidden z-50">
280
+ <div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
281
+ <div class="fixed inset-0 transition-opacity" aria-hidden="true">
282
+ <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
283
+ </div>
284
+ <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
285
+ <div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6">
286
+ <div>
287
+ <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-blue-100">
288
+ <i data-feather="mic" class="h-6 w-6 text-blue-600"></i>
289
+ </div>
290
+ <div class="mt-3 text-center sm:mt-5">
291
+ <h3 class="text-lg leading-6 font-medium text-gray-900" id="modalTitle">New Transcription</h3>
292
+ <div class="mt-2">
293
+ <div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
294
+ <div class="sm:col-span-3">
295
+ <label for="doctor-name" class="block text-sm font-medium text-gray-700">Doctor Name</label>
296
+ <input type="text" name="doctor-name" id="doctor-name" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
297
+ </div>
298
+ <div class="sm:col-span-3">
299
+ <label for="patient-name" class="block text-sm font-medium text-gray-700">Patient Name</label>
300
+ <input type="text" name="patient-name" id="patient-name" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
301
+ </div>
302
+ <div class="sm:col-span-6">
303
+ <label for="specialty" class="block text-sm font-medium text-gray-700">Specialty</label>
304
+ <select id="specialty" name="specialty" class="mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
305
+ <option>Cardiology</option>
306
+ <option>Pediatrics</option>
307
+ <option>Orthopedics</option>
308
+ <option>Neurology</option>
309
+ <option>Dermatology</option>
310
+ </select>
311
+ </div>
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ <div class="mt-5 sm:mt-6 sm:grid sm:grid-cols-2 sm:gap-3 sm:grid-flow-row-dense">
317
+ <button type="button" onclick="document.getElementById('transcriptionModal').classList.add('hidden');" class="w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:col-start-1 sm:text-sm">
318
+ Cancel
319
+ </button>
320
+ <button type="button" onclick="saveNewTranscription()" class="mt-3 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:col-start-2 sm:text-sm">
321
+ Save Transcription
322
+ </button>
323
+ </div>
324
+ </div>
325
+ </div>
326
+ </div>
327
 
328
  <!-- Footer -->
329
+ <footer class="bg-white border-t border-gray-200 mt-12">
330
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
331
  <div class="md:flex md:items-center md:justify-between">
332
  <div class="flex justify-center md:order-2 space-x-6">
 
348
  </div>
349
  </div>
350
  </footer>
 
351
  <script>
352
+ // Initialize SQLite database
353
+ let db;
354
+ async function initDB() {
355
+ const SQL = await initSqlJs({
356
+ locateFile: file => `https://cdn.jsdelivr.net/npm/sql.js@1.8.0/dist/${file}`
357
+ });
358
+ db = new SQL.Database();
359
+
360
+ // Create tables if they don't exist
361
+ db.run(`
362
+ CREATE TABLE IF NOT EXISTS transcriptions (
363
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
364
+ doctor_name TEXT NOT NULL,
365
+ patient_name TEXT NOT NULL,
366
+ specialty TEXT NOT NULL,
367
+ recording_date TEXT NOT NULL,
368
+ duration INTEGER NOT NULL,
369
+ status TEXT NOT NULL,
370
+ due_date TEXT NOT NULL,
371
+ audio_file BLOB,
372
+ transcription_text TEXT
373
+ );
374
+ `);
375
+
376
+ db.run(`
377
+ CREATE TABLE IF NOT EXISTS patients (
378
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
379
+ name TEXT NOT NULL,
380
+ last_visit TEXT NOT NULL,
381
+ department TEXT NOT NULL
382
+ );
383
+ `);
384
+
385
+ // Insert sample data if empty
386
+ const transcriptionsCount = db.exec("SELECT COUNT(*) FROM transcriptions")[0].values[0][0];
387
+ if (transcriptionsCount === 0) {
388
+ db.run(`INSERT INTO transcriptions (doctor_name, patient_name, specialty, recording_date, duration, status, due_date)
389
+ VALUES ('Dr. Michael Chen', 'John Peterson', 'Cardiology', '2023-02-15 08:42:00', 12, 'Completed', '2023-02-15 17:00:00')`);
390
+ db.run(`INSERT INTO transcriptions (doctor_name, patient_name, specialty, recording_date, duration, status, due_date)
391
+ VALUES ('Dr. Lisa Rodriguez', 'Sarah Williams', 'Pediatrics', '2023-02-14 15:15:00', 18, 'In Progress', '2023-02-16 10:00:00')`);
392
+ db.run(`INSERT INTO transcriptions (doctor_name, patient_name, specialty, recording_date, duration, status, due_date)
393
+ VALUES ('Dr. James Wilson', 'Robert Johnson', 'Orthopedics', '2023-02-14 11:30:00', 22, 'Pending', '2023-02-15 12:00:00')`);
394
+ }
395
+
396
+ const patientsCount = db.exec("SELECT COUNT(*) FROM patients")[0].values[0][0];
397
+ if (patientsCount === 0) {
398
+ db.run(`INSERT INTO patients (name, last_visit, department)
399
+ VALUES ('John D. Peterson', '2023-02-10', 'Cardiology')`);
400
+ db.run(`INSERT INTO patients (name, last_visit, department)
401
+ VALUES ('Sarah M. Williams', '2023-02-08', 'Pediatrics')`);
402
+ db.run(`INSERT INTO patients (name, last_visit, department)
403
+ VALUES ('Robert T. Johnson', '2023-02-12', 'Orthopedics')`);
404
+ }
405
+ }
406
+
407
  // Initialize Vanta.js waves background
408
+ VANTA.WAVES({
409
  el: "#wave-bg",
410
  color: 0x0066cc,
411
  waveHeight: 20,
 
413
  waveSpeed: 0.5,
414
  zoom: 0.8
415
  });
 
416
  // Initialize Feather Icons
417
  feather.replace();
418
+
419
+ // Initialize database when page loads
420
+ document.addEventListener('DOMContentLoaded', initDB);
421
+ </script>
422
  </body>
423
  </html>