Skip to content

add patient filter to token queue#16103

Open
Jacobjeevan wants to merge 2 commits intoohcnetwork:developfrom
Jacobjeevan:queue-patient-filter
Open

add patient filter to token queue#16103
Jacobjeevan wants to merge 2 commits intoohcnetwork:developfrom
Jacobjeevan:queue-patient-filter

Conversation

@Jacobjeevan
Copy link
Contributor

@Jacobjeevan Jacobjeevan commented Mar 13, 2026

Proposed Changes

Fixes #15842

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

Release Notes

  • New Features

    • Added patient identifier filtering to ongoing queue search functionality.
  • Style

    • Improved responsive design for queue management interface and controls.
    • Enhanced text handling with truncation for long service point and queue names.
    • Optimized layout spacing and button sizing for better visual consistency.

@netlify
Copy link

netlify bot commented Mar 13, 2026

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit db67ad0
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/69b3e63b5b9414000826dd56
😎 Deploy Preview https://deploy-preview-16103.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

Walkthrough

Added PatientIdentifierFilter component to ongoing queue search UI with composite query parameter handling including patient_filter and patient_name. Updated ServicePointsDropDown.tsx with adjusted responsive breakpoints, container sizing, and text truncation for improved layout handling of long names.

Changes

Cohort / File(s) Summary
Ongoing Queue Patient Filtering
src/pages/Facility/queues/ManageQueueOngoingTab.tsx
Introduced PatientIdentifierFilter component with composite query parameter handling. Updated search input onChange to manage patient_filter and patient_name. Expanded search container to full width and propagated patient-filtered results through OngoingQueueTokenCardsList queries.
Service Points UI Refinements
src/pages/Facility/queues/ServicePointsDropDown.tsx
Adjusted responsive breakpoints for visible service points (4 instead of 2). Modified container sizing with responsive button group width (w-full sm:w-auto), reduced padding, and trigger button height (h-9 from h-11). Added text truncation for long service point and sub-queue names.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly identifies the main feature addition (patient filter) in the token queue UI, directly matching the primary changeset focus.
Description check ✅ Passed Description references issue #15842 and includes the merge checklist template, but lacks specific details about the changes and reasoning.
Linked Issues check ✅ Passed Code changes implement patient filter functionality in token queue UI, directly addressing issue #15842's requirement to add Patient QR support.
Out of Scope Changes check ✅ Passed All changes are within scope: patient filter implementation in ManageQueueOngoingTab and styling adjustments to ServicePointsDropDown related to queue UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🚀 Preview Deployment Ready!

🔗 Preview URL: https://pr-16103.care-preview-a7w.pages.dev

📱 Mobile Access:
Scan the QR code below to open the preview on your mobile device.

QR Code


This preview will be automatically updated when you push new commits to this PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds patient identifier-based filtering to the token queue “Ongoing” view (supporting Patient QR / identifier selection), and adjusts queue header UI layout for better responsiveness.

Changes:

  • Adds PatientIdentifierFilter to ManageQueueOngoingTab, persisting selection in URL query params and sending patient_filter to the token list query.
  • Refactors the search/filter header layout to work better on smaller screens.
  • Tweaks ServicePointsDropDown to show more assigned service points by default and truncate long names.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/pages/Facility/queues/ManageQueueOngoingTab.tsx Introduces patient identifier filter UI and forwards patient_filter into token list query params.
