Skip to content

Fix Food Queue patient count mismatch in Camp Map population counts

Damanagari Sathwika requested to merge fix/patient-count into develop

Merge Request

Overview

Fix Food Queue population count mismatch between Camp Map and Food Queue page.

What does this MR do and why?

This MR fixes an inconsistency where the Camp Map Food Queue tile displayed an incorrect patient count (P0) even when patients were visible in the Food Queue page.

Root cause:

  • Food Queue page and Camp Map population count endpoint were using different backend query logic.
  • Food Queue listing correctly returned food patients.
  • /stations/population-counts used different/outdated filtering for food area, causing incorrect patient_count.

Approach:

  • Aligned Food Queue population count logic with the Food Queue patient listing query.
  • Ensured both Camp Map and Food Queue page use the same backend filtering logic.

No workflow or business logic changes were introduced.

Changes Made

  • Modified backend population count logic for food area
  • Reused Food Queue listing query/filter logic for Camp Map count calculation
  • Ensured patient_count for food reflects actual Food Queue patients

Technical Details

Root cause:

  • Food Queue endpoint and population-count endpoint used different filters for Food Queue patients.

Fix:

  • Updated population count calculation to use the same logic as Food Queue patient retrieval.
  • Camp Map Food Queue tile now reflects actual Food Queue patients.

No database schema or migration changes.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • 💥 Breaking change
  • 📝 Documentation update
  • ️ Refactor
  • Performance improvement
  • 🧪 Test update
  • 🔧 Configuration change
  • 🚨 Security fix
  • 🗑️ Deprecation

Related Issues / References

#117 (closed)

Screenshots or Screen Recordings

Before:

  • Food Queue page showed patients
  • Camp Map Food Queue tile displayed incorrect P count

After:

  • Camp Map Food Queue tile matches Food Queue patient count

How to Validate Locally

  1. Start backend and frontend
  2. Register or move a patient to Food Queue
  3. Open Food Queue page and note total patients
  4. Return to Camp Map
  5. Verify Food Queue tile P count matches Food Queue page count

Expected:

  • Food Queue page and Camp Map show identical patient counts.

Testing Done

  • Unit tests added/updated
  • API endpoint tests passing

Test Cases Covered:

Scenario Expected Result Status
Patient exists in Food Queue Food Queue page shows patient
Food Queue tile count Camp Map count matches Food Queue page
No Food Queue patients Camp Map shows P0

Test Commands Run:

pytest

Code Quality Checklist
Code Standards

/assign me
Edited by Damanagari Sathwika

Merge request reports

Loading