GenOrder


GenOrder

Documentation

The GenOrder library can be installed from NuGet:
PM> Install-Package Informedica.GenOrder.Lib -Pre

Example

This example demonstrates using a function defined in this sample library.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
// Create a paracetamol order with an paracetamol orderable
// and how to prescribe this
let ord = 
    Order.createNew 
        ("1" |> Id.create)
        (["paracetamol"] |> Name.create)
        ([["paracetamol"] |> Name.create, [
            ["paracetamol"] |> Name.create, "Mass"
        ]])
        "Tablet"
        "Weight"
        Prescription.discontinuous
        "oral"
//        [
//            ["paracetamol", "ass"]
//        ] 
//        "Shape" 
//        "Weight" 
//        PR.discontinuous
//        "oral"

// Print out the order
ord |> print |> ignore

// Prints:

 Route
 oral
 Prescription
 paracetamol.Freq<..> Count/Time
 Orderable
 paracetamol.Item.Component.Qty<..> Mass
 paracetamol.Item.Orderable.Qty<..> Mass
 paracetamol.Item.Component.Conc<..> Mass/Shape
 paracetamol.Item.Orderable.Conc<..> Mass/Shape
 paracetamol.Item.Dose.Qty<..> Mass
 paracetamol.Item.Dose.Total<..> Mass/Time
 paracetamol.Item.Dose.Rate<..> Mass/Time
 paracetamol.Item.DoseAdjust.QtyAdjust<..> Mass/Weight
 paracetamol.Item.DoseAdjust.TotalAdjust<..> Mass/Weight/Time
 paracetamol.Item.DoseAdjust.RateAdjust<..> Mass/Weight/Time
 paracetamol.Component.Component.Qty<..> Shape
 paracetamol.Component.Orderable.Qty<..> Shape
 paracetamol.Component.Orderable.Count<..> Count
 paracetamol.Component.Orderable.Conc<..> Shape/Shape
 paracetamol.Component.Dose.Qty<..> Shape
 paracetamol.Component.Dose.Total<..> Shape/Time
 paracetamol.Component.Dose.Rate<..> Shape/Time
 paracetamol.Component.DoseAdjust.QtyAdjust<..> Shape/Weight
 paracetamol.Component.DoseAdjust.TotalAdjust<..> Shape/Weight/Time
 paracetamol.Component.DoseAdjust.RateAdjust<..> Shape/Weight/Time
 paracetamol.Orderable.Order.Qty<..> Shape
 paracetamol.Orderable.Orderable.Qty<..> Shape
 paracetamol.Orderable.Order.Count<..> Count
 paracetamol.Orderable.Dose.Qty<..> Shape
 paracetamol.Orderable.Dose.Total<..> Shape/Time
 paracetamol.Orderable.Dose.Rate<..> Shape/Time
 paracetamol.Orderable.DoseAdjust.QtyAdjust<..> Shape/Weight
 paracetamol.Orderable.DoseAdjust.TotalAdjust<..> Shape/Weight/Time
 paracetamol.Orderable.DoseAdjust.RateAdjust<..> Shape/Weight/Time
 Adjust
 paracetamol.Adjust.Qty<..> Weight

// Start entering values for the order while solving
// the calculation model the order at each step
let solve = Order.solve "paracetamol"
ord
|> solve MP.ItemComponentQty SV.Vals [240N; 300N; 500N] "mg"
|> solve MP.OrderableOrderableQty SV.Vals [1N] "tabl"
|> solve MP.OrderableDoseQty SV.Vals [1N] "tabl"
|> solve MP.ItemDoseTotal SV.MaxIncl [4N] "gram/day"
|> solve MP.ItemDoseAdjustTotalAdjust SV.MaxIncl [90N] "mg/kg/day"
|> solve MP.Freq SV.Vals [2N;3N;4N;6N] "x/day"
|> solve MP.AdjustQty SV.Vals [10N] "kg"
|> print
|> ignore

// Prints:

 Route
 oral
 Prescription
 paracetamol.Freq[1/43200, 1/28800, 1/21600, 1/17280, 1/14400] Count/Time
 Orderable
 paracetamol.Item.Component.Qty[6/25, 3/10, 1/2] Mass
 paracetamol.Item.Orderable.Qty<0..9/20] Mass
 paracetamol.Item.Component.Conc<0..9/20] Mass/Shape
 paracetamol.Item.Orderable.Conc<0..9/20] Mass/Shape
 paracetamol.Item.Dose.Qty<0..9/20] Mass
 paracetamol.Item.Dose.Total<0..1/96000] Mass/Time
 paracetamol.Item.Dose.Rate<..> Mass/Time
 paracetamol.Item.DoseAdjust.QtyAdjust<0..9/200000] Mass/Weight
 paracetamol.Item.DoseAdjust.TotalAdjust<0..1/960000000] Mass/Weight/Time
 paracetamol.Item.DoseAdjust.RateAdjust<..> Mass/Weight/Time
 paracetamol.Component.Component.Qty[8/15..> Shape
 paracetamol.Component.Orderable.Qty[1] Shape
 paracetamol.Component.Orderable.Count<..> Count
 paracetamol.Component.Orderable.Conc[1] Shape/Shape
 paracetamol.Component.Dose.Qty[1] Shape
 paracetamol.Component.Dose.Total[1/43200, 1/28800, 1/21600, 1/17280, 1/14400] Shape/Time
 paracetamol.Component.Dose.Rate<..> Shape/Time
 paracetamol.Component.DoseAdjust.QtyAdjust[1/10000] Shape/Weight
 paracetamol.Component.DoseAdjust.TotalAdjust[1/432000000, 1/288000000, 1/216000000,
 1/172800000, 1/144000000] Shape/Weight/Time]
 paracetamol.Component.DoseAdjust.RateAdjust<..> Shape/Weight/Time
 paracetamol.Orderable.Order.Qty<0..> Shape
 paracetamol.Orderable.Orderable.Qty[1] Shape
 paracetamol.Orderable.Order.Count<..> Count
 paracetamol.Orderable.Dose.Qty[1] Shape
 paracetamol.Orderable.Dose.Total[1/43200, 1/28800, 1/21600, 1/17280, 1/14400] Shape/Time
 paracetamol.Orderable.Dose.Rate<..> Shape/Time
 paracetamol.Orderable.DoseAdjust.QtyAdjust<0..> Shape/Weight
 paracetamol.Orderable.DoseAdjust.TotalAdjust<0..> Shape/Weight/Time
 paracetamol.Orderable.DoseAdjust.RateAdjust<..> Shape/Weight/Time
 Adjust
 paracetamol.Adjust.Qty[10000] Weight

