LinkRule Module
Turns the rows of the LinkRules sheet into link rules, checks the rows against the dose rules, and matches a side of a link rule against an order.
Functions and values
| Function or value |
Description
|
Full Usage:
check routeMapping doseRules rows
Parameters:
RouteMapping array
doseRules : DoseRuleNames[]
rows : LinkRuleData[]
Returns: Message list
|
Returns a warning for each side of a row that matches no dose rule, because no order can match that side. When a dose rule has the generic of the side as its generic name, the warning gives the labels to write instead. A row with Required yes also gets a warning when its linked side matches more than one dose type of the same generic, indication and route, because the offer of that side then has no dose type picked and cannot be prescribed. A refused row is skipped here; the read reports it.
|
Full Usage:
checkData routeMapping doseRules rows
Parameters:
RouteMapping array
doseRules : DoseRuleData[]
rows : LinkRuleData[]
Returns: Message list
|
The warnings of the rows against the dose rule data.
|
|
|
Full Usage:
fieldMatches field value
Parameters:
string
value : string
Returns: bool
|
Whether a field of a side matches a value: an empty field matches any value, and names compare without regard to case.
|
Full Usage:
fieldOf field
Parameters:
string
Returns: string option
|
Returns a field of a side as an option; a blank field gives None.
|
|
Whether a row of the sheet is blank: both dose type columns are empty. A blank row is no rule, whatever its other cells hold.
|
Full Usage:
matches routeMapping side indication label route doseType
Parameters:
RouteMapping array
side : LinkSide
indication : string
label : string
route : string
doseType : DoseType
Returns: bool
|
Whether a side matches an order with the indication, the generic label, the route and the dose type. The routes compare by the route mapping, so a long and a short name of a route match.
|
Full Usage:
needsMainOrder routeMapping rules doseRule
Parameters:
RouteMapping array
rules : LinkRule[]
doseRule : DoseRule
Returns: bool
|
Whether a link rule with Required yes matches the dose rule on its linked side, so that an order of that dose rule is only prescribed with its main order.
|
|
Returns the rows that are not blank with their row number in the sheet, counting the header as row 1. The number is correct only when the sheet export keeps blank rows as quoted empty cells.
|
|
Reads a row into a link rule, or returns every reason the row is refused.
|
Full Usage:
ofRows rows
Parameters:
LinkRuleData[]
Returns: Result<LinkRule array, Message list>
|
Returns the link rules of the rows, or an error per refusal with its row number. One refused row refuses the whole sheet, because leaving out a required link would let its order be prescribed alone.
|
Full Usage:
read rows
Parameters:
LinkRuleData[]
Returns: (int * Result<LinkRule, string list>) array
|
Reads every row that is not blank, with its row number in the sheet.
|
|
Parses the Required column in any case: yes gives Required, no or empty gives Optional, and any other value is an error.
|
Reads one side of a row. Returns an error that names the dose type column when the dose type is empty or unknown, or is once or onceTimed, because a once dose is never linked.
|
|
Full Usage:
standAlone routeMapping rules doseRules
Parameters:
RouteMapping array
rules : LinkRule[]
doseRules : DoseRule array
Returns: DoseRule array
|
The dose rules whose orders can be prescribed on their own: those that need no main order.
|
GenPRES