Logo GenPRES

Order Module

Creates, solves, checks and prints an order: an orderable given on a schedule by a route, with a start date and an optional stop date.

Types and nested modules

Type/Module Description

Dto

Holds the serializable shape of an order, converts an order to and from the Dto and creates a new order Dto for each schedule kind. Reading a Dto returns OrderCouldNotBeCreated when it fails.

OrderPropertyChange

Applies property changes to an order: a function on the frequency, the time, the adjust value, or a variable of the orderable, component or item.

OrderType

Lists the order types, returns the name of an order type and maps a Dutch dose type text to an order type, DiscontinuousOrder when unknown.

Orderable

Creates, changes, checks and prints an orderable, which holds the components, the quantities and the dose of what is ordered.

Print

Prints an order as prescription, preparation and administration, as rows of text blocks or as text, with the reconstitution and predilution of its product.

Schedule

Creates a once, once timed, continuous, discontinuous or timed schedule and reads, changes, checks and prints its frequency and time.

StartStop

Formats the start date, or the start and stop dates, of an order as text in the form dd-MM-yy.

ValueCaps (Module)

Holds the default maximum numbers of values a pruned variable keeps and returns the maximum for an order by its schedule and number of components.

Equation

ValueCaps (Type)

The maximum number of values a pruned variable keeps, per schedule. The Max caps apply with useMaxNumberOfValues.

Functions and values

Function or value Description

adjustValue ord

Full Usage: adjustValue ord

Parameters:
Returns: ValueUnit option

The values of the adjust quantity of an order, None when the adjust quantity has no value set.

ord : Order
Returns: ValueUnit option

apply f ord

Full Usage: apply f ord

Parameters:
Returns: 'a
Type parameters: 'a

Apply f to Order ord

f : Order -> 'a
ord : Order
Returns: 'a

applyCalculatedConstraints ord

Full Usage: applyCalculatedConstraints ord

Parameters:
Returns: Order
ord : Order
Returns: Order

applyConstraints ord

Full Usage: applyConstraints ord

Parameters:
    ord : Order - The Order

Returns: Order

Apply constraints to an Order

ord : Order

The Order

Returns: Order

areAllConstraintsNotApplied

Full Usage: areAllConstraintsNotApplied

Returns: Order -> bool

Check whether every OrderVariable in an Order is unrestricted or only restricted to values above zero

Returns: Order -> bool

calcMinMax logger

Full Usage: calcMinMax logger

Parameters:
Returns: Order -> Result<Order, (Order * Message list)>
logger : Logger
Returns: Order -> Result<Order, (Order * Message list)>

canSetNormDose ord

Full Usage: canSetNormDose ord

Parameters:
Returns: bool

Whether the norm dose can be set: the dose quantity, or the dose rate of a continuous order, has a value set.

ord : Order
Returns: bool

checkConstraints useCalc

Full Usage: checkConstraints useCalc

Parameters:
    useCalc : bool

Returns: Order -> OrderVariable list

Check whether there are OrderVariables in an Order that are not within their constraints and return those OrderVariables

useCalc : bool
Returns: Order -> OrderVariable list

checkOrderDose pred op ord

Full Usage: checkOrderDose pred op ord

Parameters:
Returns: bool
pred : OrderVariable -> bool
op : bool -> bool -> bool
ord : Order
Returns: bool

components ord

Full Usage: components ord

Parameters:
Returns: string list

The names of the components of an order.

ord : Order
Returns: string list

create id adj_qty orb sch rte tme sts

Full Usage: create id adj_qty orb sch rte tme sts

Parameters:
    id : Id - The id of the Order
    adj_qty : Quantity - The quantity the doses are adjusted with, such as the weight
    orb : Orderable - The Orderable of the Order
    sch : Schedule - The Schedule of the Order
    rte : string - The Route of the Order
    tme : Time - The duration of the Order
    sts : StartStop - The StartStop of the Order

Returns: Order

Creates an order from its parts.

id : Id

The id of the Order

adj_qty : Quantity

The quantity the doses are adjusted with, such as the weight

