Skip to content

Commit

Permalink
docs: finished comments for order api
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed Nov 3, 2023
1 parent ed937a9 commit c9b4ae8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
40 changes: 15 additions & 25 deletions src/Informedica.GenOrder.Lib/Api.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Informedica.GenOrder.Lib



module Api =

open MathNet.Numerics
Expand Down Expand Up @@ -276,6 +275,15 @@ module Api =
let increaseIncrements logger ord = Order.increaseIncrements logger 10N 50N ord


/// <summary>
/// Evaluate a PrescriptionRule. The PrescriptionRule can result in
/// multiple Orders, depending on the SolutionRules.
/// </summary>
/// <param name="logger"></param>
/// <param name="rule"></param>
/// <returns>
/// An array of Results, containing the Order and the PrescriptionRule.
/// </returns>
let evaluate logger (rule : PrescriptionRule) =
let rec solve retry sr pr =
pr
Expand Down Expand Up @@ -348,29 +356,9 @@ module Api =
|> Array.map (fun sr -> solve true (Some sr) rule)


// print an order list
let toScenarios ind sn (ords : Order[]) =
ords
|> Array.mapi (fun i o ->
o
|> Order.Print.printOrderToString sn
|> fun (pres, prep, adm) ->
{
No = i
Indication = ind
DoseType = ""
Name = o.Orderable.Name |> Informedica.GenSolver.Lib.Variable.Name.toString
Shape = o.Orderable.Components[0].Shape
Route = o.Route
Prescription = pres
Preparation = prep
Administration = adm
Order = Some o
}
)



/// <summary>
/// Create an initial ScenarioResult for a Patient.
/// </summary>
let scenarioResult pat =
let rules = pat |> PrescriptionRule.get
{
Expand All @@ -395,9 +383,11 @@ module Api =
|> String.replace ">" ""


/// <summary>
/// Use a Filter and a ScenarioResult to create a new ScenarioResult.
/// </summary>
let filter (sc : ScenarioResult) =


if Env.getItem "GENPRES_PROD" |> Option.isNone then
let path = $"{__SOURCE_DIRECTORY__}/log.txt"
OrderLogger.logger.Start (Some path) OrderLogger.Level.Informative
Expand Down
5 changes: 1 addition & 4 deletions src/Informedica.GenSolver.Lib/Api.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Informedica.GenSolver.Lib


/// Public funtions to use the library
/// Public functions to use the library
module Api =

open System
Expand Down Expand Up @@ -63,9 +63,6 @@ module Api =
/// <summary>
/// Solve an `Equations` list
/// </summary>
/// <param name="onlyMinIncrMax">True if only min, incr and max values are to be used</param>
/// <param name="log">The logger to log operations</param>
/// <param name="eqs">List of equations to solve</param>
/// <returns>A result type of the solved equations</returns>
/// <remarks>
/// This function is a wrapper around `Solver.solveAll`
Expand Down

0 comments on commit c9b4ae8

Please sign in to comment.