Skip to content

fix(patient-status): include full queue workflow statuses in patient status response

Lakshy Yarlagadda requested to merge fix/status_fetch into develop

Updated GET /api/v1/patients/{book_no}/status to return the full workflow status timeline by combining PatientVisitDetails.status with the latest queue progression for the latest camp.

Changes

  • Removed the consultation_completed-only queue filter.
  • Pulled latest relevant queue record for the patient in the latest camp.
  • Added queue progression statuses up to current queue state:
    • know_your_patient
    • waiting
    • in_consultation (only when consultation actually started)
    • post-consultation statuses as applicable
  • Kept direct waiting -> consultation_completed behavior correct by not forcing in_consultation when consultation_started_at is null.
  • Normalized status output order and preserved unknown/legacy statuses.

Files changed

  • app/api/v1/routes/patient_routes.py
  • tests/test_api/test_patient_routes.py

Validation

  • Passed: uv run pytest -q tests/test_api/test_patient_routes.py -k "get_patient_status"
  • Note: full file run still shows pre-existing unrelated PatientCreate validation test failures.

Merge request reports

Loading