Logo GenPRES

OrderVariable Module

Creates and changes an order variable, a solver variable with defined and calculated constraints: applies the constraints, selects or steps a value and prints values.

Nested modules

Modules Description

Concentration

Wraps an order variable as a concentration, a quantity per quantity, with the name part cnc, and applies the order variable functions to it.

Constraints

Creates, changes, checks and prints the constraints of an order variable and converts the constraints to and from a value range.

Count

Wraps an order variable as a count, with the name part cnt, and applies the order variable functions to it.

Dto

Holds the serializable shape of an order variable and converts an order variable to and from the Dto. Reading a Dto raises an exception when a value is not valid.

Frequency

Wraps an order variable as a frequency, with the name part frq, and applies the order variable functions to it.

PerTime

Wraps an order variable as a quantity per time, with the name part ptm, and applies the order variable functions to it.

PerTimeAdjust

Wraps an order variable as an adjusted quantity per time, with the name part ptm_adj, and applies the order variable functions to it.

Quantity

Wraps an order variable as a quantity, with the name part qty, and applies the order variable functions to it.

QuantityAdjust

Wraps an order variable as an adjusted quantity such as mg/kg, with the name part qty_adj, and applies the order variable functions to it.

Rate

Wraps an order variable as a rate, with the name part rte, and applies the order variable functions to it.

RateAdjust

Wraps an order variable as an adjusted rate such as mL/kg/hour, with the name part rte_adj, and applies the order variable functions to it.

Time

Wraps an order variable as a time, with the name part tme, and applies the order variable functions to it.

Total

Wraps an order variable as a total, with the name part tot, and applies the order variable functions to it.

TotalAdjust

Wraps an order variable as an adjusted total such as mL/kg, with the name part tot_adj, and applies the order variable functions to it.

Functions and values

Function or value Description

applyCalculatedConstraints ovar

Full Usage: applyCalculatedConstraints ovar

Parameters:
Returns: OrderVariable
ovar : OrderVariable
Returns: OrderVariable

applyConstraints ovar

Full Usage: applyConstraints ovar

Parameters:
Returns: OrderVariable

Sets the Variable to the calculated constraints when these are not empty and not only an exclusive minimum of zero. Otherwise sets the Variable to the defined constraints, or to non-zero positive when there are no defined constraints.

A ValueSet in the constraints replaces their minimum, maximum and increment.

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

applyDefinedConstraints ovar

Full Usage: applyDefinedConstraints ovar

Parameters:
Returns: OrderVariable

Set the Variable of an OrderVariable to its defined constraints; the constraints stay as they are.

ovar : OrderVariable
Returns: OrderVariable

applyOnlyMaxConstraints ovar

Full Usage: applyOnlyMaxConstraints ovar

Parameters:
Returns: OrderVariable

Sets the Variable to the increment and maximum of the defined constraints. Without defined constraints, sets the Variable to non-zero positive.

ovar : OrderVariable
Returns: OrderVariable

applyOnlyMinIncrConstraints ovar

Full Usage: applyOnlyMinIncrConstraints ovar

Parameters:
Returns: OrderVariable

Sets the Variable to the minimum and increment of the defined constraints. Without defined constraints, sets the Variable to non-zero positive.

ovar : OrderVariable
Returns: OrderVariable

byName ovars

Full Usage: byName ovars

Parameters:
Returns: Map<Name, OrderVariable>

Returns a map of the order variables by name.

ovars : OrderVariable list
Returns: Map<Name, OrderVariable>

clear ovar

Full Usage: clear ovar

Parameters:
Returns: OrderVariable

Clear the Values of the Variable of an OrderVariable

ovar : OrderVariable
Returns: OrderVariable

clearCalculatedConstraints ovar

Full Usage: clearCalculatedConstraints ovar

Parameters:
Returns: OrderVariable

Removes the calculated constraints of an order variable.

ovar : OrderVariable
Returns: OrderVariable

convertFirstUnit u ovar

