Commit
·
3cbb4d9
1
Parent(s):
4dff957
Fix: Correct method name in file upload endpoint
Browse files- src/api/routes.py +16 -8
src/api/routes.py
CHANGED
|
@@ -29,11 +29,18 @@ async def analyze_provider_notes(request: ProviderNotesRequest):
|
|
| 29 |
detail="Provider notes must be at least 10 characters long"
|
| 30 |
)
|
| 31 |
|
| 32 |
-
# Process through Groq service
|
| 33 |
-
result = await groq_service.
|
| 34 |
|
| 35 |
logger.info("Successfully processed coding request")
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
except HTTPException:
|
| 39 |
raise
|
|
@@ -72,7 +79,8 @@ async def upload_provider_notes_file(file: UploadFile = File(...)):
|
|
| 72 |
logger.info(f"Extracted {text_length} characters from {filename}")
|
| 73 |
|
| 74 |
# Step 2: Process extracted text through Groq LLM
|
| 75 |
-
|
|
|
|
| 76 |
|
| 77 |
logger.info(f"Successfully processed file: {filename}")
|
| 78 |
|
|
@@ -81,10 +89,10 @@ async def upload_provider_notes_file(file: UploadFile = File(...)):
|
|
| 81 |
success=True,
|
| 82 |
filename=filename,
|
| 83 |
extracted_text_length=text_length,
|
| 84 |
-
cpt_codes=coding_result.
|
| 85 |
-
cpt_explanation=coding_result.
|
| 86 |
-
icd_codes=coding_result.
|
| 87 |
-
icd_explanation=coding_result.
|
| 88 |
)
|
| 89 |
|
| 90 |
except HTTPException:
|
|
|
|
| 29 |
detail="Provider notes must be at least 10 characters long"
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# Process through Groq service - CORRECT METHOD NAME
|
| 33 |
+
result = await groq_service.analyze_provider_notes(provider_notes)
|
| 34 |
|
| 35 |
logger.info("Successfully processed coding request")
|
| 36 |
+
|
| 37 |
+
# Return response matching CodingResponse model
|
| 38 |
+
return CodingResponse(
|
| 39 |
+
cpt_codes=result.get("CPT", []),
|
| 40 |
+
cpt_explanation=result.get("CPT_explanation", ""),
|
| 41 |
+
icd_codes=result.get("ICD", []),
|
| 42 |
+
icd_explanation=result.get("ICD_explanation", "")
|
| 43 |
+
)
|
| 44 |
|
| 45 |
except HTTPException:
|
| 46 |
raise
|
|
|
|
| 79 |
logger.info(f"Extracted {text_length} characters from {filename}")
|
| 80 |
|
| 81 |
# Step 2: Process extracted text through Groq LLM
|
| 82 |
+
# FIXED: Use the correct method name 'analyze_provider_notes'
|
| 83 |
+
coding_result = await groq_service.analyze_provider_notes(extracted_text)
|
| 84 |
|
| 85 |
logger.info(f"Successfully processed file: {filename}")
|
| 86 |
|
|
|
|
| 89 |
success=True,
|
| 90 |
filename=filename,
|
| 91 |
extracted_text_length=text_length,
|
| 92 |
+
cpt_codes=coding_result.get("CPT", []),
|
| 93 |
+
cpt_explanation=coding_result.get("CPT_explanation", ""),
|
| 94 |
+
icd_codes=coding_result.get("ICD", []),
|
| 95 |
+
icd_explanation=coding_result.get("ICD_explanation", "")
|
| 96 |
)
|
| 97 |
|
| 98 |
except HTTPException:
|