orb : Orderable

The Orderable of the Order

sch : Schedule

The Schedule of the Order

rte : string

The Route of the Order

tme : Time

The duration of the Order

sts : StartStop

The StartStop of the Order

Returns: Order

createNew start id orbN nmeToSch route

Full Usage: createNew start id orbN nmeToSch route

Parameters:
    start : DateTime - The moment the Order starts, decided by the caller, in UTC
    id : string - The id of the Order
    orbN : string - The name of the Orderable
    nmeToSch : Name -> Schedule - A function to create a Schedule with a Name
    route : string - The Route of the Order

Returns: Order

Create a new Order.

start : DateTime

The moment the Order starts, decided by the caller, in UTC

id : string

The id of the Order

orbN : string

The name of the Orderable

nmeToSch : Name -> Schedule

A function to create a Schedule with a Name

route : string

The Route of the Order

Returns: Order

definedLimits ord

Full Usage: definedLimits ord

Parameters:
Returns: Constraints list

The defined limits of every variable of an order.

ord : Order
Returns: Constraints list

doseHasValues

Full Usage: doseHasValues

Returns: Order -> bool
Returns: Order -> bool

doseIsSolved

Full Usage: doseIsSolved

Returns: Order -> bool
Returns: Order -> bool

equationMapping ord

Full Usage: equationMapping ord

Parameters:
Returns: EquationMapping * EquationMapping

The equation mapping for the schedule of an order.

ord : Order
Returns: EquationMapping * EquationMapping

equationOnlyVariable name max vs

Full Usage: equationOnlyVariable name max vs

Parameters:
Returns: OrderVariable

An order variable that only the equations use, with the maximum max and the values vs as its constraints. The order does not hold it.

name : Name
max : Maximum option
vs : ValueSet option
Returns: OrderVariable

equations ord

Full Usage: equations ord

Parameters:
Returns: OrderEquation list

The equations of an order, from the equation mapping of its schedule.

ord : Order
Returns: OrderEquation list

fromOrdVars ovars ord

Full Usage: fromOrdVars ovars ord

Parameters:
Returns: Order

Create a new Order from a list of OrderVariables using an old Order.

ovars : OrderVariable list

The list of OrderVariables

ord : Order

The old Order

Returns: Order

getAdjust ord

Full Usage: getAdjust ord

Parameters:
Returns: Quantity

Get the Adjust quantity of an Order

ord : Order
Returns: Quantity

getId ord

Full Usage: getId ord

Parameters:
Returns: Id

Get the order id

ord : Order
Returns: Id

getOrderable ord

Full Usage: getOrderable ord

Parameters:
Returns: Orderable

Get the Orderable of an Order

ord : Order
Returns: Orderable

hasAtMostTwoComponents ord

Full Usage: hasAtMostTwoComponents ord

Parameters:
Returns: bool

Whether the order has at most two components; only these orders get value lists.

ord : Order
Returns: bool

hasConstraints

Full Usage: hasConstraints

Returns: Order -> bool

Check whether at least one OrderVariable in an Order has constraints

Returns: Order -> bool

hasNormDose ord

Full Usage: hasNormDose ord

Parameters:
Returns: bool
ord : Order
Returns: bool

hasValues ord

Full Usage: hasValues ord

Parameters:
Returns: bool
ord : Order
Returns: bool

increaseDoseQuantityIncrement maxCount incrs ord

Full Usage: increaseDoseQuantityIncrement maxCount incrs ord

Parameters:
Returns: Order

Raises the increment of the orderable dose quantity to a step in incrs that is a multiple of the increment of the orderable quantity. This applies only when the dose count has no value set. With a value set, the dose quantity is the orderable quantity divided by the dose count and follows the increment of the components. A dose quantity that already has at most maxCount values keeps its increment.

maxCount : RationalX
incrs : Increment list
ord : Order
Returns: Order

increaseIncrements logger maxQtyCount ord

Full Usage: increaseIncrements logger maxQtyCount ord

