docs: add API documentation for frontend integration and include response timing metrics

This commit is contained in:
2026-08-31 11:14:55 +05:30
parent 29475dffcf
commit 4e21d617ce
3 changed files with 270 additions and 440 deletions
@@ -350,6 +350,7 @@ async def complete_voice_onboarding(
request: CompleteOnboardingRequest,
db: Session = Depends(get_db),
):
start_time = time.time()
onboarding_service = OnboardingService()
completion_service = CompletionService()
result_service = ResultExtractionService()
@@ -384,6 +385,10 @@ async def complete_voice_onboarding(
conversation_history=conversation_history,
)
elapsed = time.time() - start_time
resp_ms = round(elapsed * 1000, 2)
resp_sec = round(elapsed, 3)
if not request.confirmed:
return CompleteOnboardingResponse(
success=True,
@@ -391,6 +396,8 @@ async def complete_voice_onboarding(
status="awaiting_confirmation",
result=result,
message="Please review the collected information and confirm by voice or tap.",
response_time_ms=resp_ms,
response_time_sec=resp_sec,
)
submission = await submission_service.submit(result)
@@ -407,6 +414,8 @@ async def complete_voice_onboarding(
status="submitted_and_cleaned",
result=result,
message="Voice onboarding successfully saved to patient record.",
response_time_ms=resp_ms,
response_time_sec=resp_sec,
)
session.status = "submission_pending_retry"
@@ -418,4 +427,6 @@ async def complete_voice_onboarding(
status="submission_pending_retry",
result=result,
message="Patient API submission failed. Session preserved for retry.",
response_time_ms=resp_ms,
response_time_sec=resp_sec,
)