Skip to content

WEB-4654 - Data Recency - #1986

Open
henry-tp wants to merge 22 commits into
WEB-4654-tagsfrom
WEB-4654-data-recency
Open

WEB-4654 - Data Recency#1986
henry-tp wants to merge 22 commits into
WEB-4654-tagsfrom
WEB-4654-data-recency

Conversation

@henry-tp

@henry-tp henry-tp commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@henry-tp
henry-tp changed the base branch from develop to WEB-4654-tags July 14, 2026 07:56
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (4)
  • master
  • main
  • develop
  • release.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: feb25026-6c0b-4a93-b438-c24ca6504b3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Clinic patient filtering was split into dedicated dropdown components, applied-filter chips, clear/reset controls, and combined query-state handling. Clinic-admin actions, special empty-selection states, localized plural labels, and header integration were added.

Changes

Clinic patient filtering

Layer / File(s) Summary
Filter control components
app/pages/clinicworkspace/FilterBy*.js, app/pages/clinicworkspace/components/*FilterDropdown.js, app/pages/clinicworkspace/useIsClinicAdmin.js, app/pages/clinicworkspace/useClinicPatientsFilters.js
Tag, site, and data-recency filters manage selections, dropdown actions, clinic-admin editing, and special zero-selection states.
Applied filters and query state
app/pages/clinicworkspace/components/AppliedFilters.js, app/pages/clinicworkspace/components/ClearFilterButtons.js, app/pages/clinicworkspace/AppliedFiltersAdapter.js, app/pages/clinicworkspace/ClinicPatients.js
Applied filter chips and clear/reset controls are connected to active filters, search state, empty-state messages, and patient query classification.
Clinic patient header integration
app/pages/clinicworkspace/ClinicPatients.js
ClinicPatients renders the extracted filter controls and updates summary-period labeling and related header layout behavior.
Filter localization
locales/en/translation.json
Adds singular and plural English labels for data-recency ranges and patient counts.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ClinicPatients
  participant FilterByDataRecency
  participant DataRecencyFilterDropdown
  participant AppliedFiltersAdapter
  participant AppliedFilters
  ClinicPatients->>FilterByDataRecency: pass activeFilters
  FilterByDataRecency->>DataRecencyFilterDropdown: pass current recency values
  DataRecencyFilterDropdown->>FilterByDataRecency: apply recency selection
  FilterByDataRecency->>ClinicPatients: update activeFilters
  ClinicPatients->>AppliedFiltersAdapter: pass activeFilters and search text
  AppliedFiltersAdapter->>AppliedFilters: render applied filter chips
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description only references the ticket ID and link, so it does not describe the changes meaningfully. Add a short summary of the functional changes, such as the new data-recency and clinic patient filter work.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main theme of the changes, which center on data-recency and related clinic patient filters.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch WEB-4654-data-recency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/pages/clinicworkspace/ClinicPatients.js (1)

3747-3760: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Complete renderPeopleTable’s dependency list. It reads patientListSearchTextInput and captures handleClearSearch, handleResetFilters, and handleClickPatient, but none are in the useCallback deps. That can leave the query-state controls using stale values after search/filter changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/ClinicPatients.js` around lines 3747 - 3760, Update
the dependency array for renderPeopleTable to include
patientListSearchTextInput, handleClearSearch, handleResetFilters, and
handleClickPatient alongside the existing dependencies, ensuring the callback
refreshes when search, filter-reset, or patient-click handlers change.

Source: Coding guidelines

🧹 Nitpick comments (3)
app/pages/clinicworkspace/AppliedFiltersAdapter.js (1)

10-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add PropTypes for the newly introduced component interfaces.

  • app/pages/clinicworkspace/AppliedFiltersAdapter.js#L10-L10: declare activeFilters, setActiveFilters, and rightContent.
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js#L25-L30: declare DropdownContent props.
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js#L135-L139: declare DataRecencyFilterDropdown props.
  • app/pages/clinicworkspace/FilterByDataRecency.js#L6-L9: declare the filter adapter props.
  • app/pages/clinicworkspace/components/AppliedFilters.js#L104-L171: declare props for Chip, ChipGroup, and AppliedFilters.
  • app/pages/clinicworkspace/components/ClearFilterButtons.js#L25-L25: declare query-state and callback props.
  • app/pages/clinicworkspace/ClinicPatients.js#L243-L243: declare EmptyContentNode props.

As per coding guidelines, define PropTypes for all component props.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js` at line 10, The newly
introduced clinic workspace components lack PropTypes declarations for their
interfaces. Add PropTypes for activeFilters, setActiveFilters, and rightContent
on AppliedFiltersAdapter; DropdownContent and DataRecencyFilterDropdown props in
DataRecencyFilterDropdown.js; filter adapter props in FilterByDataRecency; Chip,
ChipGroup, and AppliedFilters props in AppliedFilters.js; query-state and
callback props in ClearFilterButtons.js; and EmptyContentNode props in
ClinicPatients.js, matching each component’s actual usage.

Source: Coding guidelines

app/pages/clinicworkspace/components/TagFilterDropdown.js (1)

190-194: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define PropTypes for every component introduced here.

  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L190-L194: define contracts for TagFilterDropdown, DropdownContent, and EditTagsAction.
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L194-L198: define contracts for SiteFilterDropdown, DropdownContent, and EditSitesAction.
  • app/pages/clinicworkspace/FilterByTags.js#L13-L18: define the adapter’s API, filter state, and callbacks.
  • app/pages/clinicworkspace/FilterBySites.js#L13-L18: define the adapter’s API, filter state, and callbacks.

As per coding guidelines, “Define PropTypes for all component props.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js` around lines 190 -
194, Define PropTypes for every prop on TagFilterDropdown, DropdownContent, and
EditTagsAction in app/pages/clinicworkspace/components/TagFilterDropdown.js
(anchor lines 190-194); apply the same contracts to SiteFilterDropdown,
DropdownContent, and EditSitesAction in
app/pages/clinicworkspace/components/SiteFilterDropdown.js (lines 194-198).
Define PropTypes for the adapter API, filter state, and callbacks in
FilterByTags.js (lines 13-18) and FilterBySites.js (lines 13-18), using types
that match each component’s existing props and defaults.

Source: Coding guidelines

app/pages/clinicworkspace/useIsClinicAdmin.js (1)

1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Apply the required import grouping across the new modules.

  • app/pages/clinicworkspace/useIsClinicAdmin.js#L1-L4: separate React, Redux, and Lodash groups with blank lines.
  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L1-L34: order React, Redux, third-party, Lodash, theme-ui, then local imports; keep all imports before declarations.
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L1-L34: apply the same required order and move Lines 33-34 above declarations.
  • app/pages/clinicworkspace/FilterByTags.js#L1-L9: place Lodash before local Redux/component imports.
  • app/pages/clinicworkspace/FilterBySites.js#L1-L9: place Lodash before local Redux/component imports.

As per coding guidelines, imports must use the prescribed groups with blank lines between them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/useIsClinicAdmin.js` around lines 1 - 4, Reorganize
imports in app/pages/clinicworkspace/useIsClinicAdmin.js (lines 1-4) into
separate React, Redux, and Lodash groups with blank lines; in
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 1-34) and
SiteFilterDropdown.js (lines 1-34), order groups as React, Redux, third-party,
Lodash, theme-ui, then local imports, keeping every import before declarations;
in app/pages/clinicworkspace/FilterByTags.js (lines 1-9) and FilterBySites.js
(lines 1-9), move Lodash imports before local Redux/component imports and
separate each prescribed group with blank lines.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js`:
- Around line 13-43: Add a timeCGMUsePercent branch to handleRemoveFilter
alongside the existing filter cases, removing the selected value from
activeFilters.timeCGMUsePercent via the same without-based update pattern used
for timeInRange and patientTags.

In `@app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js`:
- Line 23: Update prefixPopHealthMetric and its call sites in
DataRecencyFilterDropdown so trackMetric receives valid past-tense event-name
strings rather than the noop function. Preserve the existing invocation timing,
and apply the same correction to all referenced metric calls.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js`:
- Around line 30-31: The clinic workspace filter interactions currently discard
metrics by using no-op helpers or default trackers. In
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 30-31) and
app/pages/clinicworkspace/components/SiteFilterDropdown.js (lines 30-31), pass
the real clinic workspace metric helpers instead of no-ops; in
app/pages/clinicworkspace/FilterByTags.js (lines 11-32) and
app/pages/clinicworkspace/FilterBySites.js (lines 11-32), thread the real
trackMetric through or remove the metric calls if these interactions are
intentionally untracked.
- Around line 71-74: Replace the unsupported Array.prototype.toSorted call in
the sortedTagFilterOptions useMemo within
app/pages/clinicworkspace/components/TagFilterDropdown.js lines 71-74 with a
compatible sorting approach. Apply the same change in
app/pages/clinicworkspace/components/SiteFilterDropdown.js lines 71-74,
preserving label-based ordering without relying on toSorted.

---

Outside diff comments:
In `@app/pages/clinicworkspace/ClinicPatients.js`:
- Around line 3747-3760: Update the dependency array for renderPeopleTable to
include patientListSearchTextInput, handleClearSearch, handleResetFilters, and
handleClickPatient alongside the existing dependencies, ensuring the callback
refreshes when search, filter-reset, or patient-click handlers change.

---

Nitpick comments:
In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js`:
- Line 10: The newly introduced clinic workspace components lack PropTypes
declarations for their interfaces. Add PropTypes for activeFilters,
setActiveFilters, and rightContent on AppliedFiltersAdapter; DropdownContent and
DataRecencyFilterDropdown props in DataRecencyFilterDropdown.js; filter adapter
props in FilterByDataRecency; Chip, ChipGroup, and AppliedFilters props in
AppliedFilters.js; query-state and callback props in ClearFilterButtons.js; and
EmptyContentNode props in ClinicPatients.js, matching each component’s actual
usage.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js`:
- Around line 190-194: Define PropTypes for every prop on TagFilterDropdown,
DropdownContent, and EditTagsAction in
app/pages/clinicworkspace/components/TagFilterDropdown.js (anchor lines
190-194); apply the same contracts to SiteFilterDropdown, DropdownContent, and
EditSitesAction in app/pages/clinicworkspace/components/SiteFilterDropdown.js
(lines 194-198). Define PropTypes for the adapter API, filter state, and
callbacks in FilterByTags.js (lines 13-18) and FilterBySites.js (lines 13-18),
using types that match each component’s existing props and defaults.

In `@app/pages/clinicworkspace/useIsClinicAdmin.js`:
- Around line 1-4: Reorganize imports in
app/pages/clinicworkspace/useIsClinicAdmin.js (lines 1-4) into separate React,
Redux, and Lodash groups with blank lines; in
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 1-34) and
SiteFilterDropdown.js (lines 1-34), order groups as React, Redux, third-party,
Lodash, theme-ui, then local imports, keeping every import before declarations;
in app/pages/clinicworkspace/FilterByTags.js (lines 1-9) and FilterBySites.js
(lines 1-9), move Lodash imports before local Redux/component imports and
separate each prescribed group with blank lines.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cdcaceec-92dd-47f4-8d90-c5a5d64b7834

📥 Commits

Reviewing files that changed from the base of the PR and between 1ea3534 and 1785b26.

⛔ Files ignored due to path filters (1)
  • app/core/icons/tagIcon.svg is excluded by !**/*.svg
