Skip to content

Conversation

@krystophv
Copy link
Member

@krystophv krystophv commented Nov 12, 2025

Improves pump settings selection for date-bounded reports by aligning to the latest in-range insulin upload Ensures corresponding upload records are fetched when missing to keep device context accurate Extracts alignment logic into a testable helper and adds unit coverage for boundary cases

Partnered with viz PR tidepool-org/viz#559 for WEB-3916

Relates to BACK-3250, WEB-3766

Improves pump settings selection for date-bounded reports by aligning to the latest in-range insulin upload
Ensures corresponding upload records are fetched when missing to keep device context accurate
Extracts alignment logic into a testable helper and adds unit coverage for boundary cases

Relates to BACK-3250
Copilot AI review requested due to automatic review settings November 12, 2025 21:27
Copy link

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

This PR improves pump settings selection for date-bounded reports by aligning them with the latest in-range insulin data rather than simply fetching the most recent pump settings. The refactoring extracts the alignment logic into a static, testable helper method and adds comprehensive unit tests for boundary cases.

Key changes:

  • Introduces getLatestInsulinAndPumpSettingsParams static method to identify the latest in-range insulin datum (basal/bolus) and generate appropriate pump settings fetch parameters
  • Implements a fallback strategy: first attempts to fetch pump settings aligned with insulin data, then falls back to the latest pump settings within the date range if no aligned data exists
  • Adds unit tests covering successful alignment and the null case when no in-range insulin data exists

Reviewed Changes

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

File Description
lib/report.mjs Adds static helper method for insulin-aligned pump settings selection and refactors generate() method to use the new alignment strategy with fallback logic; includes minor style fixes (trailing comma, semicolon, import ordering)
test/report.test.js Adds two test cases for the new static method covering successful pump settings param generation and null return when no in-range insulin data is found

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

Aligns pump settings lookup to the latest in-range pump data for continuous datasets and to upload time for non-continuous datasets to better match visualisation behavior.
Passes through only supported metadata needed for downstream settings alignment and corrects a minor comment typo.
Extends tests to cover new bounding rules and validate behavior across dataset types.
@krystophv
Copy link
Member Author

/deploy qa2

@tidebot
Copy link
Collaborator

tidebot commented Dec 8, 2025

krystophv updated values.yaml file in qa2

@tidebot
Copy link
Collaborator

tidebot commented Dec 8, 2025

krystophv updated flux policies file in qa2

@tidebot
Copy link
Collaborator

tidebot commented Dec 8, 2025

krystophv deployed export BACK-3250-pump-settings branch to qa2 namespace

Restructures how pump settings parameters are constructed and passed to improve accuracy for continuous vs non-continuous datasets. Adds conditional logic to set endDate only for continuous data and includes debug logging for better traceability.
Copy link

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

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


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@krystophv krystophv changed the title [BACK-3250] Aligns pump settings with in-range insulin data [BACK-3250] [WEB-3766] Aligns pump settings with in-range insulin data Dec 9, 2025
Copy link
Member

@clintonium-119 clintonium-119 left a comment

Choose a reason for hiding this comment

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

LGTM 🚢
Again, nice work. Always a challenge to work through these sort of data-specific requirements.

@krystophv
Copy link
Member Author

/deploy qa1

@tidebot
Copy link
Collaborator

tidebot commented Dec 12, 2025

krystophv updated values.yaml file in qa1

@tidebot
Copy link
Collaborator

tidebot commented Dec 12, 2025

krystophv updated flux policies file in qa1

@tidebot
Copy link
Collaborator

tidebot commented Dec 12, 2025

krystophv deployed export BACK-3250-pump-settings branch to qa1 namespace

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.

4 participants