Skip to content

[WEB-55] Daily view site change events - #651

Open
clintonium-119 wants to merge 5 commits into
developfrom
WEB-55-daily-view-site-change-events
Open

[WEB-55] Daily view site change events#651
clintonium-119 wants to merge 5 commits into
developfrom
WEB-55-daily-view-site-change-events

Conversation

@clintonium-119

@clintonium-119 clintonium-119 commented Jun 25, 2026

Copy link
Copy Markdown
Member

- EventTooltip: add a site-change hover case rendering
  "Site Change: <label>" with a days-since duration, per Figma.
- EventsInfoTooltip: list site changes in the subtitle.
- DailyPrintView: render site-change icons in the printed Daily
  view, resolving the image per subtype/manufacturer and
  deduplicating events within a 5-minute window; export
  getSiteChangeSource from the package index.
- Tests: migrate EventTooltip tests to RTL queries, add an
  EventsInfoTooltip test, and cover print-view site-change
  rendering.
- getLegendItems: add a "Site Change" entry after Notes, shown only
  when site changes actually render in the report (selected source has
  a resolvable icon and matching deviceEvents exist).
- Render it with the same subtype/manufacturer icon used in the report,
  at the event-icon legend size, with a 2-line "Site"/"Change" label.
- Test the item's presence when site changes exist and absence when
  they don't.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for “site change” events in the Daily view, ensuring they appear consistently across the PDF daily print output and UI tooltips, with accompanying test coverage.

Changes:

  • Add site-change legend entry and icon rendering (with subtype selection + 5-minute dedupe) to the DailyPrintView PDF output.
  • Extend daily event tooltips to render site-change titles and “days since” duration, plus add/update related tests.
  • Expose getSiteChangeSource via the public utils.aggregation export and bump package version.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/modules/print/DailyPrintView.test.js Adds tests for site-change legend inclusion and PDF icon rendering/deduping.