Full Usage: convertFirstUnit u ovar

Parameters:
Returns: OrderVariable

Convert the Variable of an OrderVariable to a given Unit. Note the first unit is replaced by the given unit; all other units are kept. Example: mg/kg/day to g/kg/day when u = g

u : Unit

The Unit to convert to

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

convertTimeUnit tu ovar

Full Usage: convertTimeUnit tu ovar

Parameters:
Returns: OrderVariable

Convert the Variable of an OrderVariable to a given time Unit. Note the last unit is replaced by the given time unit; all other units are kept. Example: mg/kg/day to mg/kg/week when tu = week

tu : Unit

The time Unit to convert to

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

create n min incr max vs cst cal

Full Usage: create n min incr max vs cst cal

Parameters:
    n : Name - The Name of the Variable
    min : Minimum option - An optional Minimum of the Variable
    incr : Increment option - An optional Increment of the Variable
    max : Maximum option - An optional Maximum of the Variable
    vs : ValueSet option - An optional ValueSet of the Variable
    cst : Constraints - The Constraints for the OrderVariable
    cal : Constraints - The calculated constraints

Returns: OrderVariable

Creates an OrderVariable: a Variable with defined and calculated Constraints.

n : Name

The Name of the Variable

min : Minimum option

An optional Minimum of the Variable

incr : Increment option

An optional Increment of the Variable

max : Maximum option

An optional Maximum of the Variable

vs : ValueSet option

An optional ValueSet of the Variable

cst : Constraints

The Constraints for the OrderVariable

cal : Constraints

The calculated constraints

Returns: OrderVariable

createNew n un

Full Usage: createNew n un

Parameters:
    n : Name - The Name of the Variable
    un : Unit - The Unit of the Values in the Variable and Constraints

Returns: OrderVariable

Create a new OrderVariable. The OrderVariable will have an exclusive Minimum of zero and a Constraints with an exclusive Minimum of zero

n : Name

The Name of the Variable

un : Unit

The Unit of the Values in the Variable and Constraints

Returns: OrderVariable

decrease useLarge n

Full Usage: decrease useLarge n

Parameters:
    useLarge : bool
    n : int

Returns: OrderVariable -> OrderVariable
useLarge : bool
n : int
Returns: OrderVariable -> OrderVariable

eqsName ovar1 ovar2

Full Usage: eqsName ovar1 ovar2

Parameters:
Returns: bool

Check whether two OrderVariables have the same name

ovar1 : OrderVariable
ovar2 : OrderVariable
Returns: bool

eqsUnitGroup ovar1 ovar2

Full Usage: eqsUnitGroup ovar1 ovar2

Parameters:
Returns: bool

Checks whether two OrderVariables have units of the same group, so that their values can be added or subtracted.

ovar1 : OrderVariable
ovar2 : OrderVariable
Returns: bool

fixToValues setsBack vu ovar

Full Usage: fixToValues setsBack vu ovar

Parameters:
Returns: OrderVariable option

Fixes the order variable to the values of vu, as for one concentration. Sets the defined value list, and the calculated value list when there is one, to those values, so that a reset of the variable returns them. When setsBack ovar is true, the values are not narrowed; otherwise they are narrowed to vu, and the result is None when none of those values lie in the current range.

setsBack : OrderVariable -> bool
vu : ValueUnit
ovar : OrderVariable
Returns: OrderVariable option

free ovar

Full Usage: free ovar

Parameters:
Returns: OrderVariable

Frees the values of an order variable. With a defined increment, the values become any multiple of that increment from the smallest increment up, with no maximum. Without a defined increment, the values become non-zero positive.

ovar : OrderVariable
Returns: OrderVariable

getConstraints arg1

Full Usage: getConstraints arg1

Parameters:
Returns: Constraints

Get the defined Constraints from an OrderVariable

arg0 : OrderVariable
Returns: Constraints

getName ovar

Full Usage: getName ovar

Parameters:
Returns: Name

Get the Variable.Name from an OrderVariable