Parameters:
    logger : Logger - The OrderLogger to use
    maxQtyCount : int - The maximum count of the Orderable Quantity
    ord : Order - The Order to increase the increment of

Returns: Result<Order, 'a>
Type parameters: 'a

Raises the increment of the orderable quantity and the component quantities, then the increment of the dose quantity, and solves for the minimum and maximum after each step. Fewer possible values make the calculation faster. A continuous order, and an order with an orderable quantity in a unit that is not a volume, are returned unchanged. When a step cannot be solved, the order before that step is returned.

logger : Logger

The OrderLogger to use

maxQtyCount : int

The maximum count of the Orderable Quantity

ord : Order

The Order to increase the increment of

Returns: Result<Order, 'a>

increaseQuantityIncrement logger maxCount incrs ord

Full Usage: increaseQuantityIncrement logger maxCount incrs ord

Parameters:
    logger : Logger - The logger
    maxCount : RationalX - The maximum number of values
    incrs : Increment list - The increments to choose from
    ord : Order - The Order

Returns: Order

Sets the orderable quantity and the component orderable quantities of an order to one increment from incrs, so that each component quantity has at most maxCount values when possible.

logger : Logger

The logger

maxCount : RationalX

The maximum number of values

incrs : Increment list

The increments to choose from

ord : Order

The Order

Returns: Order

inf

Full Usage: inf

Returns: Order -> Order

Utility function to facilitate type inference

Returns: Order -> Order

isComposed ord

Full Usage: isComposed ord

Parameters:
Returns: bool

Check whether every component orderable quantity is solved, so the composition of the preparation is set.

ord : Order
Returns: bool

isListedUnion maxCount ords

Full Usage: isListedUnion maxCount ords

Parameters:
    maxCount : int
    ords : Order list

Returns: bool

Whether the orders per concentration can be joined without a range on an increment that holds values none of the orders allows. That holds when each variable has the same range in every order, or when each of its ranges with a minimum, an increment and a maximum can be turned into a list of at most maxCount values. A value list and a range without an increment need no check.

maxCount : int
ords : Order list
Returns: bool

isOneDose ord

Full Usage: isOneDose ord

Parameters:
Returns: bool

Whether the order holds a dose count of 1, so that the whole preparation is one dose.

ord : Order
Returns: bool

isPrepWithinConstraints ord

Full Usage: isPrepWithinConstraints ord

Parameters:
Returns: bool

Check whether the orderable quantity and every component orderable quantity are within their constraints.

ord : Order
Returns: bool

isReachable ord

Full Usage: isReachable ord

Parameters:
Returns: bool

Whether the order is solved and every variable lies within its calculated constraints. A step or a percentile can leave a variable outside them; a recalculation then sets that variable back, and the values of this order are not added to the value lists of the recalculated order.

ord : Order
Returns: bool

isSolved ord

Full Usage: isSolved ord

Parameters:
Returns: bool

Whether every variable of an order that has constraints is solved. A variable without constraints is not checked. The order count is not checked either: dosing never sets how many times an order is dispensed, so the order count stays a range.

ord : Order
Returns: bool

isWithinConstraints useCalc

Full Usage: isWithinConstraints useCalc

Parameters:
    useCalc : bool

Returns: Order -> bool

Check whether all OrderVariables in an Order are within their constraints

useCalc : bool
Returns: Order -> bool

logOrder logger minMax msg ord

Full Usage: logOrder logger minMax msg ord

Parameters:
Type parameters: 'a
logger : Logger
minMax : bool
msg : 'a
ord : Order

mainComponentQuantity ord

Full Usage: mainComponentQuantity ord

Parameters:
Returns: OrderVariable option

The orderable quantity of the main component, the first component of the order.

ord : Order
Returns: OrderVariable option

mapFromOrderEquations ord eqs

Full Usage: mapFromOrderEquations ord eqs

Parameters:
Returns: Order

Map a list of OrderEquations to an Order

ord : Order

The Order

eqs : OrderEquation list

The list of OrderEquations

Returns: Order

mapOrdVars f ord

Full Usage: mapOrdVars f ord