📒 Files selected for processing (13)
  • app/pages/clinicworkspace/AppliedFiltersAdapter.js
  • app/pages/clinicworkspace/ClinicPatients.js
  • app/pages/clinicworkspace/FilterByDataRecency.js
  • app/pages/clinicworkspace/FilterBySites.js
  • app/pages/clinicworkspace/FilterByTags.js
  • app/pages/clinicworkspace/components/AppliedFilters.js
  • app/pages/clinicworkspace/components/ClearFilterButtons.js
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js
  • app/pages/clinicworkspace/components/TagFilterDropdown.js
  • app/pages/clinicworkspace/useClinicPatientsFilters.js
  • app/pages/clinicworkspace/useIsClinicAdmin.js
  • locales/en/translation.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/pages/clinicworkspace/ClinicPatients.js (1)

3747-3760: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Complete renderPeopleTable’s dependency list. It reads patientListSearchTextInput and captures handleClearSearch, handleResetFilters, and handleClickPatient, but none are in the useCallback deps. That can leave the query-state controls using stale values after search/filter changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/ClinicPatients.js` around lines 3747 - 3760, Update
the dependency array for renderPeopleTable to include
patientListSearchTextInput, handleClearSearch, handleResetFilters, and
handleClickPatient alongside the existing dependencies, ensuring the callback
refreshes when search, filter-reset, or patient-click handlers change.

Source: Coding guidelines

🧹 Nitpick comments (3)
app/pages/clinicworkspace/AppliedFiltersAdapter.js (1)

10-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add PropTypes for the newly introduced component interfaces.

  • app/pages/clinicworkspace/AppliedFiltersAdapter.js#L10-L10: declare activeFilters, setActiveFilters, and rightContent.
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js#L25-L30: declare DropdownContent props.
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js#L135-L139: declare DataRecencyFilterDropdown props.
  • app/pages/clinicworkspace/FilterByDataRecency.js#L6-L9: declare the filter adapter props.
  • app/pages/clinicworkspace/components/AppliedFilters.js#L104-L171: declare props for Chip, ChipGroup, and AppliedFilters.
  • app/pages/clinicworkspace/components/ClearFilterButtons.js#L25-L25: declare query-state and callback props.
  • app/pages/clinicworkspace/ClinicPatients.js#L243-L243: declare EmptyContentNode props.

As per coding guidelines, define PropTypes for all component props.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js` at line 10, The newly
introduced clinic workspace components lack PropTypes declarations for their
interfaces. Add PropTypes for activeFilters, setActiveFilters, and rightContent
on AppliedFiltersAdapter; DropdownContent and DataRecencyFilterDropdown props in
DataRecencyFilterDropdown.js; filter adapter props in FilterByDataRecency; Chip,
ChipGroup, and AppliedFilters props in AppliedFilters.js; query-state and
callback props in ClearFilterButtons.js; and EmptyContentNode props in
ClinicPatients.js, matching each component’s actual usage.