ovar : OrderVariable
Returns: Name

getNames ovars

Full Usage: getNames ovars

Parameters:
Returns: string

Get the names of a list of OrderVariables as a comma-separated string

ovars : OrderVariable list
Returns: string

getNormValue ovar

Full Usage: getNormValue ovar

Parameters:
Returns: ValueUnit option
ovar : OrderVariable
Returns: ValueUnit option

getValSetValueUnit ovar

Full Usage: getValSetValueUnit ovar

Parameters:
Returns: ValueUnit option

Get the optional ValueUnit from the ValueSet of the Variable

ovar : OrderVariable
Returns: ValueUnit option

getVar arg1

Full Usage: getVar arg1

Parameters:
Returns: Variable

Get the Variable from an OrderVariable

arg0 : OrderVariable
Returns: Variable

hasConstraints

Full Usage: hasConstraints

Returns: OrderVariable -> bool

Checks whether the defined Constraints of an OrderVariable are not empty and not only an exclusive minimum of zero.

Returns: OrderVariable -> bool

hasIncrConstraint ovar

Full Usage: hasIncrConstraint ovar

Parameters:
Returns: bool

Checks whether the defined constraints have an increment. The values are not checked, because the solver can calculate values without an increment.

ovar : OrderVariable
Returns: bool

hasIncrement ovar

Full Usage: hasIncrement ovar

Parameters:
Returns: bool

Check whether the ValueRange of the Variable of an OrderVariable is a MinIncrMax, i.e. has an increment

ovar : OrderVariable
Returns: bool

hasMaxConstraint ovar

Full Usage: hasMaxConstraint ovar

Parameters:
Returns: bool

Check whether the defined Constraints of an OrderVariable have a Maximum or a ValueSet

ovar : OrderVariable
Returns: bool

hasMaxValue ovar

Full Usage: hasMaxValue ovar

Parameters:
Returns: bool

Checks whether the values of the OrderVariable have a maximum; a single value also has one.

ovar : OrderVariable
Returns: bool

hasOneCalculatedValue ovar

Full Usage: hasOneCalculatedValue ovar

Parameters:
Returns: bool

Checks whether the calculated constraints of an order variable have a value set of one value.

ovar : OrderVariable
Returns: bool

hasOneValue ovar

Full Usage: hasOneValue ovar

Parameters:
Returns: bool

Checks whether the values of an order variable are a list of one value.

ovar : OrderVariable
Returns: bool

hasValues ovar

Full Usage: hasValues ovar

Parameters:
Returns: bool

Check whether the Values of the Variable of an OrderVariable are set, i.e., have a distinct set of values

ovar : OrderVariable
Returns: bool

includeOriginalValue original ovar

Full Usage: includeOriginalValue original ovar

Parameters:
Returns: OrderVariable

Adds the value of original to the value list of ovar when original has one value, ovar has a value list and the value lies within the calculated constraints of ovar. Otherwise returns ovar unchanged.

original : OrderVariable
ovar : OrderVariable
Returns: OrderVariable

increase useLarge n

Full Usage: increase useLarge n

Parameters:
    useLarge : bool
    n : int

Returns: OrderVariable -> OrderVariable
useLarge : bool
n : int
Returns: OrderVariable -> OrderVariable

increaseIncrement maxCount incrs ovar

Full Usage: increaseIncrement maxCount incrs ovar

Parameters:
Returns: OrderVariable The resulting (more restrictive) ValueRange

Try and increase the increment of a ValueRange of a Variable to an increment in incrs such that the resulting ValueRange contains at most maxCount values.

When there is no increment in the list that can be used to increase the increment of the ValueRange to the maximum count, the largest possible increment is used.

maxCount : RationalX

The maximum count

incrs : Increment list

The increment list

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

The resulting (more restrictive) ValueRange

isCleared ovar

Full Usage: isCleared ovar

Parameters:
Returns: bool

Check whether the Values of the Variable of an OrderVariable are cleared, i.e., unrestricted

