blessedpug commited on
Commit
a4a400b
·
1 Parent(s): a1a13bb

Pre-Docker backup

Browse files
Files changed (3) hide show
  1. form_fill.py +1 -0
  2. main.py +4 -1
  3. requirements.txt +3 -2
form_fill.py CHANGED
@@ -89,5 +89,6 @@ def fill_medical_pdf(
89
  annotation.V = str(data_dict[key])
90
  annotation.AP = None # Remove old appearance so new value appears
91
  PdfWriter().write(output_pdf_path, template_pdf)
 
92
  return output_pdf_path
93
 
 
89
  annotation.V = str(data_dict[key])
90
  annotation.AP = None # Remove old appearance so new value appears
91
  PdfWriter().write(output_pdf_path, template_pdf)
92
+
93
  return output_pdf_path
94
 
main.py CHANGED
@@ -171,11 +171,14 @@ async def extract_medical_batch_endpoint(
171
 
172
  if html_path and os.path.exists(html_path):
173
  status_code_to_return = 200
 
174
  if "error_no_medical_form_images" in os.path.basename(html_path):
175
  status_code_to_return = 400
 
176
  return FileResponse(html_path, media_type='text/html', filename=os.path.basename(html_path), status_code=status_code_to_return)
177
  else:
178
- raise HTTPException(status_code=500, detail="Failed to generate consolidated HTML medical form. The batch function may have returned an invalid path or None, or the file doesn't exist.")
 
179
 
180
  except HTTPException as he:
181
  # General cleanup for HTTPExceptions raised within the main try
 
171
 
172
  if html_path and os.path.exists(html_path):
173
  status_code_to_return = 200
174
+ # Check if the returned path is for the error HTML page generated when no images are provided.
175
  if "error_no_medical_form_images" in os.path.basename(html_path):
176
  status_code_to_return = 400
177
+ # This endpoint now directly returns the HTML from the pipeline
178
  return FileResponse(html_path, media_type='text/html', filename=os.path.basename(html_path), status_code=status_code_to_return)
179
  else:
180
+ # This means extract_medical_info_batch returned None (e.g., no images were processed or HTML generation failed)
181
+ raise HTTPException(status_code=500, detail="Failed to generate consolidated HTML medical form. This could be due to no images or an internal error during HTML generation.")
182
 
183
  except HTTPException as he:
184
  # General cleanup for HTTPExceptions raised within the main try
requirements.txt CHANGED
@@ -76,7 +76,8 @@ typing-inspection==0.4.1
76
  typing_extensions==4.13.2
77
  tzdata==2025.2
78
  urllib3==2.4.0
79
- uvicorn==0.34.2
80
- websockets==15.0.1
 
81
  xxhash==3.5.0
82
  zstandard==0.23.0
 
76
  typing_extensions==4.13.2
77
  tzdata==2025.2
78
  urllib3==2.4.0
79
+ uvicorn==0.29.0
80
+ watchfiles==0.21.0
81
+ websockets==12.0
82
  xxhash==3.5.0
83
  zstandard==0.23.0