Parameters:
Returns: Order

The order with every order variable mapped by f.

f : OrderVariable -> OrderVariable
ord : Order
Returns: Order

mapToOrderEquations (arg1, arg1) ord

Full Usage: mapToOrderEquations (arg1, arg1) ord

Parameters:
Returns: OrderEquation list A list of OrderEquations

Maps an order to order equations with a sum mapping and a product mapping.

arg0 : EquationMapping
arg1 : EquationMapping
ord : Order

The Order

Returns: OrderEquation list

A list of OrderEquations

KeyNotFoundException When a mapping names a variable that is not a variable of the order, the orderable share or the schedule count.

minIncrMaxToValues caps useMaxNumberOfValues skipRate logger original ord

Full Usage: minIncrMaxToValues caps useMaxNumberOfValues skipRate logger original ord

Parameters:
    caps : ValueCaps - The maximum number of values a pruned variable keeps, per schedule
    useMaxNumberOfValues : bool - Whether to use the larger Max caps
    skipRate : bool - Whether to skip the orderable dose rate, to expand a timed order in stages
    logger : Logger - The logger
    original : Order option - An earlier order whose values are added to the value lists when it is reachable
    ord : Order - The Order

Returns: Result<Order, (Order * Message list)> The order with values, or the last order that solved, with the messages

Turns the min, incr and max ranges of the component orderable quantities, the orderable dose quantity and the orderable dose rate into value lists, one variable at a time, and solves the order after each.

The component quantities, the dose quantity and the rate are pruned to rounded steps. The time of a timed order is left free, so the rate determines how long the dose quantity runs.

caps : ValueCaps

The maximum number of values a pruned variable keeps, per schedule

useMaxNumberOfValues : bool

Whether to use the larger Max caps

skipRate : bool

Whether to skip the orderable dose rate, to expand a timed order in stages

logger : Logger

The logger

original : Order option

An earlier order whose values are added to the value lists when it is reachable

ord : Order

The Order

Returns: Result<Order, (Order * Message list)>

The order with values, or the last order that solved, with the messages

oneTimes

Full Usage: oneTimes

Returns: ValueUnit

The value 1 times.

Returns: ValueUnit

orderableShare ord

Full Usage: orderableShare ord

Parameters:
Returns: OrderVariable

The share of the orderable in itself: the constant value 1 times, which the shares of the components add up to.

ord : Order
Returns: OrderVariable

pickId id reconstitution predilution

Full Usage: pickId id reconstitution predilution

Parameters:
Returns: string

The id of a product in a product pick: the product id, followed by the solvent of its reconstitution and then by its predilution, such as "185663 water 3 mL + 7 mL gluc 5%", so that two reconstitutions or two predilutions of one product have different ids. The id uses the display text of the volumes, so a change of that text changes the stored pick ids.

id : string
reconstitution : ComponentReconstitution option
predilution : ComponentPredilution option
Returns: string

pickNearestHigherElseLowerComponentQuantity logger ord

Full Usage: pickNearestHigherElseLowerComponentQuantity logger ord

Parameters:
Returns: Result<Order, (Order * Message list)>
logger : Logger
ord : Order
Returns: Result<Order, (Order * Message list)>

predilutionText ord

Full Usage: predilutionText ord

Parameters:
Returns: string option

The predilution of the first component of an order as text, such as "3 mL verdund met 7 mL gluc 5%". Returns None when not exactly one product of that component applies or that product is not pre-diluted.

ord : Order
Returns: string option

predilutionToString word pd

Full Usage: predilutionToString word pd

Parameters:
Returns: string

The product volume, the word, the diluent volume and the diluent of a predilution, such as "3 mL verdund met 7 mL gluc 5%".

word : string
pd : ComponentPredilution
Returns: string

preparationNames ord

Full Usage: preparationNames ord

Parameters:
Returns: Set<Name>

The names of the preparation variables: the orderable quantity, the orderable quantity, count and concentration of each component, and the orderable quantity and concentration of each item.

ord : Order
Returns: Set<Name>

