Skip to content

Commit

Permalink
fix: second fix in unit from string
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed Nov 11, 2023
1 parent 89d348d commit e7dde40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/Informedica.GenOrder.Lib/Scripts/Api2.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Patient.child
// |> printfn "%s"
| Ok ord ->
ord
|> Order.Print.printOrderToString [|"benzylpenicilline"|]
|> Order.Print.printOrderToString [|"paracetamol"|]
|> fun (prs, prep, adm) -> printfn $"{prs}"
// ord
// |> Order.toString
Expand Down Expand Up @@ -375,3 +375,8 @@ createNew
"rect"
|> Dto.toDto
|> Dto.fromDto


OrderVariable.Count.create ("test" |> Name.fromString)
|> OrderVariable.Count.toDto
|> OrderVariable.Count.fromDto
18 changes: 14 additions & 4 deletions src/Informedica.GenUnits.Lib/ValueUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,12 +1459,22 @@ module Units =
// need to replace nan as this otherwise will be a float
let s = s |> String.replace "nan" "nnn"
match s |> run Parser.parseUnit with
| Success (u, _, _) -> u
| Success (u, _, _) -> Some u
| Failure _ ->
s |> Units.General.general
if s |> String.isNullOrWhiteSpace then None
else
s
|> Units.General.general
|> Some
)
|> List.reduce (fun u1 u2 -> u1 |> Units.per u2)
|> Some
|> fun us ->
if us |> List.forall Option.isSome then
us
|> List.map Option.get
|> List.reduce (fun u1 u2 -> u1 |> Units.per u2)
|> Some
else
None
| _ -> None


Expand Down

0 comments on commit e7dde40

Please sign in to comment.