fix: modified the patient status
Overview
This MR fixes incorrect behavior in the Patient Status Tracker where stages—especially "Medicine Prescription"—were being marked as completed prematurely. The update ensures that status progression reflects actual patient movement across queues instead of event-based triggers, improving workflow accuracy and UI consistency.
What does this MR do and why?
Previously, the tracker used event-driven logic which marked stages as completed immediately after an action, even if the patient had not progressed in the workflow. This caused incorrect UI states and confusion for users. This MR introduces queue-aware progression logic so that completion is determined only when a patient moves to the next queue. It also improves terminology to better represent ongoing vs completed states.
Changes Made
- Renamed "Medicines Prescribed" to "Medicine Prescription" across components, translation files (en, te, hi), and documentation
- Updated usePatientStatus.ts with queue-aware logic
- Added isConsultationCompleted check based on queue transitions
- Fixed premature status completion issue
- Updated UI icons: Blue for In Progress, Green for Completed
- Fixed volunteer workflow bug allowing prescription actions in correct queue
- Updated Volunteer Manual
- Fixed .husky/pre-commit hook by removing redundant commitlint checks
- Updated and validated test suites with 1700+ passing tests
Technical Details
Root cause: status logic was event-driven instead of queue-based, leading to incorrect stage completion. Fix: implemented queue-driven state evaluation where completion depends on movement to subsequent queues. This ensures synchronization between frontend and backend workflow and prevents false completion states.
Type of Change
-
🐛 Bug fix (non-breaking change that fixes an issue) -
🎨 UI/UX improvement -
♻ ️ Refactor (no functional changes) -
🧪 Test update -
📝 Documentation update -
🔧 Configuration change
Related Issues / References
- Fixes patient status tracker incorrect progression
- Related to queue-based workflow improvements
- Test files: usePatientStatus.test.tsx, PatientStatusTracker.test.tsx :contentReference[oaicite:0]{index=0}
Screenshots or Screen Recordings
| Before | After |
|---|---|
| Medicine Prescription shown as completed prematurely | Correctly shown as In Progress until completion |
How to Set Up and Validate Locally
- Checkout branch and pull latest changes
- Run: bun install
- Run: bun dev
- Register a patient and move through workflow stages
- Verify tracker behavior:
- Blue icon during active stage
- Green check only after completion
- Ensure no incorrect blocking messages appear
Testing Done
-
Manual testing completed -
Unit tests updated
Test Cases Covered:
| Scenario | Expected Result | Status |
|---|---|---|
| Consultation completion based on queue | Marked complete only after queue transition | |
| Prescription stage active state | Blue icon shown | |
| Final stage completion | Green check shown | |
| Volunteer workflow | No incorrect blocking message |
Code Quality Checklist
Code Standards
-
Code follows project conventions -
No console.log() or debugger -
No unused imports or variables -
No duplicate code -
i18n compliant -
Proper TypeScript types -
ESLint/Prettier pass
React Best Practices
-
Proper component structure -
Hooks follow rules -
Efficient state management -
No unnecessary re-renders -
Proper event handling
Component Patterns
-
shadcn/ui usage correct -
Tailwind classes correct -
Responsive design considered -
Accessibility handled -
Consistent icons
API & Data Fetching
-
Proper state sync with backend -
Loading/error states handled -
API types maintained
Error Handling
-
Errors handled gracefully -
User-friendly messages -
No false error states
Documentation
-
Volunteer manual updated -
i18n updated
Known Limitations / Technical Debt
- Future workflow stages may require extending queue logic
- Depends on backend queue accuracy
Additional Notes
- Introduces queue-driven architecture for status tracking
- Prevents premature completion issues
- Improves UI accuracy and workflow consistency
- No breaking changes introduced
MR Acceptance Checklist
Evaluate this MR against the GitLab MR acceptance checklist to ensure quality, performance, and maintainability. closes #329 (closed)