preparationQuantities ord

Full Usage: preparationQuantities ord

Parameters:
Returns: OrderVariable list

The orderable quantity of the order and of each component.

ord : Order
Returns: OrderVariable list

print logger ord

Full Usage: print logger ord

Parameters:
Returns: Order
logger : Logger
ord : Order
Returns: Order

printTable format

Full Usage: printTable format

Parameters:
Returns: Order -> unit
format : Format
Returns: Order -> unit

productIds ord

Full Usage: productIds ord

Parameters:
Returns: string array

The pick ids of the products that apply to the values of the components of an order.

ord : Order
Returns: string array

pruneSteps

Full Usage: pruneSteps

Returns: ValueUnit list

The rounded steps a pruned quantity or rate keeps the multiples of, in mL and in mL/uur.

Returns: ValueUnit list

quantityIncrements

Full Usage: quantityIncrements

Returns: Increment list

The increments a quantity in mL is raised along.

Returns: Increment list

quantitySteps

Full Usage: quantitySteps

Returns: ValueUnit list

The rounded steps of a quantity in mL, up to 50 mL.

Returns: ValueUnit list

rateSteps

Full Usage: rateSteps

Returns: ValueUnit list

The rounded steps of a rate in mL/uur, up to 10 mL/uur.

Returns: ValueUnit list

rateWaits ord

Full Usage: rateWaits ord

Parameters:
Returns: bool

Whether the rate of the order waits for its dose quantity: the rate of a timed or once timed order gets its values only once the dose quantity has one value.

ord : Order
Returns: bool

reconstitutionText ord

Full Usage: reconstitutionText ord

Parameters:
Returns: string option

The reconstitution of the first component of an order as text, such as "10 mL NaCl 0,9%". Returns None when not exactly one product of that component applies or that product is not reconstituted.

ord : Order
Returns: string option

roundedSteps maxStep u

Full Usage: roundedSteps maxStep u

Parameters:
Returns: ValueUnit list

The rounded steps from 0.1 to 500 in unit u, up to and including maxStep. An increment is raised along these steps, and a prune keeps their multiples.

maxStep : RationalX
u : Unit
Returns: ValueUnit list

scheduleCount ord

Full Usage: scheduleCount ord

Parameters:
Returns: OrderVariable

The schedule count: the administration time times the frequency, at most 1 times, so that one administration ends before the next starts. Only the equations of a timed order use it.

ord : Order
Returns: OrderVariable

setCalculatedConstraints ord

Full Usage: setCalculatedConstraints ord

Parameters:
Returns: Order
ord : Order
Returns: Order

setDoseUnit sn du ord

Full Usage: setDoseUnit sn du ord

Parameters:
Returns: Order
sn : string
du : Unit
ord : Order
Returns: Order

setMedianDoseValue ord

Full Usage: setMedianDoseValue ord

Parameters:
Returns: Order
ord : Order
Returns: Order

solve msg minMax printErr logger ord

Full Usage: solve msg minMax printErr logger ord

Parameters:
    msg : string - A message for logging
    minMax : bool - Whether to solve only for the minimum and maximum
    printErr : bool - Whether to print the error
    logger : Logger - The logger
    ord : Order - The Order

Returns: Result<Order, (Order * Message list)> The solved Order, or the Order with the error messages. An exception of the solver is returned as an UnexpectedException message.

Solves an order. After each solve the item concentrations are narrowed to the products that apply, and the order is solved again when that removed a value.

msg : string

A message for logging

minMax : bool

Whether to solve only for the minimum and maximum

printErr : bool

Whether to print the error

logger : Logger

The logger

ord : Order

The Order

Returns: Result<Order, (Order * Message list)>

The solved Order, or the Order with the error messages. An exception of the solver is returned as an UnexpectedException message.

solveMinMax msg printErr logger

Full Usage: solveMinMax msg printErr logger

Parameters:
    msg : string - A message for logging
    printErr : bool - Whether to print the error
    logger : Logger - The logger

Returns: Order -> Result<Order, (Order * Message list)>

