OrderContext Module
Holds the empty order context and the changes a user makes to an order context: filter choices, diluent, components, scenario and order variable values.
Types and nested modules
| Type/Module | Description |
|
Trims the argumentation a user writes for a deviation from the rules to at most 1000 characters and writes the argumentation to an order context. |
|
|
Reads and changes the order variable in an order that a target addresses. |
|
|
A field of the order context filter. |
|
|
What a user picks from: a filter field, the diluents, the components, the scenarios, or the values of an order variable. |
|
|
The order variable a command addresses: a level, its property, and the names that locate a component or an item. |
Functions and values
| Function or value |
Description
|
|
|
Full Usage:
applyChange field clearOwn write ctx
Parameters:
FilterField
clearOwn : bool
write : Filter -> Filter
ctx : OrderContext
Returns: OrderContext
|
Writes a change to one filter field and clears the scenarios, the picked products and the dose rule components, because these depend on the whole filter. A picked value keeps the other choices: the server narrows every option list by all choices, so the value agrees with them. When clearOwn is true, the field is emptied: its own options and the choices in the later steps of chain are cleared too. The options of those later fields stay until the server sends new ones, so the fields remain usable meanwhile. When no choice is left, all options are cleared, because they were narrowed by choices that are gone.
|
|
Returns the filter fields as steps in the order they are chosen. Emptying a field clears the choices in the later steps, not the choices in its own step. For a medication, the indication and the generic share the first step, because either can be chosen first and each narrows the options of the other; the route, form and dose type depend on the medication. For nutrition, the composition (the generic) comes first and the indication follows from it. A field that is not in the steps clears no other choices.
|
Full Usage:
changeDiluent n ctx
Parameters:
int option
ctx : OrderContext
Returns: Result<OrderContext, string>
|
Sets the diluent to its nth option, or empties it with None. Returns an error when n is out of range.
|
Full Usage:
changeFilter field n ctx
Parameters:
FilterField
n : int option
ctx : OrderContext
Returns: Result<OrderContext, string>
|
Sets a filter field to its nth option, or empties it with None. Returns an error when n is out of range.
|
|
|
|
|
|
|
Full Usage:
componentsChange cs ctx
Parameters:
string[]
ctx : OrderContext
Returns: OrderContext
|
Selects the named components; an empty array selects no optional component.
|
|
Returns the scenario a context contributes to the plan when it has exactly one scenario; None otherwise. It copies PlanContext.contribution in GenORDER; an agreement test in the server tests keeps both equal.
|
|
Returns the number of options. For a variable it is 0 when the variable has no values or the context does not have exactly one scenario.
|
Full Usage:
diluentChange s ctx
Parameters:
string option
ctx : OrderContext
Returns: OrderContext
|
|
Full Usage:
doseTypeChange dt ctx
Parameters:
DoseType option
ctx : OrderContext
Returns: OrderContext
|
|
|
|
|
|
|
All filter fields, used to clear the whole filter.
|
|
|
Full Usage:
indicationChange s ctx
Parameters:
string option
ctx : OrderContext
Returns: OrderContext
|
|
Full Usage:
medicationChange s ctx
Parameters:
string option
ctx : OrderContext
Returns: OrderContext
|
|
Full Usage:
nth what n xs
Parameters:
string
n : int
xs : 'a[]
Returns: Result<'a, string>
Type parameters: 'a |
Returns the option at index n, counted from 0, or an error when n is out of range.
|
|
Returns the nutrition category of a context, None for a medication. It copies PlanContext.nutritionCategory in GenORDER; an agreement test in the server tests keeps both equal.
|
Full Usage:
routeChange s ctx
Parameters:
string option
ctx : OrderContext
Returns: OrderContext
|
|
|
Returns the single scenario of the context, or an error with the number of scenarios.
|
Full Usage:
seedFilter source ind gen rte frm dt ctx
Parameters:
SeedSource
ind : string option
gen : string option
rte : string option
frm : string option
dt : DoseType option
ctx : OrderContext
Returns: OrderContext
|
Sets the indication, generic, route, form and dose type from a source outside the filter fields. Formulary and Parenteralia keep the diluent only when the generic, route and form are the same (for Formulary also the indication), and clear the scenarios. Url writes over the current filter and keeps the diluent, and Reload changes nothing. The selected components and picked products stay only when all five choices are the same. OrderContext.seedFilter in GenORDER applies the same rules; an agreement test in the server tests keeps both equal.
|
Full Usage:
selectNthScenario n ctx
Parameters:
int
ctx : OrderContext
Returns: Result<OrderContext, string>
|
Narrows the context to its nth scenario and sets the filter form to the form of that scenario. Returns an error when n is out of range.
|
Full Usage:
setNth target n ctx
Parameters:
Target
n : int
ctx : OrderContext
Returns: Result<OrderContext option, string>
|
Sets the variable to its nth value, as the dose dialog does. Returns None when the variable has no values, and an error without a single scenario, without the variable or for an index out of range.
|
Full Usage:
setNthComponents ns ctx
Parameters:
int[]
ctx : OrderContext
Returns: Result<OrderContext, string>
|
Selects the components at these positions of the component options. Returns the first index error.
|
Full Usage:
setPatientData pat ctx
Parameters:
PatientData
ctx : OrderContext
Returns: OrderContext
|
|
|
Returns the keys of the values of a variable; empty when it has no values.
|
|
Replaces the order in the scenario with the same order id.
|
|
GenPRES