fix: correct KYP flow and remove queue dependency before doctor assignment
Overview
This MR fixes the KYP (Know Your Patient) flow and improves the KYP page UI. It ensures that KYP acts as a proper pre-processing step before doctor assignment without interfering with the queue lifecycle.
What does this MR do and why?
Previously, after submitting KYP, the frontend was triggering a queue status update API before doctor assignment. Since no queue record existed at that stage, it resulted in a 404 error and displayed a false "Failed to submit KYP" message, even though the data was saved successfully.
This MR corrects the flow by removing the premature queue API call and ensures proper navigation. Additionally, the KYP UI is simplified by removing unnecessary patient info display.
Changes Made
- Removed queue status update API call from KYP submission flow
- Fixed incorrect error handling that showed failure despite successful KYP save
- Ensured correct navigation flow: Registration → KYP → Doctor Assignment
- Removed patient info section from KYP page for cleaner UI
- Improved user experience by avoiding misleading error messages
Related Issues / References
closes #309 (closed)
Screenshots or Screen Recordings
Screencast_from_2026-04-15_21-04-05Screencast_from_2026-04-15_21-05-47
Technical Details
Root Cause:
- Queue API was being called before doctor assignment, causing a 404 error
- Error handling treated this as KYP failure
Fix:
- Removed queue API call from KYP submission
- Ensured navigation happens immediately after successful KYP save
- UI cleanup by removing unnecessary patient info rendering
Type of Change
-
🐛 Bug fix (non-breaking change that fixes an issue) -
🎨 UI/UX improvement
How to Set Up and Validate Locally
-
Checkout this branch
-
Install dependencies: bun install
-
Run the app: bun dev
-
Test flow:
- Register a new patient
- Complete KYP form
- Submit KYP
-
Expected behavior:
- No error message on submit
- Redirects to doctor assignment
- KYP data is saved correctly
Testing Done
-
Manual testing completed
Test Cases Covered:
| Scenario | Expected Result | Status |
|---|---|---|
| Submit KYP for new patient | Redirect to doctor assignment without error | |
| Verify KYP data persistence | Data should be saved and visible | |
| Ensure no queue call before doctor assignment | No 404 error |
Documentation
-
CHANGELOG.md updated
Known Limitations / Technical Debt
- KYP and patient data are still coupled in the same API; can be separated in future for better architecture
Additional Notes
- This change does not affect existing registration or doctor assignment logic
- Queue lifecycle remains unchanged and starts only after doctor assignment