ovar : OrderVariable
Returns: bool

isConstraintsNotApplied ovar

Full Usage: isConstraintsNotApplied ovar

Parameters:
Returns: bool

Checks whether the values of the Variable are unrestricted, non-zero positive or have an exclusive minimum of zero, so that no constraints have been applied.

ovar : OrderVariable
Returns: bool

isNonZeroPositive ovar

Full Usage: isNonZeroPositive ovar

Parameters:
Returns: bool

Check whether the Values of the Variable of an OrderVariable are non-zero positive or have an exclusive Minimum of zero

ovar : OrderVariable
Returns: bool

isSolved ovar

Full Usage: isSolved ovar

Parameters:
Returns: bool

Checks whether the Variable is solved: one value, unrestricted or non-zero positive.

ovar : OrderVariable

The OrderVariable

Returns: bool

isWithinConstraints useCalc ovar

Full Usage: isWithinConstraints useCalc ovar

Parameters:
Returns: bool

Checks whether the values of the Variable lie within the calculated constraints when useCalc is true, else within the defined constraints. Returns true when there are no defined constraints.

useCalc : bool
ovar : OrderVariable
Returns: bool

largeIncrement ovar

Full Usage: largeIncrement ovar

Parameters:
Returns: Increment option

Returns the increment a large step moves by: the calculated increment, or ten times the calculated increment when that is 0.1 mL or 0.1 mL/hour; None when the order variable has no calculated increment.

ovar : OrderVariable
Returns: Increment option

map f ovar

Full Usage: map f ovar

Parameters:
Returns: OrderVariable

Map a function f to the Values (i.e., ValueUnit) of the Variable of the OrderVariable

f : ValueUnit -> ValueUnit

The function to map

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

mapConstraints f ovar

Full Usage: mapConstraints f ovar

Parameters:
Returns: OrderVariable

Applies f to the defined Constraints of an OrderVariable.

f : Constraints -> Constraints
ovar : OrderVariable
Returns: OrderVariable

minIncrMaxToValues steps n ovar

Full Usage: minIncrMaxToValues steps n ovar

Parameters:
    steps : ValueUnit list - The rounded steps whose multiples are kept when the ValueSet is pruned
    n : int option - Prune the ValueSet to max n values
    ovar : OrderVariable - The OrderVariable to change min incr max to a ValueSet

Returns: OrderVariable An OrderVariable with a Variable with a ValueSet if this can be calculated

Calculate a ValueSet for a Variable of an OrderVariable if the Value of the Variable is a MinIncrMax

steps : ValueUnit list

The rounded steps whose multiples are kept when the ValueSet is pruned

n : int option

Prune the ValueSet to max n values

ovar : OrderVariable

The OrderVariable to change min incr max to a ValueSet

Returns: OrderVariable

An OrderVariable with a Variable with a ValueSet if this can be calculated

pickNearestHigherElseLower target candidates

Full Usage: pickNearestHigherElseLower target candidates

Parameters:
Returns: OrderVariable
target : OrderVariable
candidates : OrderVariable
Returns: OrderVariable

setCalculatedConstraints ovar

Full Usage: setCalculatedConstraints ovar

Parameters:
Returns: OrderVariable
ovar : OrderVariable
Returns: OrderVariable

setConstraints cs ovar

Full Usage: setConstraints cs ovar

Parameters:
Returns: OrderVariable

Set the defined Constraints of an OrderVariable

cs : Constraints

The Constraints to set

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

setMaxToValueOf upTo ovar

Full Usage: setMaxToValueOf upTo ovar

Parameters:
Returns: OrderVariable

Sets an inclusive maximum on the Variable at the value of upTo; an existing maximum is only lowered. Leaves the OrderVariable unchanged when upTo has no value set.

upTo : OrderVariable
ovar : OrderVariable
Returns: OrderVariable

setMaxValue ovar

Full Usage: setMaxValue ovar

Parameters:
Returns: OrderVariable

