mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
feat(coach): ground replies in cited reference ranges
Surface the population reference bands behind the metrics a Coach turn carries as a compact, citation-aware grounding block appended after the SNAPSHOT. For each present metric the block states the headline band, its source (blood pressure on the ESH 2023 line, US/ESC framings as context only), and where the user's value sits via the shared four-state placement contract. Framed strictly as general guidance: the block opens and closes with a not-a-diagnosis caveat, never overrides the existing refusal/dose/drug- level safety discipline, and carries no commercial brand name. Glucose respects the diabetes opt-in — the tighter ADA management goal only when the user has declared it, otherwise the general non-diabetic band. The block is deterministic and inspectable: built purely from the reference-range backbone over the same scalars the snapshot already surfaces, so it can never cite a value or band the snapshot does not carry.
This commit is contained in:
1 parent
6fc4b62988
commit
22ffb19fa5
6 files changed
+714
-1
No files matched your search
@@ -393,9 +393,18 @@ The user's message answers this clarifying question from their self-context ques
|
||||
React briefly and personally to the answer; do not repeat the question and do not ask it again.
|
||||
`
|
||||
: "";
|
||||
// v1.18.6 (W7) — citation-aware reference-range grounding for the metrics
|
||||
// present in this snapshot. Deterministic + brand-free; framed as general
|
||||
// guidance, never a diagnosis. Appended after the SNAPSHOT so it is fully
|
||||
// inspectable and the model reads the published population bands + the
|
||||
// user's placement. Omitted entirely when no present metric is covered by
|
||||
// the reference backbone (the builder returns null).
|
||||
const groundingBlock = snapshot.referenceGrounding
|
||||
? `\n${snapshot.referenceGrounding}\n`
|
||||
: "";
|
||||
const userPrompt = `SNAPSHOT
|
||||
${snapshot.snapshotJson || "(no metric data in this user's log yet)"}
|
||||
${guidedBlock}
|
||||
${groundingBlock}${guidedBlock}
|
||||
CONVERSATION
|
||||
${transcript}
|
||||
|
||||
|
||||
Reference in new issue
Block a user