Vineela Gampa commited on
Commit
0946fb8
·
unverified ·
1 Parent(s): 0d0f773

fixing the code yet another time

Browse files
Files changed (4) hide show
  1. backend.py +1 -21
  2. data/app.db +0 -0
  3. web/analyzer.html +1 -13
  4. web/past_data.html +1 -0
backend.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from fastapi import FastAPI, UploadFile, File, Form, HTTPException,APIRouter, Request
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from pydantic import BaseModel
@@ -102,15 +103,6 @@ class ChatRequest(BaseModel):
102
  class ChatResponse(BaseModel):
103
  answer: str
104
 
105
- class ReportData(BaseModel):
106
- user_id: str
107
- reportDate: Optional[str] = None
108
- ocr_text: Optional[str] = None
109
- resolutions: Optional[List[dict]] = []
110
- measurements: Optional[List[dict]] = []
111
- sync_timestamp: Optional[str] = None
112
-
113
-
114
  system_prompt_chat = """
115
  *** Role: Medical Guidance Facilitator
116
  *** Objective:
@@ -349,18 +341,6 @@ def analyze_text(text):
349
  def health():
350
  return {"response": "ok"}
351
 
352
- @app.route("/save_report/")
353
- async def save_report(report: ReportData):
354
- try:
355
- print(f"Received report from user {report.user_id}:")
356
- print(f"- Report Date: {report.reportDate}")
357
-
358
- report_dict = report.dict()
359
-
360
- except Exception as e:
361
- print(f"Error saving report: {traceback.format_exc()}")
362
- raise HTTPException(status_code=500, detail=f"Error saving report: {str(e)}")
363
-
364
  @app.on_event("startup")
365
  def _log_routes():
366
  from fastapi.routing import APIRoute
 
1
+ from ast import List
2
  from fastapi import FastAPI, UploadFile, File, Form, HTTPException,APIRouter, Request
3
  from fastapi.middleware.cors import CORSMiddleware
4
  from pydantic import BaseModel
 
103
  class ChatResponse(BaseModel):
104
  answer: str
105
 
 
 
 
 
 
 
 
 
 
106
  system_prompt_chat = """
107
  *** Role: Medical Guidance Facilitator
108
  *** Objective:
 
341
  def health():
342
  return {"response": "ok"}
343
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  @app.on_event("startup")
345
  def _log_routes():
346
  from fastapi.routing import APIRoute
data/app.db CHANGED
Binary files a/data/app.db and b/data/app.db differ
 
web/analyzer.html CHANGED
@@ -232,11 +232,6 @@
232
  accept=".pdf, image/*"
233
  class="w-full mb-4 rounded px-3 py-2"
234
  />
235
- <input
236
- type="date"
237
- id="report-date"
238
- class="w-full mb-4 rounded px-3 py-2"
239
- />
240
  <button id="analyze-btn" class="btn-primary px-4 py-2 rounded">
241
  Analyze with AI
242
  </button>
@@ -452,15 +447,10 @@
452
  .getElementById("analyze-btn")
453
  .addEventListener("click", async () => {
454
  const file = document.getElementById("pdf-upload").files[0];
455
- const date = document.getElementById("report-date").value;
456
  if (!file) {
457
  loadingEl.textContent = "Please upload a file first.";
458
  return;
459
  }
460
- if (!date) {
461
- loadingEl.textContent = "Please select the report date.";
462
- return;
463
- }
464
 
465
  loadingEl.textContent = "Processing with AI...";
466
  textOutput.textContent = "";
@@ -509,9 +499,7 @@
509
  findingsOutput.innerHTML = findings
510
  .map((finding, i) => renderRecCard(finding, i))
511
  .join("");
512
- } else {
513
- findingsOutput.textContent = "No measurements found.";
514
- }
515
 
516
  if (currentUser) {
517
  /*await saveAnalysis(currentUser.uid, {
 
232
  accept=".pdf, image/*"
233
  class="w-full mb-4 rounded px-3 py-2"
234
  />
 
 
 
 
 
235
  <button id="analyze-btn" class="btn-primary px-4 py-2 rounded">
236
  Analyze with AI
237
  </button>
 
447
  .getElementById("analyze-btn")
448
  .addEventListener("click", async () => {
449
  const file = document.getElementById("pdf-upload").files[0];
 
450
  if (!file) {
451
  loadingEl.textContent = "Please upload a file first.";
452
  return;
453
  }
 
 
 
 
454
 
455
  loadingEl.textContent = "Processing with AI...";
456
  textOutput.textContent = "";
 
499
  findingsOutput.innerHTML = findings
500
  .map((finding, i) => renderRecCard(finding, i))
501
  .join("");
502
+ }
 
 
503
 
504
  if (currentUser) {
505
  /*await saveAnalysis(currentUser.uid, {
web/past_data.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="UTF-8">
5
  <title>Past Analyzes - CTRL + ALT + HEAL</title>
6
  <script src="https://cdn.tailwindcss.com"></script>
 
7
  </head>
8
  <body class="bg-[#F7F8F9] min-h-screen">
9
  <nav class="bg-white border border-gray-200 px-6 py-4 mb-8">
 
4
  <meta charset="UTF-8">
5
  <title>Past Analyzes - CTRL + ALT + HEAL</title>
6
  <script src="https://cdn.tailwindcss.com"></script>
7
+ <script src="script.js"></script>
8
  </head>
9
  <body class="bg-[#F7F8F9] min-h-screen">
10
  <nav class="bg-white border border-gray-200 px-6 py-4 mb-8">