Set the maximum value of the Variable of an OrderVariable

ovar : OrderVariable
Returns: OrderVariable

setMedianValue ovar

Full Usage: setMedianValue ovar

Parameters:
Returns: OrderVariable

Set the median value of the Variable of an OrderVariable

ovar : OrderVariable
Returns: OrderVariable

setMinValue ovar

Full Usage: setMinValue ovar

Parameters:
Returns: OrderVariable

Set the minimum value of the Variable of an OrderVariable

ovar : OrderVariable
Returns: OrderVariable

setName n ovar

Full Usage: setName n ovar

Parameters:
Returns: OrderVariable

Sets the name of the Variable of an OrderVariable.

n : Name
ovar : OrderVariable
Returns: OrderVariable

setNearestValue target side ovar

Full Usage: setNearestValue target side ovar

Parameters:
Returns: OrderVariable

Sets the variable to the value nearest to the target on the given side: the highest value at or below the target, but not below the floor, for AtMost; the lowest value at or above the target for AtLeast.

target : ValueUnit
side : NearestSide
ovar : OrderVariable
Returns: OrderVariable

setNthValue nth ovar

Full Usage: setNthValue nth ovar

Parameters:
Returns: OrderVariable
nth : int
ovar : OrderVariable
Returns: OrderVariable

setPercValue nth ovar

Full Usage: setPercValue nth ovar

Parameters:
Returns: OrderVariable
nth : int
ovar : OrderVariable
Returns: OrderVariable

setToAtLeastOne ovar

Full Usage: setToAtLeastOne ovar

Parameters:
Returns: OrderVariable

Sets the order variable to any count of 1 or more.

ovar : OrderVariable
Returns: OrderVariable

setToNonZeroPositive ovar

Full Usage: setToNonZeroPositive ovar

Parameters:
Returns: OrderVariable

Set the Values of the Variable of an OrderVariable to non-zero positive values

ovar : OrderVariable
Returns: OrderVariable

setToOne ovar

Full Usage: setToOne ovar

Parameters:
Returns: OrderVariable

Sets the order variable to a count of 1.

ovar : OrderVariable
Returns: OrderVariable

setUnit ovar

Full Usage: setUnit ovar

Parameters:
Returns: OrderVariable

Set the unit of the Variable of an OrderVariable according to the unit of the Constraints of the OrderVariable.

Uses the first unit other than the zero unit of the Min, Max, ValueSet and Incr, in that order.

ovar : OrderVariable

The OrderVariable

Returns: OrderVariable

setValueRange vr ovar

Full Usage: setValueRange vr ovar

Parameters:
Returns: OrderVariable

Set the Values of the Variable of an OrderVariable to a given value range

vr : ValueRange
ovar : OrderVariable
Returns: OrderVariable

setVar var ovar

Full Usage: setVar var ovar

Parameters:
Returns: OrderVariable

Set the Variable of an OrderVariable

var : Variable
ovar : OrderVariable
Returns: OrderVariable

shape ovar

Full Usage: shape ovar

Parameters:
Returns: Shape

Returns how a value can be set on an order variable. A list of more than one value, or a min, increment and max, is selectable. One value with a defined increment is steppable. Anything else is not settable.

ovar : OrderVariable
Returns: Shape

solvedValue ovar

Full Usage: solvedValue ovar

Parameters:
Returns: ValueUnit option

Returns the value of an order variable with one value; None otherwise.

ovar : OrderVariable
Returns: ValueUnit option

step isStepUp useLarge n ovar

Full Usage: step isStepUp useLarge n ovar

Parameters:
    isStepUp : bool - Whether the operation is an increase, otherwise decrease
    useLarge : bool - Whether the large increment should be used, see largeIncrement
    n : int - The number of increases or decreases
    ovar : OrderVariable - The OrderVariable to step

Returns: OrderVariable The OrderVariable with the stepped value, unchanged when there is no floor or increment

