Skip to content

Commit

Permalink
chore: update renal rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed Jun 11, 2024
1 parent fbf55bd commit be09bf1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
7 changes: 6 additions & 1 deletion src/Informedica.GenForm.Lib/DoseType.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module DoseType =


open Informedica.GenUnits.Lib.Units
open Informedica.Utils.Lib
open Informedica.Utils.Lib.BCL


Expand Down Expand Up @@ -40,7 +41,11 @@ module DoseType =
| "timed" -> Timed |> withText
| "discontinuous" -> Discontinuous |> withText
| "continuous" -> Continuous |> withText
| _ -> NoDoseType
| _ ->
if doseType |> String.notEmpty then
let msg = $"{doseType} is not a valid dose type!"
ConsoleWriter.writeWarningMessage msg true false
NoDoseType


let toString doseType =
Expand Down
5 changes: 2 additions & 3 deletions src/Informedica.GenForm.Lib/RenalRule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ module RenalRule =
let adjustMinMax dr mm2 mm1 =
match dr with
| Absolute ->
if mm2 <> MinMax.empty then mm2 else mm1
if mm2 = MinMax.empty then mm1 else mm2
| Relative ->
if mm2 = MinMax.empty then mm2
if mm1 = MinMax.empty || mm2 = MinMax.empty then mm1
else
mm1
|> MinMax.calc (*) mm2
Expand All @@ -393,7 +393,6 @@ module RenalRule =
Frequencies =
if renalRule.Frequencies |> Option.isNone then doseRule.Frequencies
else
printfn $"setting freq to renalrule: {renalRule.Frequencies}"
renalRule.Frequencies
DoseLimits =
doseRule.DoseLimits
Expand Down
13 changes: 9 additions & 4 deletions src/Informedica.GenForm.Lib/Scripts/DoseRule.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,35 @@ open Utils

open Informedica.GenUnits.Lib


let filter =
{ Filter.filter with
Generic = Some "methadon"
Indication = Some "Pijn"
Patient =
{ Patient.patient with
VenousAccess = []
Locations = []
Department = Some "ICK"
Age =
Units.Time.day
Units.Time.year
|> ValueUnit.singleWithValue 2N
|> Some
Weight =
Units.Weight.kiloGram
|> ValueUnit.singleWithValue (3N)
|> ValueUnit.singleWithValue (13N)
|> Some
}
}


let dr =
DoseRule.get ()
|> Array.take 1
// |> Array.take 1
|> DoseRule.filter filter
|> Array.item 0

dr.DoseLimits |> Array.length


dr
|> fun dr ->
Expand Down
47 changes: 24 additions & 23 deletions src/Informedica.GenForm.Lib/Scripts/Scripts.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Environment.SetEnvironmentVariable("GENPRES_URL_ID", dataUrlId)
#load "../Filter.fs"
#load "../DoseRule.fs"
#load "../SolutionRule.fs"
#load "../RenalRule.fs"
#load "../PrescriptionRule.fs"


Expand All @@ -33,30 +34,30 @@ open Informedica.GenForm.Lib



{ Filter.filter with
Patient =
{ Filter.filter.Patient with
VenousAccess = []
Department = Some "ICK"
Age =
1N
|> ValueUnit.singleWithUnit Units.Time.year
|> Some
(*
GestAge =
28N
|> ValueUnit.singleWithUnit Units.Time.week
|> Some
*)
}
//Generic = (Some "morfine")
//Route = Some "oraal"
}
|> PrescriptionRule.filter
|> Array.collect _.SolutionRules
//|> Array.take 1
|> SolutionRule.Print.toMarkdown ""
let pr =
{ Filter.filter with
Generic = Some "methadon"
Indication = Some "Pijn"
Patient =
{ Patient.patient with
Locations = []
Department = Some "ICK"
Age =
Units.Time.year
|> ValueUnit.singleWithValue 2N
|> Some
Weight =
Units.Weight.kiloGram
|> ValueUnit.singleWithValue (13N)
|> Some
RenalFunction = EGFR(Some 5, Some 5) |> Some
}
}
|> PrescriptionRule.filter


pr[0].DoseRule.DoseLimits |> Array.length
pr[0].RenalRules

let printAllDoseRules () =
let rs =
Expand Down

0 comments on commit be09bf1

Please sign in to comment.