mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 00:12:18 +00:00
Publish which blood-pressure axis set the pillar score
The score is the worse of the systolic and diastolic sub-scores, and until now nothing said which one it was or how far over its ceiling the reading sat. The grader now returns that basis together with the score, as one value, and it is carried as one value all the way to the pillar so an explanation can never belong to a different grading run than the number it explains.
This commit is contained in:
1 parent
4d6091ec45
commit
64a92fd392
8 files changed
+207
-65
No files matched your search
@@ -11,6 +11,7 @@ import { collectBpPairs } from "@/lib/analytics/bp-in-target";
|
||||
import {
|
||||
gradeBpScoreFromSeries,
|
||||
representativeBpFromSeries,
|
||||
type BpGrade,
|
||||
} from "@/lib/analytics/bp-grade";
|
||||
import type { BpTargets } from "@/lib/analytics/bp-targets";
|
||||
import { resolveWeightTargetOverride } from "@/lib/analytics/effective-range";
|
||||
@@ -86,7 +87,12 @@ interface ActivityRead {
|
||||
interface ScoreBpEnvelope {
|
||||
path: "rollup" | "live" | undefined;
|
||||
last90Days: { pairs: number } | null;
|
||||
gradedScore: number | null;
|
||||
/**
|
||||
* v1.34.5 — score AND basis as one value, straight off the envelope
|
||||
* the route built. Never re-graded here: a second evaluation is how
|
||||
* the popover would end up explaining a different number.
|
||||
*/
|
||||
graded: BpGrade | null;
|
||||
representative: { sys: number; dia: number } | null;
|
||||
last90EarliestAt: Date | null;
|
||||
last90LatestAt: Date | null;
|
||||
@@ -329,7 +335,7 @@ function scoreBpEnvelope(args: {
|
||||
envelope: {
|
||||
path: args.base.path,
|
||||
last90Days: args.base.last90Days,
|
||||
gradedScore: args.base.gradedScore,
|
||||
graded: args.base.graded,
|
||||
representative: args.base.representative,
|
||||
last90EarliestAt: args.base.last90EarliestAt,
|
||||
last90LatestAt: args.base.last90LatestAt,
|
||||
@@ -352,7 +358,7 @@ function scoreBpEnvelope(args: {
|
||||
envelope: {
|
||||
path: undefined,
|
||||
last90Days: null,
|
||||
gradedScore: null,
|
||||
graded: null,
|
||||
representative: null,
|
||||
last90EarliestAt: null,
|
||||
last90LatestAt: null,
|
||||
@@ -385,7 +391,7 @@ function scoreBpEnvelope(args: {
|
||||
envelope: {
|
||||
path: "live",
|
||||
last90Days: { pairs: pairs.length },
|
||||
gradedScore: target
|
||||
graded: target
|
||||
? gradeBpScoreFromSeries({
|
||||
pairs,
|
||||
target,
|
||||
@@ -492,7 +498,7 @@ function scoreInputsFor(args: {
|
||||
readFailed: args.bp.readFailed,
|
||||
asOf,
|
||||
pairCount: args.bp.last90Days?.pairs ?? 0,
|
||||
gradedScore: args.bp.gradedScore,
|
||||
graded: args.bp.graded,
|
||||
representative: args.bp.representative,
|
||||
oldestAt: args.bp.last90EarliestAt,
|
||||
latestAt: args.bp.last90LatestAt,
|
||||
|
||||
Reference in new issue
Block a user