Source: Coding guidelines

app/pages/clinicworkspace/components/TagFilterDropdown.js (1)

190-194: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define PropTypes for every component introduced here.

  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L190-L194: define contracts for TagFilterDropdown, DropdownContent, and EditTagsAction.
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L194-L198: define contracts for SiteFilterDropdown, DropdownContent, and EditSitesAction.
  • app/pages/clinicworkspace/FilterByTags.js#L13-L18: define the adapter’s API, filter state, and callbacks.
  • app/pages/clinicworkspace/FilterBySites.js#L13-L18: define the adapter’s API, filter state, and callbacks.

As per coding guidelines, “Define PropTypes for all component props.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js` around lines 190 -
194, Define PropTypes for every prop on TagFilterDropdown, DropdownContent, and
EditTagsAction in app/pages/clinicworkspace/components/TagFilterDropdown.js
(anchor lines 190-194); apply the same contracts to SiteFilterDropdown,
DropdownContent, and EditSitesAction in
app/pages/clinicworkspace/components/SiteFilterDropdown.js (lines 194-198).
Define PropTypes for the adapter API, filter state, and callbacks in
FilterByTags.js (lines 13-18) and FilterBySites.js (lines 13-18), using types
that match each component’s existing props and defaults.

Source: Coding guidelines

app/pages/clinicworkspace/useIsClinicAdmin.js (1)

1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Apply the required import grouping across the new modules.

  • app/pages/clinicworkspace/useIsClinicAdmin.js#L1-L4: separate React, Redux, and Lodash groups with blank lines.
  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L1-L34: order React, Redux, third-party, Lodash, theme-ui, then local imports; keep all imports before declarations.
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L1-L34: apply the same required order and move Lines 33-34 above declarations.
  • app/pages/clinicworkspace/FilterByTags.js#L1-L9: place Lodash before local Redux/component imports.
  • app/pages/clinicworkspace/FilterBySites.js#L1-L9: place Lodash before local Redux/component imports.

As per coding guidelines, imports must use the prescribed groups with blank lines between them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/useIsClinicAdmin.js` around lines 1 - 4, Reorganize
imports in app/pages/clinicworkspace/useIsClinicAdmin.js (lines 1-4) into
separate React, Redux, and Lodash groups with blank lines; in
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 1-34) and
SiteFilterDropdown.js (lines 1-34), order groups as React, Redux, third-party,
Lodash, theme-ui, then local imports, keeping every import before declarations;
in app/pages/clinicworkspace/FilterByTags.js (lines 1-9) and FilterBySites.js
(lines 1-9), move Lodash imports before local Redux/component imports and
separate each prescribed group with blank lines.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js`:
- Around line 13-43: Add a timeCGMUsePercent branch to handleRemoveFilter
alongside the existing filter cases, removing the selected value from
activeFilters.timeCGMUsePercent via the same without-based update pattern used
for timeInRange and patientTags.

In `@app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js`:
- Line 23: Update prefixPopHealthMetric and its call sites in
DataRecencyFilterDropdown so trackMetric receives valid past-tense event-name
strings rather than the noop function. Preserve the existing invocation timing,
and apply the same correction to all referenced metric calls.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js`:
- Around line 30-31: The clinic workspace filter interactions currently discard
metrics by using no-op helpers or default trackers. In
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 30-31) and
app/pages/clinicworkspace/components/SiteFilterDropdown.js (lines 30-31), pass
the real clinic workspace metric helpers instead of no-ops; in
app/pages/clinicworkspace/FilterByTags.js (lines 11-32) and
app/pages/clinicworkspace/FilterBySites.js (lines 11-32), thread the real
trackMetric through or remove the metric calls if these interactions are
intentionally untracked.
- Around line 71-74: Replace the unsupported Array.prototype.toSorted call in
the sortedTagFilterOptions useMemo within
app/pages/clinicworkspace/components/TagFilterDropdown.js lines 71-74 with a
compatible sorting approach. Apply the same change in
app/pages/clinicworkspace/components/SiteFilterDropdown.js lines 71-74,
preserving label-based ordering without relying on toSorted.

