Skip to content

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

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

[WEB-55] Daily view site change events#1965
clintonium-119 wants to merge 4 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

Thread the clinician's site-change source into the Daily chart and
gate the Events-Shown label on site-change presence:

- patientdata: resolve the source via getSiteChangeSource(patient,
  manufacturer) so the Daily view defaults it per-manufacturer,
  matching the Basics view (no manual selection required).
- daily: thread siteChangeSource through <Daily> into the tideline
  factory options; compute hasSiteChangeEventsInView from in-view
  tags.siteChange data alongside the existing alarm flag.
- eventsInfoLabel: show the info tooltip when alarm OR site-change
  events are in view.
- Export the inner DailyChart class so its chart options are unit
  testable.

Add unit coverage for the threading, the in-view flag, and the
widened label condition.

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

This PR updates the Daily view to support “site change” events by threading a new siteChangeSource option into the tideline daily chart and extending the Events label tooltip behavior to appear when site-change events are in view (not only alarm events). It also bumps the @tidepool/viz and tideline dependencies to versions that support the new functionality, and adds unit tests covering the updated behavior.

Changes:

  • Bump @tidepool/viz and tideline dependency versions for WEB-55 support.
  • Compute and pass siteChangeSource from PatientDataDaily → tideline daily chart options.
  • Show the Events info tooltip when alarms or site-change events are within the current endpoints range; add unit test coverage for both the label and Daily behavior.

Reviewed changes

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

Show a summary per file
File Description
yarn.lock Updates lockfile to the new @tidepool/viz and tideline versions required for site change events support.
package.json Bumps app version and updates direct dependency versions for @tidepool/viz and tideline.
app/pages/patientdata/patientdata.js Computes and passes siteChangeSource into the Daily view component.
app/components/chart/eventsInfoLabel.js Extends tooltip display condition to include site-change events-in-view.
app/components/chart/daily.js Threads siteChangeSource to tideline chart options; computes hasSiteChangeEventsInView and passes it to EventsInfoLabel.
test/unit/components/chart/eventsInfoLabel.test.js Adds unit tests validating tooltip visibility rules for the Events label.
test/unit/components/chart/daily.test.js Adds unit tests for site-change tooltip behavior, siteChangeSource threading, and hasSiteChangeEventsInView computation.

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

Comment on lines 321 to 325
const hasAlarmEventsInView = _.some(
_.filter(nextProps.data.data.combined, d => !!d.tags?.alarm),
d => d.normalTime >= nextProps.data.data.current.endpoints.range[0] && d.normalTime <= nextProps.data.data.current.endpoints.range[1]
isInView
);

@krystophv

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 25, 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 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Daily charts now recognize site-change events and include their source information.
    • The Events tooltip appears when alarm or site-change events are visible in the current chart range.
  • Bug Fixes

    • Event visibility updates correctly as the chart’s time range changes.
  • Tests

    • Added coverage for site-change event detection, tooltip behavior, and chart source handling.

Walkthrough

Daily charts now propagate site-change source metadata and track site-change events within visible endpoints. The events tooltip renders for either alarm or site-change events, with tests covering propagation, visibility, and tooltip behavior.

Changes

Daily site-change event handling

Layer / File(s) Summary
Daily chart source wiring
app/components/chart/daily.js, app/pages/patientdata/patientdata.js, package.json, test/unit/components/chart/daily.test.js
DailyChart is exported separately from its translation wrapper, accepts siteChangeSource, and receives it from the patient data view. Chart-related package versions and source propagation tests are updated.
Site-change event visibility rendering
app/components/chart/daily.js, app/components/chart/eventsInfoLabel.js, test/unit/components/chart/daily.test.js, test/unit/components/chart/eventsInfoLabel.test.js
Daily computes whether alarm and site-change events fall within chart endpoints, passes both flags to EventsInfoLabel, and renders the tooltip when either flag is true. Tests cover visible and out-of-range site-change events.

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

Sequence Diagram(s)

sequenceDiagram
  participant PatientData
  participant Daily
  participant DailyChart
  participant EventsInfoLabel
  participant ChartEndpoints
  PatientData->>Daily: pass siteChangeSource
  Daily->>DailyChart: pass translated chart props
  Daily->>ChartEndpoints: evaluate alarm and site-change events
  ChartEndpoints-->>Daily: return visibility flags
  Daily->>EventsInfoLabel: pass alarm and site-change visibility
  EventsInfoLabel-->>Daily: render tooltip when either flag is true
Loading

Suggested reviewers: krystophv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding daily view support for site change events.
Description check ✅ Passed The description is related to the change through the WEB-55 reference and linked related PRs.
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.
✨ 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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

app/components/chart/daily.js

Parsing error: [BABEL] /app/components/chart/daily.js: Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: undefined. (While processing: "/node_modules/babel-preset-react-app/index.js")

app/components/chart/eventsInfoLabel.js

Parsing error: [BABEL] /app/components/chart/eventsInfoLabel.js: Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: undefined. (While processing: "/node_modules/babel-preset-react-app/index.js")

app/pages/patientdata/patientdata.js

Parsing error: [BABEL] /app/pages/patientdata/patientdata.js: Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: undefined. (While processing: "/node_modules/babel-preset-react-app/index.js")

  • 3 others

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.

🧹 Nitpick comments (2)
test/unit/components/chart/daily.test.js (1)

317-317: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use const for immutable fixture props.

dayDataReadyProps is not reassigned.

Proposed fix
-      var dayDataReadyProps = _.assign({}, baseProps, {
+      const dayDataReadyProps = _.assign({}, baseProps, {

As per coding guidelines, “Use ES6 features: const/let instead of var.”

🤖 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/unit/components/chart/daily.test.js` at line 317, Change the declaration
of the immutable fixture object dayDataReadyProps from var to const, leaving its
initialization and subsequent usage unchanged.

Source: Coding guidelines

app/components/chart/eventsInfoLabel.js (1)

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

Declare PropTypes for both visibility props.

Add hasAlarmEventsInView and hasSiteChangeEventsInView as boolean PropTypes on EventsInfoLabel. 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/components/chart/eventsInfoLabel.js` at line 13, Add boolean PropTypes
for hasAlarmEventsInView and hasSiteChangeEventsInView on the EventsInfoLabel
component, alongside its existing prop definitions, so both destructured
visibility props are explicitly declared.

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 `@app/components/chart/eventsInfoLabel.js`:
- Line 13: Add boolean PropTypes for hasAlarmEventsInView and
hasSiteChangeEventsInView on the EventsInfoLabel component, alongside its
existing prop definitions, so both destructured visibility props are explicitly
declared.

In `@test/unit/components/chart/daily.test.js`:
- Line 317: Change the declaration of the immutable fixture object
dayDataReadyProps from var to const, leaving its initialization and subsequent
usage unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0ea3836-e9a5-49ce-b568-9e726772c9dc

📥 Commits

Reviewing files that changed from the base of the PR and between 485415d and 207662a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • app/components/chart/daily.js
  • app/components/chart/eventsInfoLabel.js
  • app/pages/patientdata/patientdata.js
  • package.json
  • test/unit/components/chart/daily.test.js
  • test/unit/components/chart/eventsInfoLabel.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