From 36e19603c9eccf5dacada5873a83deb86f72cb0a Mon Sep 17 00:00:00 2001 From: Casper Bollen Date: Fri, 24 May 2024 09:54:57 +0200 Subject: [PATCH] feat: fix incorrect 10% margin and print normal dose advice --- src/Informedica.GenOrder.Lib/DrugOrder.fs | 4 ++-- src/Informedica.GenOrder.Lib/OrderVariable.fs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Informedica.GenOrder.Lib/DrugOrder.fs b/src/Informedica.GenOrder.Lib/DrugOrder.fs index db959ef..2799e4a 100644 --- a/src/Informedica.GenOrder.Lib/DrugOrder.fs +++ b/src/Informedica.GenOrder.Lib/DrugOrder.fs @@ -68,12 +68,12 @@ module DrugOrder = let limToVu = Option.map Limit.getValueUnit - let times0_95 = (95N/100N) |> ValueUnit.singleWithUnit Units.Count.times + let times0_90 = (90N/100N) |> ValueUnit.singleWithUnit Units.Count.times let times1_10 = (11N/10N) |> ValueUnit.singleWithUnit Units.Count.times let min = match minMax.Min, norm with - | None, Some norm -> norm * times0_95 |> Some + | None, Some norm -> norm * times0_90 |> Some | _ -> minMax.Min |> limToVu |> vuToDto diff --git a/src/Informedica.GenOrder.Lib/OrderVariable.fs b/src/Informedica.GenOrder.Lib/OrderVariable.fs index 573d7d2..95da2e4 100644 --- a/src/Informedica.GenOrder.Lib/OrderVariable.fs +++ b/src/Informedica.GenOrder.Lib/OrderVariable.fs @@ -82,12 +82,18 @@ module OrderVariable = >> Option.map (Decimal.toStringNumberNLWithoutTrailingZerosFixPrecision 3) >> Option.defaultValue "" + let times0_90 = (90N/100N) |> ValueUnit.singleWithUnit Units.Count.times + let times1_10 = (11N/10N) |> ValueUnit.singleWithUnit Units.Count.times + match cs.Min |> Option.map Minimum.toValueUnit, cs.Max |> Option.map Maximum.toValueUnit with | Some min, Some max -> if min |> ValueUnit.eqs max then $"{min |> toStr}" else - $"{min |> toVal} - {max |> toStr}" + if min / times0_90 = (max / times1_10) then + $"{min / times0_90 |> toStr}" + else + $"{min |> toVal} - {max |> toStr}" | _ -> ""