test/components/daily/EventTooltip.test.js Refactors assertions to Testing Library screen and adds site-change tooltip test cases.
test/components/common/tooltip/EventsInfoTooltip.test.js Adds coverage for updated “Events Shown” tooltip copy including site changes.
src/modules/print/DailyPrintView.js Implements site-change subtype detection, image selection, legend item, and rendering in PDF.
src/index.js Re-exports getSiteChangeSource under utils.aggregation.
src/components/daily/eventtooltip/EventTooltip.js Adds tooltip content handling for site-change events (title + duration).
src/components/common/tooltips/EventsInfoTooltip.js Updates tooltip subtitle copy to include site changes.
package.json Bumps package version for the WEB-55 change set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 10 to 12
title: t('Events Shown'),
subtitle: t('Tidepool displays certain pump alarms, device time changes, and notes.'),
subtitle: t('Tidepool displays certain pump alarms, device time changes, site changes and notes.'),
sections: [
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added site change events to event tooltips, including localized labels and duration details.
    • Added site change icons to daily print views, with subtype and device-specific visuals.
    • Added site change entries to print legends when applicable.
    • Exposed site change source information through the aggregation utilities.
  • Bug Fixes

    • Improved handling of events without an event subtype.
    • Consolidated closely timed site change events to avoid duplicate icons.

Walkthrough

The PR adds site change event handling to daily tooltips and print views, including localized duration content, subtype- and manufacturer-specific icons, conditional legends, five-minute deduplication, public source-helper exposure, and related tests.

Changes

Site change events

Layer / File(s) Summary
Site change tooltip content
src/components/daily/eventtooltip/EventTooltip.js, src/components/common/tooltips/EventsInfoTooltip.js, test/components/daily/EventTooltip.test.js, test/components/common/tooltip/EventsInfoTooltip.test.js
Site change events receive localized titles and condensed durations, event tags allow missing event names, and tooltip tests assert rendered text and site change descriptions.
Site change print rendering
src/modules/print/DailyPrintView.js, src/index.js, test/modules/print/DailyPrintView.test.js, package.json
Daily print views resolve site change sources, select subtype- and manufacturer-specific icons, add matching legend entries, deduplicate events within five minutes, expose the resolver, and update the package version.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DailyPrintView
  participant getSiteChangeSource
  participant DeviceEventRecords
  participant renderDeviceEvents
  DailyPrintView->>getSiteChangeSource: resolve patient and manufacturer source
  DailyPrintView->>DeviceEventRecords: find matching site change subtype
  DailyPrintView->>renderDeviceEvents: render deduplicated matching events
  renderDeviceEvents->>DailyPrintView: draw timestamp markers and selected icons
Loading

Suggested reviewers: krystophv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: site change events in the daily view.
Description check ✅ Passed The description is brief, but it is clearly related to the same WEB-55 changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch WEB-55-daily-view-site-change-events
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch WEB-55-daily-view-site-change-events

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 commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@krystophv

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

🧹 Nitpick comments (2)
test/components/common/tooltip/EventsInfoTooltip.test.js (1)

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

Mirror the source directory structure.

Move this test to test/components/common/tooltips/EventsInfoTooltip.test.js so its path matches src/components/common/tooltips/EventsInfoTooltip.js.

As per coding guidelines, “Tests must mirror the src/ structure and use the .test.js suffix.”

🤖 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 `@test/components/common/tooltip/EventsInfoTooltip.test.js` around lines 1 - 4,
Move EventsInfoTooltip.test.js from the common/tooltip directory into
common/tooltips so its location mirrors the EventsInfoTooltip source module
under src/components/common/tooltips, preserving the .test.js suffix and
existing test contents.

Source: Coding guidelines

src/modules/print/DailyPrintView.js (1)

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

Use arrow functions for the new helper utilities.

Convert the three new helper declarations to const arrow functions to follow the project’s ES6 convention.

Proposed refactor
-function getSiteChangeSubType(d) {
+const getSiteChangeSubType = (d) => {
   // ...
-}
+};

-function getSiteChangeImage(subType, manufacturer) {
+const getSiteChangeImage = (subType, manufacturer) => {
   // ...
-}
+};

-function dedupeSiteChangesWithinWindow(siteChanges) {
+const dedupeSiteChangesWithinWindow = (siteChanges) => {
   // ...
-}
+};

As per coding guidelines, “Use ES6 constructs such as const/let, arrow functions, and destructuring.”

🤖 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 `@src/modules/print/DailyPrintView.js` around lines 116 - 143, Convert the new
helper declarations getSiteChangeSubType, getSiteChangeImage, and
dedupeSiteChangesWithinWindow from function declarations to const-assigned arrow
functions, preserving their existing parameters, logic, and return behavior.

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.

Nitpick comments:
In `@src/modules/print/DailyPrintView.js`:
- Around line 116-143: Convert the new helper declarations getSiteChangeSubType,
getSiteChangeImage, and dedupeSiteChangesWithinWindow from function declarations
to const-assigned arrow functions, preserving their existing parameters, logic,
and return behavior.

In `@test/components/common/tooltip/EventsInfoTooltip.test.js`:
- Around line 1-4: Move EventsInfoTooltip.test.js from the common/tooltip
directory into common/tooltips so its location mirrors the EventsInfoTooltip
source module under src/components/common/tooltips, preserving the .test.js
suffix and existing test contents.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b27b7c9-5db3-47b2-9152-07bd51681aeb

📥 Commits

Reviewing files that changed from the base of the PR and between 71163cc and db02592.

📒 Files selected for processing (8)
  • package.json
  • src/components/common/tooltips/EventsInfoTooltip.js
  • src/components/daily/eventtooltip/EventTooltip.js
  • src/index.js
  • src/modules/print/DailyPrintView.js
  • test/components/common/tooltip/EventsInfoTooltip.test.js
  • test/components/daily/EventTooltip.test.js
  • test/modules/print/DailyPrintView.test.js

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.

3 participants