Solve an Order for only the minimum and maximum values

msg : string

A message for logging

printErr : bool

Whether to print the error

logger : Logger

The logger

Returns: Order -> Result<Order, (Order * Message list)>

solveNormDose logger ord

Full Usage: solveNormDose logger ord

Parameters:
Returns: Result<Order, (Order * Message list)>
logger : Logger
ord : Order
Returns: Result<Order, (Order * Message list)>

solveOrder msg printErr logger

Full Usage: solveOrder msg printErr logger

Parameters:
    msg : string - A message for logging
    printErr : bool - Whether to print the error
    logger : Logger - The logger

Returns: Order -> Result<Order, (Order * Message list)>

Solve an Order for all values

msg : string

A message for logging

printErr : bool

Whether to print the error

logger : Logger

The logger

Returns: Order -> Result<Order, (Order * Message list)>

splitPerConcentration maxCount setsBack ord

Full Usage: splitPerConcentration maxCount setsBack ord

Parameters:
Returns: Order list

Returns the order once per combination of the item concentrations of its components. Returns the order alone when there is at most one combination or more than maxCount.

maxCount : int
setsBack : OrderVariable -> bool
ord : Order
Returns: Order list

startOf ord

Full Usage: startOf ord

Parameters:
Returns: DateTime

The moment an order starts.

ord : Order
Returns: DateTime

toConsoleTable ord

Full Usage: toConsoleTable ord

Parameters:
Returns: ConsoleTable
ord : Order
Returns: ConsoleTable

toConsoleTableString

Full Usage: toConsoleTableString

Returns: Order -> string
Returns: Order -> string

toOrdVars ord

Full Usage: toOrdVars ord

Parameters:
Returns: OrderVariable list

Return an Order as a list of OrderVariables

ord : Order
Returns: OrderVariable list

toString ord

Full Usage: toString ord

Parameters:
Returns: string list

Return an Order as a list of strings where each string is a variable name with the value range and the Unit

ord : Order
Returns: string list

toStringWithConstraints ord

Full Usage: toStringWithConstraints ord

Parameters:
Returns: string list

Return an Order as a list of strings where each string is a variable name with the value range, the Unit and the constraints

ord : Order
Returns: string list

unionPerConcentration maxCount records orig ords

Full Usage: unionPerConcentration maxCount records orig ords

Parameters:
    maxCount : int
    records : bool
    orig : Order
    ords : Order list

Returns: Order

Joins the orders per concentration into one order. Each variable of orig gets the union of its ranges in ords, and the union of their calculated constraints when records is true.

maxCount : int
records : bool
orig : Order
ords : Order list
Returns: Order

withAdjustValue adjust ord

Full Usage: withAdjustValue adjust ord

Parameters:
Returns: Order

Sets the adjust quantity of an order to the value adjust in its defined and calculated constraints, and applies the defined constraints to it.

adjust : ValueUnit
ord : Order
Returns: Order

withCalculatedConstraintsOf from ord

Full Usage: withCalculatedConstraintsOf from ord

Parameters:
Returns: Order

The order with the calculated constraints of the variables with the same name in from.

from : Order
ord : Order
Returns: Order

withDefinedLimitsOf built ord

Full Usage: withDefinedLimitsOf built ord

Parameters:
Returns: Order

Copies the defined constraints from built, an order built from the same rule with the same id, to the variables of ord with the same name. A variable that built does not have keeps its constraints. The adjust quantity always keeps its own constraints, and so do the preparation variables when the dose count is not 1.

built : Order
ord : Order
Returns: Order

withVariablesOf take from ord

Full Usage: withVariablesOf take from ord

Parameters:
Returns: Order

The order with each variable taken over by take from the variable with the same name in from. A variable that from does not have stays as it is.

take : OrderVariable -> OrderVariable -> OrderVariable
from : Order
ord : Order
Returns: Order

withoutCalculatedConstraints ord

Full Usage: withoutCalculatedConstraints ord

Parameters:
Returns: Order

The order without calculated constraints.

ord : Order
Returns: Order

Type something to start searching.