---

Outside diff comments:
In `@app/pages/clinicworkspace/ClinicPatients.js`:
- Around line 3747-3760: Update the dependency array for renderPeopleTable to
include patientListSearchTextInput, handleClearSearch, handleResetFilters, and
handleClickPatient alongside the existing dependencies, ensuring the callback
refreshes when search, filter-reset, or patient-click handlers change.

---

Nitpick comments:
In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js`:
- Line 10: The newly introduced clinic workspace components lack PropTypes
declarations for their interfaces. Add PropTypes for activeFilters,
setActiveFilters, and rightContent on AppliedFiltersAdapter; DropdownContent and
DataRecencyFilterDropdown props in DataRecencyFilterDropdown.js; filter adapter
props in FilterByDataRecency; Chip, ChipGroup, and AppliedFilters props in
AppliedFilters.js; query-state and callback props in ClearFilterButtons.js; and
EmptyContentNode props in ClinicPatients.js, matching each component’s actual
usage.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js`:
- Around line 190-194: Define PropTypes for every prop on TagFilterDropdown,
DropdownContent, and EditTagsAction in
app/pages/clinicworkspace/components/TagFilterDropdown.js (anchor lines
190-194); apply the same contracts to SiteFilterDropdown, DropdownContent, and
EditSitesAction in app/pages/clinicworkspace/components/SiteFilterDropdown.js
(lines 194-198). Define PropTypes for the adapter API, filter state, and
callbacks in FilterByTags.js (lines 13-18) and FilterBySites.js (lines 13-18),
using types that match each component’s existing props and defaults.