Steps the value of an order variable up or down by n increments and returns one value. A single value (minimum equal to maximum) moves by n increments. For a range, the first step goes to the minimum when stepping up and to the maximum when stepping down, and each further step moves one increment; with only one bound, the first step goes to that bound. A decrease, or an increase from only a minimum, that falls below the floor returns the floor. The floor is the calculated increment for a large step, also when the large increment is ten times that, and the defined increment for a small step.

isStepUp : bool

Whether the operation is an increase, otherwise decrease

useLarge : bool

Whether the large increment should be used, see largeIncrement

n : int

The number of increases or decreases

ovar : OrderVariable

The OrderVariable to step

Returns: OrderVariable

The OrderVariable with the stepped value, unchanged when there is no floor or increment

toString

Full Usage: toString

Returns: bool -> OrderVariable -> string

Get the string representation of an OrderVariable.

Returns: bool -> OrderVariable -> string

toStringWithConstraints withConstraints exact ovar

Full Usage: toStringWithConstraints withConstraints exact ovar

Parameters:
    withConstraints : bool - Whether to add the defined and calculated constraints; they are added only when the defined constraints are not empty
    exact : bool - Whether to use the exact representation of the ValueRange
    ovar : OrderVariable - The OrderVariable

Returns: string

Get the string representation of an OrderVariable.

withConstraints : bool

Whether to add the defined and calculated constraints; they are added only when the defined constraints are not empty

exact : bool

Whether to use the exact representation of the ValueRange

ovar : OrderVariable

The OrderVariable

Returns: string

toValueUnitMarkdown get prec x

Full Usage: toValueUnitMarkdown get prec x

Parameters:
Returns: string
Type parameters: 'a

Gets the ValueRange of the OrderVariable that get returns from x as Markdown with precision prec. Returns an empty string unless the values are a min max, a min incr max or a value set.

get : 'a -> OrderVariable
prec : int
x : 'a
Returns: string

toValueUnitString get arg2 x

Full Usage: toValueUnitString get arg2 x

Parameters:
Returns: string
Type parameters: 'a

Gets the ValueRange of the OrderVariable that get returns from x as a Dutch string.

get : 'a -> OrderVariable
arg1 : int
x : 'a
Returns: string

toValueUnitStringList get x

Full Usage: toValueUnitStringList get x

Parameters:
Returns: string option
Type parameters: 'a

Gets the value set of the OrderVariable that get returns from x as a short Dutch string; None without a value set.

get : 'a -> OrderVariable
x : 'a
Returns: string option

toValueUnitText get prec x

Full Usage: toValueUnitText get prec x

Parameters:
Returns: string
Type parameters: 'a

Gets the ValueRange of the OrderVariable that get returns from x as plain Dutch text with precision prec, as toValueUnitMarkdown prints it without the markers. A range with only a minimum or only a maximum shows as "min" or "max" with the limit; an exclusive minimum of zero and a maximum without a unit show no text.

get : 'a -> OrderVariable
prec : int
x : 'a
Returns: string

tryConstrain vu ovar

Full Usage: tryConstrain vu ovar

Parameters:
Returns: OrderVariable option

Narrows the values of the order variable to the values of vu. Returns None when none of those values lie in the current range.

vu : ValueUnit
ovar : OrderVariable
Returns: OrderVariable option

tryValueList ovar

Full Usage: tryValueList ovar

Parameters:
Returns: ValueSet option

Returns the value list of an order variable: its values when these are a list, else the value list of the calculated constraints, else that of the defined constraints.

ovar : OrderVariable
Returns: ValueSet option

unionPerConcentration maxCount records orig ovars

Full Usage: unionPerConcentration maxCount records orig ovars

Parameters:
Returns: OrderVariable

Combines the same order variable of the orders per concentration into one. The values are the union of the values of ovars and the defined constraints are those of orig. The calculated constraints are those of orig, or the union of those of ovars when records is true.

maxCount : int
records : bool
orig : OrderVariable
ovars : OrderVariable list
Returns: OrderVariable

Type something to start searching.