Repository navigation
fix(analytics): serve the glucose indices as one figure on every platform - #1583
Merged
Merged
Conversation
…form LBGI and HBGI came back with different last digits on Node 22 than on Node 24 and later, so parity snapshots recorded on one failed on the other. The Kovatchev transform raised ln BG to 1.084 through Math.pow, and V8's pow with a fractional exponent changed between those versions; Math.exp and Math.log did not. The transform now runs through exp and log, the risk branches are summed with Neumaier compensation (tied readings arrive in no fixed order), and SD, CV%, the J-index, LBGI and HBGI are served through roundStableTo at four decimals, on the per-reading engine and on the report's bucket path, whose sums come out of Postgres. The Monnier flag reads the served CV. The same class elsewhere: - summarize() rounds mean, avg7, avg30 and the prior-period means with roundStable2, like the summaries slice and the generate path's Postgres AVG over the same windows. - The mood day series and the overview's daily means round with roundStable2: the rollup tier and the fold sum a day in different orders. - The BP recency weight uses exp instead of pow(0.5, x). - Withings divides by an exact power of ten for a negative unit; Math.pow(10, -4) and (10, -5) are a last bit off on Node 22. The launch-reads and analytics parity snapshots hold the stable values, and pass on Node 22 and Node 26.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LBGI and HBGI differed in the last digits between Node 22 (CI, production image) and Node 24+, so the launch-reads parity snapshots recorded on one failed on the other. Cause:
Math.powwith a fractional exponent in the Kovatchev transform; V8 changed its pow between those versions, whileMath.exp/Math.logdid not.exp(1.084 · ln ln BG); risk branches summed with Neumaier compensation (compensatedSuminsrc/lib/stats/central.ts).roundStableToat four decimals, on the per-reading engine and on the report's bucket path (Postgres sums). The Monnier flag reads the served CV.summarize()means (vs. the slice and the generate path's Postgres AVG), the mood day series and overview daily means (tier vs. fold), the BP recency weight (pow(0.5, x)→exp), and the Withings unit scaling (Math.pow(10, -4|-5)is a last bit off on Node 22).Tests: a unit test that nudges
Math.pow/exp/logby a few ulps, one that reverses tied readings, and one that pins the four-decimal figures; the first two were red before the change, and the pin passes on Node 22 and Node 26. Parity snapshots re-recorded (onlysd,cv,jIndex,lbgi,hbgichange) and verified on Node 22 and Node 26.No changelog line: the surfaces show CV% as a whole number and the indices to one decimal, so no shown value changes outside an exact-boundary case.