In `@app/pages/clinicworkspace/useIsClinicAdmin.js`:
- Around line 1-4: Reorganize imports in
app/pages/clinicworkspace/useIsClinicAdmin.js (lines 1-4) into separate React,
Redux, and Lodash groups with blank lines; in
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 1-34) and
SiteFilterDropdown.js (lines 1-34), order groups as React, Redux, third-party,
Lodash, theme-ui, then local imports, keeping every import before declarations;
in app/pages/clinicworkspace/FilterByTags.js (lines 1-9) and FilterBySites.js
(lines 1-9), move Lodash imports before local Redux/component imports and
separate each prescribed group with blank lines.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cdcaceec-92dd-47f4-8d90-c5a5d64b7834

📥 Commits

Reviewing files that changed from the base of the PR and between 1ea3534 and 1785b26.

⛔ Files ignored due to path filters (1)
  • app/core/icons/tagIcon.svg is excluded by !**/*.svg
📒 Files selected for processing (13)
  • app/pages/clinicworkspace/AppliedFiltersAdapter.js
  • app/pages/clinicworkspace/ClinicPatients.js
  • app/pages/clinicworkspace/FilterByDataRecency.js
  • app/pages/clinicworkspace/FilterBySites.js
  • app/pages/clinicworkspace/FilterByTags.js
  • app/pages/clinicworkspace/components/AppliedFilters.js
  • app/pages/clinicworkspace/components/ClearFilterButtons.js
  • app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js
  • app/pages/clinicworkspace/components/TagFilterDropdown.js
  • app/pages/clinicworkspace/useClinicPatientsFilters.js
  • app/pages/clinicworkspace/useIsClinicAdmin.js
  • locales/en/translation.json
🛑 Comments failed to post (4)
app/pages/clinicworkspace/AppliedFiltersAdapter.js (1)

13-43: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle removal of the CGM-use chip.

AppliedFilters.js Lines 35-42 emits type: 'timeCGMUsePercent', but this switch ignores that key, so its remove action does nothing.

Proposed fix
   const handleRemoveFilter = (filterKey, value) => {
     switch (filterKey) {
+      case 'timeCGMUsePercent':
+        setActiveFilters({
+          ...activeFilters,
+          timeCGMUsePercent: defaultFilterState.timeCGMUsePercent,
+        });
+        break;
+
       case 'lastData':
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  const handleRemoveFilter = (filterKey, value) => {
    switch (filterKey) {
      case 'timeCGMUsePercent':
        setActiveFilters({
          ...activeFilters,
          timeCGMUsePercent: defaultFilterState.timeCGMUsePercent,
        });
        break;

      case 'lastData':
        setActiveFilters({
          ...activeFilters,
          lastData: defaultFilterState.lastData,
          lastDataType: defaultFilterState.lastDataType,
        });
        break;

      case 'timeInRange':
        setActiveFilters({
          ...activeFilters,
          timeInRange: without(activeFilters.timeInRange, value),
        });
        break;

      case 'patientTags':
        setActiveFilters({
          ...activeFilters,
          patientTags: without(activeFilters.patientTags, value),
        });
        break;

      case 'clinicSites':
        setActiveFilters({
          ...activeFilters,
          clinicSites: without(activeFilters.clinicSites, value),
        });
        break;
    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/AppliedFiltersAdapter.js` around lines 13 - 43, Add
a timeCGMUsePercent branch to handleRemoveFilter alongside the existing filter
cases, removing the selected value from activeFilters.timeCGMUsePercent via the
same without-based update pattern used for timeInRange and patientTags.
app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js (1)

23-23: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Pass valid, past-tense event names to trackMetric.

prefixPopHealthMetric currently returns the noop function, so every new call passes a function instead of an event-name string.

Proposed fix
-const prefixPopHealthMetric = () => noop; // TODO: FIX
+const prefixPopHealthMetric = metric => `Clinic - Population Health - ${metric}`;

-trackMetric(prefixPopHealthMetric('Last upload clear filter'), {
+trackMetric(prefixPopHealthMetric('Cleared last upload filter'), {

-trackMetric(prefixPopHealthMetric('Last upload apply filter'), {
+trackMetric(prefixPopHealthMetric('Applied last upload filter'), {

-trackMetric(prefixPopHealthMetric('Last data filter open'), {
+trackMetric(prefixPopHealthMetric('Opened last data filter'), {

-trackMetric(prefixPopHealthMetric('Last upload filter close'), {
+trackMetric(prefixPopHealthMetric('Closed last upload filter'), {

Based on learnings, metric names should use past tense while retaining the current invocation timing. I can add a focused metric test as well.

Also applies to: 99-99, 118-122, 157-157, 179-179

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/components/DataRecencyFilterDropdown.js` at line
23, Update prefixPopHealthMetric and its call sites in DataRecencyFilterDropdown
so trackMetric receives valid past-tense event-name strings rather than the noop
function. Preserve the existing invocation timing, and apply the same correction
to all referenced metric calls.

Source: Learnings

app/pages/clinicworkspace/components/TagFilterDropdown.js (2)

30-31: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the canonical metrics helpers and nearby established call patterns.
rg -n -C3 --type=js \
  '\b(trackMetric|prefixPopHealthMetric)\b' \
  app

Repository: tidepool-org/blip

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in \
  app/pages/clinicworkspace/components/TagFilterDropdown.js \
  app/pages/clinicworkspace/components/SiteFilterDropdown.js \
  app/pages/clinicworkspace/FilterByTags.js \
  app/pages/clinicworkspace/FilterBySites.js
do
  echo "### $f"
  wc -l "$f"
  echo
done

echo "### TagFilterDropdown.js"
sed -n '1,220p' app/pages/clinicworkspace/components/TagFilterDropdown.js

echo "### SiteFilterDropdown.js"
sed -n '1,220p' app/pages/clinicworkspace/components/SiteFilterDropdown.js

echo "### FilterByTags.js"
sed -n '1,220p' app/pages/clinicworkspace/FilterByTags.js

echo "### FilterBySites.js"
sed -n '1,220p' app/pages/clinicworkspace/FilterBySites.js

Repository: tidepool-org/blip

Length of output: 20534


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C2 "dispatch\\(actions\\.async\\.(fetchClinicPatientTags|fetchClinicSites)|trackMetric\\(" \
  app/pages/clinicworkspace app/pages/clinicianedit app/pages/clinicinvite app/pages/prescription app/pages/share/PatientInvites.js

Repository: tidepool-org/blip

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the specific files and print only the relevant sections with line numbers.
for f in \
  app/pages/clinicworkspace/components/TagFilterDropdown.js \
  app/pages/clinicworkspace/components/SiteFilterDropdown.js \
  app/pages/clinicworkspace/FilterByTags.js \
  app/pages/clinicworkspace/FilterBySites.js
do
  echo "### $f"
  nl -ba "$f" | sed -n '1,220p'
  echo
done

Repository: tidepool-org/blip

Length of output: 258


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Compare the wording used in nearby established clinic metrics calls.
rg -n -C1 "Clinic - .* (open|confirmed|back out|close|cancel|refresh|edit|accept|decline|invite|remove|update)" app/pages/clinicworkspace app/pages/share/PatientInvites.js app/pages/clinicianedit/clinicianedit.js app/pages/clinicinvite/clinicinvite.js

Repository: tidepool-org/blip

Length of output: 7705


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "### TagFilterDropdown"
nl -ba app/pages/clinicworkspace/components/TagFilterDropdown.js | sed -n '1,120p'

echo "### SiteFilterDropdown"
nl -ba app/pages/clinicworkspace/components/SiteFilterDropdown.js | sed -n '1,120p'

echo "### FilterByTags"
nl -ba app/pages/clinicworkspace/FilterByTags.js | sed -n '1,120p'

echo "### FilterBySites"
nl -ba app/pages/clinicworkspace/FilterBySites.js | sed -n '1,120p'

Repository: tidepool-org/blip

Length of output: 217


🏁 Script executed:

#!/bin/bash
set -euo pipefail

log=/tmp/coderabbit-shell-logs/shell-output-jfWhRa

echo "### Log hits for TagFilterDropdown / SiteFilterDropdown / FilterByTags / FilterBySites"
rg -n -C3 'TagFilterDropdown|SiteFilterDropdown|FilterByTags|FilterBySites|trackMetric = noop|prefixPopHealthMetric|TODO: FIX' "$log" | sed -n '1,220p'

Repository: tidepool-org/blip

Length of output: 19074


Pass the real clinic workspace metric helpers through these filters.

  • app/pages/clinicworkspace/components/TagFilterDropdown.js and app/pages/clinicworkspace/components/SiteFilterDropdown.js still define trackMetric/prefixPopHealthMetric as no-ops, so every open/clear/apply event is dropped.
  • app/pages/clinicworkspace/FilterByTags.js and app/pages/clinicworkspace/FilterBySites.js still default trackMetric to noop; thread the real tracker in here or remove the calls if these interactions are intentionally untracked.
📍 Affects 4 files
  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L30-L31 (this comment)
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L30-L31
  • app/pages/clinicworkspace/FilterByTags.js#L11-L32
  • app/pages/clinicworkspace/FilterBySites.js#L11-L32
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js` around lines 30 -
31, The clinic workspace filter interactions currently discard metrics by using
no-op helpers or default trackers. In
app/pages/clinicworkspace/components/TagFilterDropdown.js (lines 30-31) and
app/pages/clinicworkspace/components/SiteFilterDropdown.js (lines 30-31), pass
the real clinic workspace metric helpers instead of no-ops; in
app/pages/clinicworkspace/FilterByTags.js (lines 11-32) and
app/pages/clinicworkspace/FilterBySites.js (lines 11-32), thread the real
trackMetric through or remove the metric calls if these interactions are
intentionally untracked.

Source: Learnings


71-74: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect declared browser/transpilation targets and existing usage.
fd -H -t f \
  '^(package\.json|\.browserslistrc|babel\.config\..*|\.babelrc.*)$' \
  . -x sh -c 'echo "=== $1 ==="; sed -n "1,240p" "$1"' sh {}

rg -n --type=js '\.toSorted\s*\(' app

Repository: tidepool-org/blip

Length of output: 9976


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for explicit browser targets, polyfill setup, and any toSorted-related support code.
printf '\n=== browserslist / target config ===\n'
fd -H -t f '^(package\.json|\.browserslistrc|browserslist(\..*)?|babel\.config\..*|\.babelrc(\..*)?)$' . \
  -x sh -c 'echo "--- $1 ---"; sed -n "1,220p" "$1"' sh {}

printf '\n=== polyfill / core-js / react-app-polyfill references ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  '(core-js|react-app-polyfill|polyfill|toSorted)' app config scripts . \
  -g '!*.map' -g '!*.min.*'

printf '\n=== existing toSorted usage ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' '\.toSorted\s*\(' app

Repository: tidepool-org/blip

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== app entry / bootstrap files ===\n'
fd -H -t f '^(index|main|app)\.(js|jsx|ts|tsx)$|^setup.*\.(js|ts)$|^polyfill.*\.(js|ts)$' app . \
  | sed 's#^\./##' | sort | head -200

printf '\n=== runtime polyfill imports in app/bootstrap ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  "import ['\\\"]core-js/stable['\\\"]|require\\(['\\\"]core-js/stable['\\\"]|react-app-polyfill|core-js/modules/.*/to-sorted|toSorted" \
  app *.js *.jsx *.ts *.tsx config test __tests__ jest.setup.js

