Skip to content

fix: modified the patient status

Vandana reddy Balannagari requested to merge fix/status-update into develop

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

status-update_

Before After
Medicine Prescription shown as completed prematurely Correctly shown as In Progress until completion

How to Set Up and Validate Locally

  1. Checkout branch and pull latest changes
  2. Run: bun install
  3. Run: bun dev
  4. Register a patient and move through workflow stages
  5. Verify tracker behavior:
    • Blue icon during active stage
    • Green check only after completion
  6. 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)

Edited by Vandana reddy Balannagari

Merge request reports

Loading