fix: Improved the Update Prescription flow and medicine validation handling
Overview
Improved the Prescriptions and Verify Medicines multi-consultation workflow by simplifying consultation handling, improving queue transitions, and adding support for consultations without prescriptions.
What does this MR do and why?
Previously, the Prescriptions and Verify Medicines workflow had multiple usability and workflow issues for patients with multiple consultations.
This MR improves the overall consultation workflow by simplifying consultation handling, improving validation, and ensuring smoother queue progression.
Changes Made
- Improved Update Prescription workflow handling
- Added validation to prevent consultation progression without proper medicine selection
- Updated medicine validation error message
- Fixed translation key rendering issue
- Improved multi-consultation handling flow
- Improved Verify Medicines workflow behavior
- Added support for consultations without prescriptions
- Prevented invalid queue transitions
- Improved counselling queue movement logic
Technical Details
- Updated consultation validation flow before counselling transition
- Added handling for consultations without prescriptions
- Improved consultation status update logic
- Updated i18n translation handling for medicine validation messages
- Improved multi-consultation workflow management
- Prevented premature queue redirection during verification flow
Type of Change
-
🐛 Bug fix (non-breaking change that fixes an issue) -
✨ New feature (non-breaking change that adds functionality) -
💥 Breaking change (fix or feature that would cause existing functionality to change) -
📝 Documentation update -
🎨 UI/UX improvement -
♻ ️ Refactor (no functional changes) -
⚡ Performance improvement -
🧪 Test update -
🔧 Configuration change -
🚨 Security fix
Related Issues / References
- closes #336 (closed)
Screenshots or Screen Recordings
| Before | After |
|---|---|
| Popup/separate screen based workflow with queue transition issues | Improved consultation workflow with validation and smoother queue handling |
Screencast_from_2026-05-13_11-02-29
How to Set Up and Validate Locally
- Checkout this branch
- Install dependencies:
bun install - Run the development server:
bun dev - Navigate to Prescriptions / Verify Medicines queue
- Test patient flow with:
- Single consultation
- Multiple consultations
- Consultation without prescriptions
- Verify:
- Proper medicine validation
- Queue transition behavior
- Counselling movement
- Translation messages
- Multi-consultation handling
Testing Done
-
Manual testing completed -
Unit tests added/updated
Test Cases Covered:
| Scenario | Expected Result | Status |
|---|---|---|
| Continue without selecting medicine | Validation message displayed | |
| Move to counselling without medicines | Transition blocked | |
| Multi-consultation verification flow | Remaining consultations continue properly | |
| Consultation without prescription | Workflow completes successfully | |
| Translation validation message | Correct message displayed |
Code Quality Checklist
Code Standards
-
Code follows project conventions (naming, structure, formatting) -
No console.log() or debugger statements left in code -
No unused imports, variables, or functions -
No duplicate code and use of existing components for reusability -
i18n check passed with no hardcoded strings in codebase for i18n support -
TypeScript types are properly defined (no anyunless justified) -
ESLint and Prettier checks pass
React Best Practices
-
Components are properly split and single-responsibility -
Hooks follow rules (no conditional hooks, proper dependencies) -
State management is appropriate (local vs global state) -
No unnecessary re-renders (memoization used where needed) -
Event handlers are properly cleaned up
Component Patterns
-
shadcn/ui components used correctly -
Tailwind classes follow utility-first approach -
Responsive design considered (mobile-first if applicable) -
Accessibility attributes included (aria-*, role, etc.) -
Icons from lucide-react used consistently
API & Data Fetching
-
TanStack Query used for server state (if applicable) -
Loading and error states handled -
API types defined in src/types/api.ts -
Axios interceptors handle auth tokens correctly -
Use of Zod for data validations
Error Handling
-
Errors are caught and handled gracefully -
User-friendly error messages displayed -
Errors are being toasted properly -
Network failures handled appropriately
Documentation
-
README.md updated (if setup steps changed) -
.env.exampleupdated (if new env vars added) -
CHANGELOG.md updated (if applicable)
Known Limitations / Technical Debt
- Existing async test cases related to Verify Medicines and Update Prescription flows still require stabilization and mock cleanup.
Additional Notes
- Workflow improvements were implemented without affecting existing consultation handling logic.
- Multi-consultation queue flow behavior has been improved for better volunteer/pharmacy usability.
MR Acceptance Checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Rajuldev Vandana