printf '\n=== files mentioning browserslist ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' 'browserslist|targets?:|preset-env' . \
  -g '!yarn.lock' -g '!*.map' -g '!*.min.*' | head -200

Repository: tidepool-org/blip

Length of output: 5118


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== app/main.js ===\n'
sed -n '1,220p' app/main.js

printf '\n=== app/pages/app/index.js ===\n'
sed -n '1,220p' app/pages/app/index.js

printf '\n=== imports of core-js/stable or es.array.to-sorted ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F \
  "core-js/stable" app .storybook __tests__ test config

rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F \
  "es.array.to-sorted" app .storybook __tests__ test config

printf '\n=== package.json browserslist fields ===\n'
python3 - <<'PY'
import json
from pathlib import Path
pkg = json.loads(Path('package.json').read_text())
for key in ('browserslist','babel'):
    print(key, pkg.get(key))
PY

Repository: tidepool-org/blip

Length of output: 2017


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== app/main.js ===\n'
cat -n app/main.js | sed -n '1,220p'

printf '\n=== app/pages/app/index.js ===\n'
cat -n app/pages/app/index.js | sed -n '1,220p'

printf '\n=== direct references to core-js in app entry paths ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F 'core-js' app/main.js app/pages app/redux app/components

Repository: tidepool-org/blip

