Feat: Food Queue Frontend Integration
Refactoring Summary
Title
Implement Optional Food Queue Frontend Integration
Refactoring Type
-
🔄 Component Enhancement -
🔧 Technical Debt Reduction -
📚 Documentation Improvement
Current State
What Exists Now
The current frontend queue flow supports:
Registration → Vitals → Consultation → Medicine/Counselling
There is currently no Food Queue support in the frontend. After vitals completion, patients move directly into consultation and there is no mechanism to optionally add patients to food service.
Problems with Current Code
-
Missing Food Queue workflow -
No UI for food service tracking -
No dashboard visibility for food queue -
No optional queue action after vitals -
Backend Food Queue APIs cannot be utilized from frontend
Proposed Refactoring / Feature
Target State
Implement Food Queue as an OPTIONAL and independent queue after Vitals.
Target flow:
Registration → Vitals → Food Queue (Optional) → Consultation
Important Rules:
- Food Queue is NOT mandatory
- Consultation flow must continue normally
- Food Queue must not block or alter existing queue progression
- Food Queue behaves as a standalone service
- Existing medicine and counselling flow must remain untouched
Benefits
| Benefit | Description | Impact |
|---|---|---|
| Better Queue Visibility | Track food service separately | High |
| Improved Workflow | Optional food service support | High |
| Maintainability | Reuse existing queue patterns | Medium |
| User Experience | Simple optional action | High |
| Scalability | Enables future optional services | Medium |
Scope
In Scope
- Add Food Queue frontend integration
- Add Food tile/card in dashboard or Medical Camp Map
- Add Food Queue tab in Queue page
- Integrate Food Queue backend APIs
- Add optional "Add to Food Queue" action after vitals
- Loading, success and error handling
- Prevent duplicate queue additions
- Reuse existing queue components/hooks where possible
Out of Scope
- Backend Food Queue implementation
- Consultation workflow changes
- Medicine/Counselling workflow changes
- Existing queue transition redesign
Behavioral Preservation Tests
Scenario 1: Normal Consultation Flow Preserved
Given patient completes vitals
When Food Queue is not selected
Then patient should continue to consultation normally
And existing consultation flow remains unchanged
Scenario 2: Optional Food Queue
Given patient completes vitals
When user selects "Add to Food Queue"
Then patient is added to Food Queue
And consultation flow remains unaffected
Scenario 3: Duplicate Prevention
Given patient already has pending food queue
When Add to Food Queue is clicked again
Then duplicate queue addition should be prevented
Technical Specification
Files to Create
| File Path | Purpose |
|---|---|
| src/services/foodQueueApi.ts | Food Queue API integration |
| src/components/FoodQueueTable.tsx | Food Queue list UI |
| src/types/foodQueue.ts | Food Queue types/interfaces |
Files to Modify
| File Path | Changes |
|---|---|
| Vitals Page | Add optional Food Queue action |
| Queue Page | Add Food Queue tab |
| Dashboard / Camp Map | Add Food Queue tile |
| Existing API Layer | Register Food Queue endpoints |
API Integration
Use backend endpoints:
POST /food-queue/add
GET /food-queue
PATCH /food-queue/{id}/complete
PATCH /food-queue/{id}/skip
UI Requirements
Food Queue Page should show:
- Book Number
- Patient Name
- Age/Gender
- Queue Status
- Added Time
Vitals flow should include optional action:
- Add to Food Queue or
- Send to Food
Rules:
- Do NOT auto-add every patient
- Disable button if already pending/completed
- Show loading states
- Show success/error toast messages
- Match existing queue UI and design system
- Reuse queue hooks/components where possible
- Keep implementation modular
Verification
Manual Testing Checklist
-
Food tile visible -
Food Queue tab visible -
Food Queue API fetch works -
Add to Food Queue works -
Complete Food Queue works -
Skip Food Queue works -
Consultation flow still works -
No regressions in existing queues -
No console errors -
No API integration issues
Goal
Implement Food Queue as a standalone OPTIONAL frontend queue service after Vitals without affecting or blocking the mandatory consultation flow.