src/pages/Facility/queues/ServicePointsDropDown.tsx Updates responsive layout and chip rendering for assigned service points.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +104 to +106
delete qParams.patient_filter;
delete qParams.patient_name;
setQueryParams(qParams, { replace: true });
<Button
variant="ghost"
className="rounded-l-none w-10 h-11 border border-gray-300 bg-white"
className="rounded-l-none w-10 h-9 border border-gray-300 bg-white"
Comment on lines +93 to +103
<PatientIdentifierFilter
onSelect={(patientId, patientName) => {
if (patientId && patientName) {
setQueryParams(
{
patient_filter: patientId,
patient_name: patientName,
},
{ overwrite: false, replace: true },
);
} else {
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/Facility/queues/ManageQueueOngoingTab.tsx`:
- Around line 61-62: The component is persisting patient_name in qParams which
risks exposing PHI; update ManageQueueOngoingTab to stop reading/writing
patient_name to the URL—only keep patient_filter in qParams and move patient
display name into component/local state (e.g., useState) for rendering. Locate
where qParams is destructured (const { autoRefresh, search, patient_filter,
patient_name } = qParams) and remove patient_name from qParams usage, and change
any setQParams or URL update calls that include patient_name to only set
patient_filter. Ensure any UI that shows the patient's name reads from the new
local state and that local state is populated from the API response (summary or
selection) instead of the query string.

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx`:
- Line 78: The loading skeleton height mismatches the final trigger button
(trigger uses className containing h-9 while the skeleton renders h-11), causing
layout shift; open the ServicePointsDropDown component and change the skeleton
element's height class from h-11 to h-9 so it matches the trigger button (also
verify any other skeleton/placeholder in ServicePointsDropDown uses h-9 and
update them to match the trigger's className).
- Line 21: The chips are fixed-width and the default visible count
(defaultServicePoints via useBreakpoints) is increased causing overflow on
narrow screens; change the defaultServicePoints fallback to a smaller value
(e.g., 2) and remove the hard `w-48` sizing on the chip elements in
ServicePointsDropDown, replacing it with responsive styling (e.g., flexible
width, max-w/full, flex-shrink and text-truncate or ellipsis) so chips wrap or
shrink on mobile; update any other occurrences around the component (the
useBreakpoints call and the chip JSX that currently uses `w-48`) to use the new
responsive classes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8e03499a-b38d-4d5d-a957-5bf45e9d8367

📥 Commits

Reviewing files that changed from the base of the PR and between c6cd9a3 and db67ad0.

📒 Files selected for processing (2)
  • src/pages/Facility/queues/ManageQueueOngoingTab.tsx
  • src/pages/Facility/queues/ServicePointsDropDown.tsx

Comment on lines +61 to 62
const { autoRefresh, search, patient_filter, patient_name } = qParams;
const { data: summary } = useQuery({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid storing patient names in URL query params (PHI exposure risk).

Line 99 persists patient_name in the URL. In a healthcare flow, this can leak PHI via history, logs, analytics, and shared links. Keep only patient_filter in query params; keep display name in local state.

Proposed fix
   const [qParams, setQueryParams] = useQueryParams();
-  const { autoRefresh, search, patient_filter, patient_name } = qParams;
+  const { autoRefresh, search, patient_filter } = qParams;
+  const [selectedPatientName, setSelectedPatientName] = useState("");

             <PatientIdentifierFilter
               onSelect={(patientId, patientName) => {
                 if (patientId && patientName) {
+                  setSelectedPatientName(patientName);
                   setQueryParams(
                     {
                       patient_filter: patientId,
-                      patient_name: patientName,
                     },
                     { overwrite: false, replace: true },
                   );
                 } else {
-                  delete qParams.patient_filter;
-                  delete qParams.patient_name;
-                  setQueryParams(qParams, { replace: true });
+                  setSelectedPatientName("");
+                  const { patient_filter: _removed, ...nextParams } = qParams;
+                  setQueryParams(nextParams, { replace: true });
                 }
               }}
               placeholder={t("filter_by_identifier")}
               className="w-full sm:w-auto rounded-md h-9 text-gray-500 shadow-sm"
               patientId={patient_filter}
-              patientName={patient_name}
+              patientName={selectedPatientName}
             />
As per coding guidelines, "Handle patient data with appropriate privacy considerations in healthcare page components."

Also applies to: 94-107, 112-113

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Facility/queues/ManageQueueOngoingTab.tsx` around lines 61 - 62,
The component is persisting patient_name in qParams which risks exposing PHI;
update ManageQueueOngoingTab to stop reading/writing patient_name to the
URL—only keep patient_filter in qParams and move patient display name into
component/local state (e.g., useState) for rendering. Locate where qParams is
destructured (const { autoRefresh, search, patient_filter, patient_name } =
qParams) and remove patient_name from qParams usage, and change any setQParams
or URL update calls that include patient_name to only set patient_filter. Ensure
any UI that shows the patient's name reads from the new local state and that
local state is populated from the API response (summary or selection) instead of
the query string.

const { assignedServicePointIds, allServicePoints, toggleServicePoint } =
useQueueServicePoints();
const defaultServicePoints = useBreakpoints({ default: 2, sm: 6 });
const defaultServicePoints = useBreakpoints({ default: 4, sm: 6 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fixed-width chips plus higher default count can overflow mobile layouts.

Line 21 increases visible chips to 4 by default, and Line 54 forces each chip to w-48. On narrow screens this can overflow and hide content/actions.

Proposed fix
-  const defaultServicePoints = useBreakpoints({ default: 4, sm: 6 });
+  const defaultServicePoints = useBreakpoints({ default: 2, sm: 4 });

-      <div className="flex w-full sm:w-auto gap-1 rounded-r-none border border-r-0 border-gray-300 rounded-l-md p-1 bg-white">
+      <div className="flex w-full sm:w-auto gap-1 rounded-r-none border border-r-0 border-gray-300 rounded-l-md p-1 bg-white overflow-x-auto">

-                    className="flex w-48 items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap"
+                    className="flex min-w-0 max-w-48 items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50"

Also applies to: 38-38, 54-57

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` at line 21, The chips
are fixed-width and the default visible count (defaultServicePoints via
useBreakpoints) is increased causing overflow on narrow screens; change the
defaultServicePoints fallback to a smaller value (e.g., 2) and remove the hard
`w-48` sizing on the chip elements in ServicePointsDropDown, replacing it with
responsive styling (e.g., flexible width, max-w/full, flex-shrink and
text-truncate or ellipsis) so chips wrap or shrink on mobile; update any other
occurrences around the component (the useBreakpoints call and the chip JSX that
currently uses `w-48`) to use the new responsive classes.

<Button
variant="ghost"
className="rounded-l-none w-10 h-11 border border-gray-300 bg-white"
className="rounded-l-none w-10 h-9 border border-gray-300 bg-white"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Loading state height no longer matches the final trigger button height.

Line 78 uses h-9, but the loading skeleton in this component still renders with h-11, causing a layout shift when data loads.

Proposed fix
-        <Skeleton className="h-11 w-40 rounded-r-none rounded-l-md" />
-        <Skeleton className="h-11 w-10 rounded-l-none rounded-r-md" />
+        <Skeleton className="h-9 w-40 rounded-r-none rounded-l-md" />
+        <Skeleton className="h-9 w-10 rounded-l-none rounded-r-md" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` at line 78, The loading
skeleton height mismatches the final trigger button (trigger uses className
containing h-9 while the skeleton renders h-11), causing layout shift; open the
ServicePointsDropDown component and change the skeleton element's height class
from h-11 to h-9 so it matches the trigger button (also verify any other
skeleton/placeholder in ServicePointsDropDown uses h-9 and update them to match
the trigger's className).

@github-actions
Copy link

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 3

Metric Count
Total Tests 271
✅ Passed 271
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #7370

@parvathyns-creator
Copy link

@nihal467 looks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Patient QR in Token Queue

3 participants