Length of output: 2360


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== app/bootstrap.* ===\n'
fd -H -t f '^bootstrap\.(js|jsx|ts|tsx)$' app
for f in $(fd -H -t f '^bootstrap\.(js|jsx|ts|tsx)$' app); do
  echo "--- $f ---"
  cat -n "$f" | sed -n '1,260p'
done

printf '\n=== direct polyfill imports from app/bootstrap neighborhood ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F \
  'core-js' app/bootstrap* app/**/bootstrap* app/config* app/main.js app/pages/app app/redux

printf '\n=== toSorted support polyfills ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F \
  'es.array.to-sorted' . -g '!yarn.lock' -g '!*.map' -g '!*.min.*'

Repository: tidepool-org/blip

Length of output: 5928


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== config.app files ===\n'
fd -H -t f '^config\.app\.(js|jsx|ts|tsx)$' . | sed 's#^\./##' | sort

for f in $(fd -H -t f '^config\.app\.(js|jsx|ts|tsx)$' .); do
  echo "--- $f ---"
  cat -n "$f" | sed -n '1,240p'
done

printf '\n=== explicit polyfill entrypoints ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F \
  "`@babel/polyfill`|core-js/stable|regenerator-runtime|react-app-polyfill|es.array.to-sorted" \
  . -g '!yarn.lock' -g '!*.map' -g '!*.min.*'

