Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEB-3399 - Override/Underride Precision #456

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

henry-tp
Copy link

@henry-tp henry-tp commented Feb 26, 2025

WEB-3399

This PR aligns the tooltip with the chart, so that the both will be in agreement about whether a bolus event is an override/underride or if it is not. Per the ticket, I have changed the chart to not consider it an override if the discrepancy is < 0.01, which is how the tooltip works already.

The important note is that I've changed the comparison in the chart from Recommended vs Delivered to Recommended vs Programmed, which is the comparison that the tooltip makes already. This makes more sense in my head than switching the tooltip to compare Recommended vs Delivered, but let me know if it's not accurate.

Before:

Screenshot 2025-02-26 at 11 34 58

After:

Screenshot 2025-02-26 at 11 34 42


if (!amountRecommended) return false;

return self.isDifferentBeyondPrecision(amountRecommended, amountProgrammed, 2) && amountProgrammed < amountRecommended;
Copy link
Author

@henry-tp henry-tp Feb 26, 2025

Choose a reason for hiding this comment

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

This code is stolen from https://github.com/tidepool-org/viz/blob/develop/src/utils/bolus.js#L335-L372

My feeling from looking at the codebase is that we intentionally don't import Viz into Tideline to decrease coupling, which is why I didn't just import Viz.

Copy link
Author

Choose a reason for hiding this comment

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

Also, previously this chart would compare recommended with delivered but I have switched it to compare recommended with programmed, which makes more sense logically in my head? Alternatively, I can make both Viz and Tideline compare recommended with delivered. Let me know which makes more sense.

Copy link
Member

Choose a reason for hiding this comment

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

It'd probably be good to throw in a unit test for each of these to help ensure that the behavior is maintained going forward.

Copy link
Author

Choose a reason for hiding this comment

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

@krystophv my bad on this one, seems like you're constantly catching me on the testing. I had looked previously and didn't see any test.js files and I kind of assumed we had dropped off on testing for this repo 😓 but it turns out I was looking for the wrong convention. My bad!

Added tests here: b1a32ab

Copy link
Member

Choose a reason for hiding this comment

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

No worries, with the different conventions in different repos, you can't know till you know.

@henry-tp henry-tp requested a review from krystophv February 26, 2025 20:01
Copy link
Member

@krystophv krystophv left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

note: this will need a corresponding blip PR to pull in an updated version of this dependency

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.

2 participants