Some more info

Samples & documentation

The library comes with comprehensible documentation. It can include tutorials automatically generated from *.fsx files in the content folder. The API reference is automatically generated from Markdown comments in the library implementation.

  • Tutorial contains a further explanation of this sample library.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.

The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

namespace Informedica
namespace Informedica.GenUtils
namespace Informedica.GenUtils.Lib
namespace Informedica.GenUtils.Lib.BCL
namespace Informedica.GenOrder
namespace Informedica.GenOrder.Lib
module Primitives

from Informedica.GenOrder.Lib
module Id

from Informedica.GenOrder.Lib.Primitives
module VariableUnit

from Informedica.GenOrder.Lib


 Functions that deal with the `VariableUnit` type
module Name

from Informedica.GenOrder.Lib.VariableUnitModule


 Helper functions for `Informedica.GenSolver.Variable.Name` type
module Order

from Informedica.GenOrder.Lib


 Types and functions that deal with an order.
 An `Order` models the `Prescription` of an
 `Orderable` with a `StartStop` start date and
 stop date.
module Mapping

from Informedica.GenOrder.Lib.OrderModule


 Utitlity functions to
 enable mapping of a `Variable`s
 to an `Order`
module Solver

from Informedica.GenOrder.Lib


 Helper functions to
 facilitate the use of the
 `Informedica.GenSolver.Lib`
val print : ord:'a -> 'a

Full name: Index.print
val ord : 'a
val s : string
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val ord : Order.Order

Full name: Index.ord
val createNew : id:Primitives.Id.Id -> nm:Informedica.GenSolver.Lib.Variable.Name.Name -> cil:(Informedica.GenSolver.Lib.Variable.Name.Name * (Informedica.GenSolver.Lib.Variable.Name.Name * System.String) list) list -> shp_ung:System.String -> adj_ung:string -> str_prs:(string list -> Prescription.Prescription) -> rot:string -> Order.Order

Full name: Informedica.GenOrder.Lib.OrderModule.createNew


 Create a new orderable using:

 
 * str_prs: a function that takes in a list of strings
 that will generate the names and returns a `Prescription`
 * rot: the route of administration
val create : s:string -> Primitives.Id.Id

Full name: Informedica.GenOrder.Lib.Primitives.IdModule.create
val create : ns:seq<string> -> Informedica.GenSolver.Lib.Variable.Name.Name

Full name: Informedica.GenOrder.Lib.VariableUnitModule.NameModule.create


 Create a `Name` from a list of strings that
module Prescription

from Informedica.GenOrder.Lib


 Types and functions that presents a `Prescription`, i.e. either a
 process, or a continuous prescription or a discontinuous prescription
 with or without a time
val discontinuous : n:string list -> Prescription.Prescription

Full name: Informedica.GenOrder.Lib.PrescriptionModule.discontinuous


 Create a discontinuous `Prescription` with name generated by string list **n**
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
val solve : (Order.Mapping.Map -> Solver.Prop -> BigRational list -> string -> Order.Order -> Order.Order)

Full name: Index.solve
val solve : n:string -> m:Order.Mapping.Map -> p:Solver.Prop -> v:BigRational list -> u:string -> o:Order.Order -> Order.Order

Full name: Informedica.GenOrder.Lib.OrderModule.solve


 Solve an `Order` *ord* with
 
 * n: the name of the variable to be set
 * m: the mapping for the field of the order
 * p: the property of the variable to be set
 * v: the values to be set
union case Order.Mapping.Map.ItemComponentQty: Order.Mapping.Map
union case Solver.Prop.Vals: Solver.Prop
union case Order.Mapping.Map.OrderableOrderableQty: Order.Mapping.Map
union case Order.Mapping.Map.OrderableDoseQty: Order.Mapping.Map
union case Order.Mapping.Map.ItemDoseTotal: Order.Mapping.Map
union case Solver.Prop.MaxIncl: Solver.Prop
union case Order.Mapping.Map.ItemDoseAdjustTotalAdjust: Order.Mapping.Map
union case Order.Mapping.Map.Freq: Order.Mapping.Map
union case Order.Mapping.Map.AdjustQty: Order.Mapping.Map
Fork me on GitHub