mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
fix(labs): keep the printed range on a marker minted from a text result
A report that prints a text result such as "SEE NOTE" with a numeric range beside it minted the marker without bounds: the document commit, the scan commit, the free-text lab write and the CSV import each passed null bounds for a qualitative reading, and the CSV row reader and the scan review payload dropped the range before that. The marker's first number then had nothing to be judged against. Every mint path now passes the printed window. A range that is text itself yields no bounds, an existing marker keeps its own, a transposed window is not minted, and the reading itself still records no window. The scan review shows the range on a text row that mints a new marker. Refs #1313
This commit is contained in:
1 parent
e9886ee554
commit
ef61c7d5d1
13 files changed
+520
-39
No files matched your search
@@ -249,10 +249,10 @@ async function commitOcrRows(request: NextRequest) {
|
||||
user.id,
|
||||
{
|
||||
analyte: row.analyte,
|
||||
// A qualitative reading has no numeric unit / range.
|
||||
// A text result has no unit; its printed window still seeds.
|
||||
unit: isQualitative ? (row.unit ?? "") : (row.unit as string),
|
||||
referenceLow: isQualitative ? null : sourceLow,
|
||||
referenceHigh: isQualitative ? null : sourceHigh,
|
||||
referenceLow: sourceLow,
|
||||
referenceHigh: sourceHigh,
|
||||
panel: row.panel ?? null,
|
||||
},
|
||||
{ index: markerIndex },
|
||||
|
||||
@@ -234,12 +234,11 @@ async function postLabResult(request: NextRequest) {
|
||||
} else {
|
||||
biomarker = await resolveOrMintBiomarker(user.id, {
|
||||
analyte: analyte as string,
|
||||
// A qualitative reading has no numeric unit / range — mint the catalog
|
||||
// marker with an empty unit label and no bounds. A numeric reading
|
||||
// supplies its unit (Zod requires it on the free-text numeric path).
|
||||
// A qualitative reading mints with an empty unit but the printed range;
|
||||
// a numeric one supplies its unit (Zod requires it on this path).
|
||||
unit: isQualitative ? (unit ?? "") : (unit as string),
|
||||
referenceLow: isQualitative ? null : (referenceLow ?? null),
|
||||
referenceHigh: isQualitative ? null : (referenceHigh ?? null),
|
||||
referenceLow: referenceLow ?? null,
|
||||
referenceHigh: referenceHigh ?? null,
|
||||
panel: panel ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user