Logo GenPRES

RuleSet Module

Checks the rows of the RuleSets sheet against the dose rules, expands the rows without a generic, builds a rule set per kind and selects the rows of a rule set for a patient.

Types and nested modules

Type/Module Description

DoseRuleNames (Module)

Reads the names of each dose rule row: indication, generic, label, component, route and dose type.

DoseRuleNames (Type)

The names of a dose rule that the checks and the expansion of the rule set rows match on.

Functions and values

Function or value Description

allows allowed name

Full Usage: allows allowed name

Parameters:
    allowed : string[]
    name : string

Returns: bool

Whether a list of a rule set allows the name: an empty list allows any name, and names compare without regard to case.

allowed : string[]
name : string
Returns: bool

categories

Full Usage: categories

Returns: NutritionCategory[]

Every nutrition category.

Returns: NutritionCategory[]

check doseRules products rows

Full Usage: check doseRules products rows

Parameters:
Returns: Message list

Checks the rows against the dose rules and the generics of the Formulary sheet, and returns a warning for: a category with more than one label; an indication that no dose rule has; a generic that no dose rule under the indication has as a label, with the labels to use when dose rules have it as a generic name; and a generic or component under the indication of a row without a product. A product name is matched without regard to case, as the dose rules match their products.

doseRules : DoseRuleNames[]
products : Set<string>
rows : RuleSetData[]
Returns: Message list

checkData doseRules products rows

Full Usage: checkData doseRules products rows

Parameters:
Returns: Message list

Checks the rows against the dose rule data and the formulary products, and returns the warnings.

doseRules : DoseRuleData[]
products : FormularyProduct[]
rows : RuleSetData[]
Returns: Message list

distinctOf f rows

Full Usage: distinctOf f rows

Parameters:
Returns: string array

Returns the distinct non-empty values of a field of the rows, in row order.

f : RuleSetData -> string
rows : RuleSetData[]
Returns: string array

expand doseRules rows

Full Usage: expand doseRules rows

Parameters:
Returns: RuleSetData array

Replaces each row without a generic by one row per distinct label of the dose rules under its indication, in the order of the dose rules. A row whose indication no dose rule has stays as it is. The evaluation does not filter on the indications of a rule set, so only the generics keep a medication out of a nutrition category.

doseRules : DoseRuleNames[]
rows : RuleSetData[]
Returns: RuleSetData array

forPatient pat set

Full Usage: forPatient pat set

Parameters:
Returns: RuleSet

Returns the rule set with only the rows that apply to the patient. A row without a location applies to every patient, and a row with a location only to a patient at that location. A row without a department applies to every patient, and a row with a department only to a patient of that department.

pat : PatientData
set : RuleSet
Returns: RuleSet

kindName _arg1

Full Usage: kindName _arg1

Parameters:
Returns: string

Returns the category name of a rule set kind in the rule set data.

_arg1 : RuleSetKind
Returns: string

kindOfName name

Full Usage: kindOfName name

Parameters:
    name : string

Returns: RuleSetKind option

Returns the rule set kind of a category name in the rule set data, or None for another name.

name : string
Returns: RuleSetKind option

kinds

Full Usage: kinds

Returns: RuleSetKind[]

Every kind of rule set: one for each nutrition category, the emergency list and the standard infusions.

Returns: RuleSetKind[]

nutritionCategoryOf sets indication generic

Full Usage: nutritionCategoryOf sets indication generic

Parameters:
    sets : RuleSet[]
    indication : string option
    generic : string option

Returns: NutritionCategory option

Returns the nutrition category whose rule set names the indication and allows the generic, or None when there is none, also when the indication or the generic is missing.

sets : RuleSet[]
indication : string option
generic : string option
Returns: NutritionCategory option

ofData rows

Full Usage: ofData rows

Parameters:
Returns: RuleSet array

Creates a rule set for every kind in the rule set data, with the label of the first rule of the kind and the rules in their order. Leaves out the rules of a category that is not a rule set category.

rows : RuleSetData[]
Returns: RuleSet array

tryFind category sets

Full Usage: tryFind category sets

Parameters:
Returns: RuleSet option

Returns the rule set of a nutrition category, or None when there is none.

category : NutritionCategory
sets : RuleSet[]
Returns: RuleSet option

tryFindWithRows category sets

Full Usage: tryFindWithRows category sets

Parameters:
Returns: RuleSet option

Returns the rule set of a nutrition category, or None when there is none or when it has no rules, as a rule set for a patient has when none of its rules apply to the patient.

category : NutritionCategory
sets : RuleSet[]
Returns: RuleSet option

unknownCategories rows

Full Usage: unknownCategories rows

Parameters:
Returns: string array

Returns the distinct category names in the rule set data that are not a rule set category, in their order.

rows : RuleSetData[]
Returns: string array

Type something to start searching.