Repository: tidepool-org/blip

Length of output: 2901


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== webpack-related files ===\n'
fd -H -t f 'webpack.*\.(js|cjs|mjs)$|^webpack\.config(\..*)?\.js$|^.*webpack.*config.*\.js$' . | sed 's#^\./##' | sort

printf '\n=== target / browsers / preset-env in webpack configs ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'target\s*:|browserslist|preset-env|core-js|useBuiltIns|Array\.prototype\.toSorted|toSorted' \
  webpack*.js config/**/*.js app/**/*.js .storybook/**/*.js

Repository: tidepool-org/blip

Length of output: 452


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== webpack.config.js ===\n'
cat -n webpack.config.js | sed -n '1,260p'

printf '\n=== config.webpack.js ===\n'
cat -n config.webpack.js | sed -n '1,260p'

printf '\n=== babel-loader / preset-env references in webpack configs ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'babel-loader|preset-env|targets\s*:|core-js|useBuiltIns|browserslist|exclude:|include:' \
  webpack.config.js config.webpack.js

Repository: tidepool-org/blip

Length of output: 13264


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n=== `@babel/polyfill` lockfile entry ===\n'
rg -n -A12 -B4 '^"`@babel/polyfill`@npm:7\.12\.1":|^    core-js:|^    regenerator-runtime:' yarn.lock

printf '\n=== core-js lockfile entries ===\n'
rg -n -A8 -B2 '^"core-js@npm:|^"core-js-pure@npm:' yarn.lock

printf '\n=== babel polyfill package references in repo ===\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' -F '`@babel/polyfill`' .

Repository: tidepool-org/blip

Length of output: 5570


Replace toSorted here. The browser bundle only ships @babel/polyfill (core-js 2.x), so Array.prototype.toSorted isn’t covered at runtime.

  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L71-L74
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L71-L74
📍 Affects 2 files
  • app/pages/clinicworkspace/components/TagFilterDropdown.js#L71-L74 (this comment)
  • app/pages/clinicworkspace/components/SiteFilterDropdown.js#L71-L74
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/clinicworkspace/components/TagFilterDropdown.js` around lines 71 -
74, Replace the unsupported Array.prototype.toSorted call in the
sortedTagFilterOptions useMemo within
app/pages/clinicworkspace/components/TagFilterDropdown.js lines 71-74 with a
compatible sorting approach. Apply the same change in
app/pages/clinicworkspace/components/SiteFilterDropdown.js lines 71-74,
preserving label-based ordering without relying on toSorted.

@henry-tp
henry-tp requested a review from clintonium-119 July 21, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant