Logo GenPRES

SolutionRule Module

Parses the SolutionRules sheet into solution rules, filters the solution rules, and reports warnings for the rows and against the dose rules.

Types and nested modules

Type/Module Description

DilutionLimit

Creates a dilution limit for a target without any limit set.

DilutionTarget

Returns the name of a dilution target and a key of the kind and the lower case name.

Print

Formats solution rules, reconstitutions and predilutions as a Dutch preparation instruction in Markdown per generic.

SolutionLimit

Holds the solution limit without any limit set.

GenPresProduct

Functions and values

Function or value Description

adjustUnitMismatches routeMapping doseRules rules

Full Usage: adjustUnitMismatches routeMapping doseRules rules

Parameters:
Returns: Message list

One warning per dose rule and solution rule that apply to each other and can meet the same patient, but whose adjust units differ, so the solution rule does not apply to the dose rule.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

adjustUnitsMatch dr solRule

Full Usage: adjustUnitsMatch dr solRule

Parameters:
Returns: bool

Whether the adjust unit of the solution rule fits the adjust unit of the dose rule: the two are the same, or the dose rule or the solution rule has none.

dr : DoseRule
solRule : SolutionRule
Returns: bool

anyLimitsDoseRule routeMapping solutionRules dr

Full Usage: anyLimitsDoseRule routeMapping solutionRules dr

Parameters:
Returns: bool

Whether a solution rule that applies to the dose rule and can meet its patient limits every component of the dose rule, with a dose count of at least 1.

routeMapping : RouteMapping array
solutionRules : SolutionRule[]
dr : DoseRule
Returns: bool

appliesToDoseRule routeMapping solRule dr

Full Usage: appliesToDoseRule routeMapping solRule dr

Parameters:
Returns: bool

Whether a solution rule applies to a dose rule: the same generic and route, and the same form, indication and dose type when the solution rule names them, matched as the function filter matches them for an order. Rules that name different departments or different locations do not match.

routeMapping : RouteMapping array
solRule : SolutionRule
dr : DoseRule
Returns: bool

appliesToProducts products solRule

Full Usage: appliesToProducts products solRule

Parameters:
Returns: bool

Whether the solution rule applies to one of the products. A rule without GPKs and HPKs applies to all products. A rule with GPKs needs a product with one of the GPKs, and a rule with HPKs needs a product with a trade product with one of the HPKs; a rule with both needs a product that meets both.

products : ProductComponent[]
solRule : SolutionRule
Returns: bool

boundsPreparation dilutionLimit

Full Usage: boundsPreparation dilutionLimit

Parameters:
Returns: bool

Whether a dilution limit bounds the volume of the preparation: it has a maximum quantity or a maximum quantity per kg, and a minimum concentration above 0. The maximum quantity divided by the minimum concentration is then a maximum volume.

dilutionLimit : DilutionLimit
Returns: bool

canLimitComponent solRule name

Full Usage: canLimitComponent solRule name

Parameters:
Returns: bool

Whether the solution rule can limit the component for some patient: the first dilution limit of the component has a maximum quantity, a maximum quantity per adjust unit or a list of quantities.

solRule : SolutionRule
name : string
Returns: bool

canMeetDoseRule routeMapping dr solRule

Full Usage: canMeetDoseRule routeMapping dr solRule

Parameters:
Returns: bool

Whether a solution rule applies to a dose rule, can meet a patient of that dose rule, and fits its adjust unit.

routeMapping : RouteMapping array
dr : DoseRule
solRule : SolutionRule
Returns: bool

canShareDoseRule routeMapping dr solRule

Full Usage: canShareDoseRule routeMapping dr solRule

Parameters:
Returns: bool

Whether a solution rule applies to a dose rule and can meet a patient of that dose rule.

routeMapping : RouteMapping array
dr : DoseRule
solRule : SolutionRule
Returns: bool

competingRules routeMapping doseRules rules

Full Usage: competingRules routeMapping doseRules rules

Parameters:
Returns: Message list

One warning per pair of solution rules that apply to the same dose rule and can meet the same patient. Ranges that overlap two by two share a common value, so checking each pair of the two solution rules and the dose rule is enough. Each solution rule gives its own scenario, so the user must choose between them. The dose range of a solution rule is not part of the matching, so rules that differ only in dose range also compete.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

componentDiluents dr solRule

Full Usage: componentDiluents dr solRule

Parameters:
Returns: GenericName array

The names of the diluents of the solution rule that are also components of the dose rule. An order with such a pair would hold that component twice, so the pair is refused.

dr : DoseRule
solRule : SolutionRule
Returns: GenericName array

componentLimit name solRule

Full Usage: componentLimit name solRule

Parameters:
Returns: DilutionLimit option

Returns the first dilution limit of the component, the one an order takes. Names are compared case-insensitively.

name : string
solRule : SolutionRule
Returns: DilutionLimit option

conflictingLimits routeMapping doseRules rules

Full Usage: conflictingLimits routeMapping doseRules rules

Parameters:
Returns: Message list

One warning per dose rule, solution rule and component, when the rules apply to each other and can meet the same patient, and the dose range and the range in the preparation of the component meet for no dose count of the solution rule.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

dataIdFields r

Full Usage: dataIdFields r

Parameters:
Returns: string list

Returns every field of a SolutionRules row except the ids and the source text: the fields of the rule, with the component, the substance and the dilution limits of the row.

r : SolutionRuleData
Returns: string list

dataToCsv data

Full Usage: dataToCsv data

Parameters:
Returns: string list

Writes solution rule rows as tab-separated lines in the column order of headers, after the header line. Numbers are written as doubles.

data : SolutionRuleData[]
Returns: string list

dedupRowsByRowId rows

Full Usage: dedupRowsByRowId rows

Parameters:
Returns: SolutionRuleData array * string list

Removes rows with the same RowId, that is the same rule and dilution target, and keeps the first row with a dilution limit, or the first row when no row has one. The row that is kept gets the source text of the first row, so a rule keeps the source text of its first row. Returns a warning for each RowId whose rows have different dilution limits. The rows keep their order.

rows : SolutionRuleData[]
Returns: SolutionRuleData array * string list

dedupedRows parenteral data

Full Usage: dedupedRows parenteral data

Parameters:
Returns: SolutionRuleData array * string list

Sets the Id of each row, expands the diluent rows, sets the other ids and keeps one row for each RowId. The rows of an expanded diluent row keep the Id of the diluent row. Returns the rows with the warnings of dedupRowsByRowId.

parenteral : ProductComponent[]
data : SolutionRuleData array
Returns: SolutionRuleData array * string list

diluentComponent

Full Usage: diluentComponent

Returns: string

The Component value of a SolutionRules row that limits the diluent of the rule, whichever diluent is chosen.

Returns: string

diluentProducts parenteral r

Full Usage: diluentProducts parenteral r

Parameters:
Returns: ProductComponent array

Returns the parenteral products that the Diluents cell of a row names, in the order of the cell, each product once.

parenteral : ProductComponent[]
r : SolutionRuleData
Returns: ProductComponent array

diluentRowsWithoutDiluent parenteral data

Full Usage: diluentRowsWithoutDiluent parenteral data

Parameters:
Returns: Message list

One warning per solution rule with a diluent row but no diluent, because its Diluents cell is empty or names no parenteral product. The diluent row then limits nothing.

parenteral : ProductComponent[]
data : SolutionRuleData array
Returns: Message list

diluentsThatAreComponents routeMapping doseRules rules

Full Usage: diluentsThatAreComponents routeMapping doseRules rules

Parameters:
Returns: Message list

One warning per solution rule and dose rule that apply to each other and can meet the same patient, while a diluent of the solution rule is also a component of the dose rule: the solution rule is not applied to that dose rule.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

dilutionTarget r

Full Usage: dilutionTarget r

Parameters:
Returns: DilutionTarget

Returns the dilution target of a row: the substance when the row names a substance, otherwise the component. An order looks up a dilution limit by this target. Raises an InvalidOperationException for a row without a substance and a component.

r : SolutionRuleData
Returns: DilutionTarget

dilutionTargetKey r

Full Usage: dilutionTargetKey r

Parameters:
Returns: string list

Returns the key of the dilution target of a row: the kind and the name in lower case, so that a component and a substance with the same name are two targets.

r : SolutionRuleData
Returns: string list

doseCountRange solRule

Full Usage: doseCountRange solRule

Parameters:
Returns: MinMax

Returns the range of the number of doses in the preparation: the reciprocal of the dose fraction, so the maximum fraction gives the minimum count and the minimum fraction the maximum count. Without a maximum fraction the maximum fraction is 1, unless the minimum fraction is above 1. A fraction of 0 counts as absent. Without either fraction the range is empty.

solRule : SolutionRule
Returns: MinMax

duplicateRows parenteral data

Full Usage: duplicateRows parenteral data

Parameters:
Returns: Message list

Returns one warning for each rule and dilution target whose rows give different dilution limits.

parenteral : ProductComponent[]
data : SolutionRuleData[]
Returns: Message list

expandDiluentRows parenteral rows

Full Usage: expandDiluentRows parenteral rows

Parameters:
Returns: SolutionRuleData array

Replaces each diluent row with one row per diluent of the row, with the generic of the diluent as the Component. A diluent row without diluents and the other rows are returned unchanged.

parenteral : ProductComponent[]
rows : SolutionRuleData array
Returns: SolutionRuleData array

filter mapping filter solutionRules

Full Usage: filter mapping filter solutionRules

Parameters:
Returns: SolutionRule array

Returns the solution rules that match the filter. The generic is checked only when given, the department only when given, and the other patient data only when set, so a lookup without patient data returns the rules of every patient. With patient data, a rule with a location matches only a patient at that location. When the filter names a diluent, each rule keeps only that diluent.

mapping : RouteMapping array
filter : SolutionFilter
solutionRules : SolutionRule[]
Returns: SolutionRule array

filterPredilutions mapping pat rules preds

Full Usage: filterPredilutions mapping pat rules preds

Parameters:
Returns: ProductPredilution array

Returns the predilution rules for the route of one of the solution rules. A lookup without patient data keeps every department; other patient data keep the rules for the department of the patient, and patient data with more than a department also keep only the rules for the location, the age and the weight of the patient.

mapping : RouteMapping array
pat : PatientData
rules : SolutionRule[]
preds : ProductPredilution[]
Returns: ProductPredilution array

forDoseRule dr solRules

Full Usage: forDoseRule dr solRules

Parameters:
Returns: SolutionRule array

Leaves out the solution rules whose adjust unit differs from the adjust unit of the dose rule. A solution rule stays when it or the dose rule has no adjust unit.

dr : DoseRule
solRules : SolutionRule array
Returns: SolutionRule array

forms

Full Usage: forms

Returns: SolutionRule[] -> string array
Returns: SolutionRule[] -> string array

fromTupleInclExcl

Full Usage: fromTupleInclExcl

Returns: Unit option -> RationalX option * RationalX option -> MinMax
Returns: Unit option -> RationalX option * RationalX option -> MinMax

fromTupleInclIncl

Full Usage: fromTupleInclIncl

Returns: Unit option -> RationalX option * RationalX option -> MinMax
Returns: Unit option -> RationalX option * RationalX option -> MinMax

generics

Full Usage: generics

Returns: SolutionRule[] -> string array

Returns the sorted distinct generics of the solution rules.

Returns: SolutionRule[] -> string array

get dataUrlId routeMapping parenteral products

Full Usage: get dataUrlId routeMapping parenteral products

Parameters:
Returns: Result<SolutionRule array, Message list>
dataUrlId : string
routeMapping : RouteMapping array
parenteral : ProductComponent[]
products : ProductComponent[]
Returns: Result<SolutionRule array, Message list>

getData dataUrlId

Full Usage: getData dataUrlId

Parameters:
    dataUrlId : string

Returns: Result<SolutionRuleData array, Message list>
dataUrlId : string
Returns: Result<SolutionRuleData array, Message list>

hasDilutionLimit r

Full Usage: hasDilutionLimit r

Parameters:
Returns: bool

Whether a SolutionRules row has a dilution limit: a list of quantities, or a minimum or a maximum of the quantity, the quantity per adjust unit or the concentration.

r : SolutionRuleData
Returns: bool

hasDoseCountOfAtLeastOne solRule

Full Usage: hasDoseCountOfAtLeastOne solRule

Parameters:
Returns: bool

Whether the dose count of the solution rule is at least 1, so that a dose is at most the whole preparation. An empty dose count counts as 1, because the order builder then sets it to 1.

solRule : SolutionRule
Returns: bool

hasLimitPerAdjust r

Full Usage: hasLimitPerAdjust r

Parameters:
Returns: bool

Whether a SolutionRules row has a volume or a quantity per adjust.

r : SolutionRuleData
Returns: bool

headers

Full Usage: headers

Returns: string list

The header line of the solution rules, with the columns in the order that dataToCsv writes them.

Returns: string list

hpksOutsideGpks genPresProducts data

Full Usage: hpksOutsideGpks genPresProducts data

Parameters:
Returns: Message list

Returns one warning for each solution rule with HPKs that are not trade products of its GPKs in the G-Standaard products. A rule without GPKs or without HPKs gives no warning. The G-Standaard products are used, not the loaded products, because a GPK that no dose rule selects is not loaded.

genPresProducts : GenPresProduct[]
data : SolutionRuleData[]
Returns: Message list

invertedRanges rules

Full Usage: invertedRanges rules

Parameters:
Returns: Message list

One warning per inverted range in the solution rules.

rules : SolutionRule[]
Returns: Message list

isDiluentRow r

Full Usage: isDiluentRow r

Parameters:
Returns: bool

Whether a SolutionRules row is a diluent row: "diluent" in the Component column and no substance.

r : SolutionRuleData
Returns: bool

label solRule

Full Usage: label solRule

Parameters:
Returns: string

Returns a label for warnings with the generic, form, route, indication, patient category (with the department) and dose type of the rule, as they appear in the sheet.

solRule : SolutionRule
Returns: string

map routeMapping parenteral products data

Full Usage: map routeMapping parenteral products data

Parameters:
Returns: Result<SolutionRule array, Message list>
routeMapping : RouteMapping array
parenteral : ProductComponent[]
products : ProductComponent[]
data : SolutionRuleData array
Returns: Result<SolutionRule array, Message list>

missingAdjustUnits parenteral data

Full Usage: missingAdjustUnits parenteral data

Parameters:
Returns: Message list

One warning per solution rule with a row that has a volume or a quantity per adjust but no adjust unit, so the limit is left out.

parenteral : ProductComponent[]
data : SolutionRuleData array
Returns: Message list

missingDiluents parenteral data

Full Usage: missingDiluents parenteral data

Parameters:
Returns: Message list

One warning per solution rule whose Diluents cell names no parenteral product, so the rule loads without diluents.

parenteral : ProductComponent[]
data : SolutionRuleData array
Returns: Message list

mixedAdjustUnits parenteral data

Full Usage: mixedAdjustUnits parenteral data

Parameters:
Returns: Message list

One warning per solution rule whose rows give different adjust units, so the rows form separate rules.

parenteral : ProductComponent[]
data : SolutionRuleData array
Returns: Message list

mixedSourceTexts data

Full Usage: mixedSourceTexts data

Parameters:
Returns: Message list

Returns one warning for each solution rule whose rows give different source texts. A source text is the text one rule is a translation of, so rows with different source texts cannot be one rule.

data : SolutionRuleData[]
Returns: Message list

noDoseCountMeets count dose prep

Full Usage: noDoseCountMeets count dose prep

Parameters:
Returns: bool

Whether no dose count in the range meets both the dose range and the range in the preparation: the dose minimum is above the preparation maximum divided by the minimum dose count, or the dose maximum is below the preparation minimum divided by the maximum dose count. An empty dose count range counts as a dose count of 1. Ranges in different unit groups are not compared.

count : MinMax
dose : MinMax
prep : MinMax
Returns: bool

nonZeroLimit lim

Full Usage: nonZeroLimit lim

Parameters:
Returns: Limit option

Returns the limit, or None when the limit is 0, because a limit of 0 counts as empty.

lim : Limit option
Returns: Limit option

openDoseCounts rules

Full Usage: openDoseCounts rules

Parameters:
Returns: Message list

One warning per solution rule with a maximum dose fraction but no minimum, and no maximum volume, no list of volumes, no maximum volume per kg and no dilution limit that bounds the volume. The dose count then has no maximum and the preparation cannot be set.

rules : SolutionRule[]
Returns: Message list

pairConflicts solRule dr

Full Usage: pairConflicts solRule dr

Parameters:
Returns: string list

Returns a warning per component that both rules limit, when the dose range and the range in the preparation meet for no dose count of the solution rule. Quantities and quantities per adjust are compared separately, with the first dilution limit of the component.

solRule : SolutionRule
dr : DoseRule
Returns: string list

parseSolutionRuleData data

Full Usage: parseSolutionRuleData data

Parameters:
    data : string[][]

Returns: Result<SolutionRuleData array, Message list>
data : string[][]
Returns: Result<SolutionRuleData array, Message list>

ranges solRule

Full Usage: ranges solRule

Parameters:
Returns: (string * MinMax) list

Returns every range of a solution rule with its name: the patient ranges, the dose, the solution limits and the dilution limits.

solRule : SolutionRule
Returns: (string * MinMax) list

repeatedTargets rules

Full Usage: repeatedTargets rules

Parameters:
Returns: Message list

One warning per component or substance with more than one dilution limit in a solution rule. Names are compared case-insensitively. An order takes only the first dilution limit.

rules : SolutionRule[]
Returns: Message list

routes

Full Usage: routes

Returns: SolutionRule[] -> string array
Returns: SolutionRule[] -> string array

rowKeyFields r

Full Usage: rowKeyFields r

Parameters:
Returns: string list

Returns the fields that identify a row of a solution rule: the fields of the rule, with the dilution target of the row. The dilution limits of the row are left out, so two rows of a rule with the same dilution target have the same RowId.

r : SolutionRuleData
Returns: string list

rowsByRuleKeyFields data

Full Usage: rowsByRuleKeyFields data

Parameters:
Returns: SolutionRuleData array array

Groups SolutionRules rows by their rule key fields, the fields the RuleId is a hash of. The groups and the rows in each group keep the order of the rows.

data : SolutionRuleData array
Returns: SolutionRuleData array array

ruleKeyFields r

Full Usage: ruleKeyFields r

Parameters:
Returns: string list

Returns the fields that identify a solution rule: every field that is the same for all rows of the rule, except the source text.

r : SolutionRuleData
Returns: string list

ruleKeyFieldsWithoutAdjust r

Full Usage: ruleKeyFieldsWithoutAdjust r

Parameters:
Returns: string list

Returns the rule key fields of a row without the adjust unit and the volume per adjust. Rows with the same fields have the same rule key fields when they also give the same adjust unit and the same volume per adjust.

r : SolutionRuleData
Returns: string list

setDataHashIds data

Full Usage: setDataHashIds data

Parameters:
Returns: SolutionRuleData array

Sets the RuleId and the RowId of each row to the hash of its fields, and numbers the rows of each rule from 0. The rows keep their order.

data : SolutionRuleData[]
Returns: SolutionRuleData array

setDataId r

Full Usage: setDataId r

Parameters:
Returns: SolutionRuleData

Sets the Id of a row to the hash of every field of the row except the ids and the source text.

r : SolutionRuleData
Returns: SolutionRuleData

substancesWithoutAllowedStrength products solRule

Full Usage: substancesWithoutAllowedStrength products solRule

Parameters:
Returns: string array

Returns the substances whose concentration limit allows no strength of the products. A strength in a unit group that the limit cannot be compared with is skipped, and a substance without a comparable strength is not returned. The limit is inclusive, so a minimum equal to the maximum allows that one strength.

products : ProductComponent[]
solRule : SolutionRule
Returns: string array

undilutedRulesWithoutAllowedStrength routeMapping doseRules rules

Full Usage: undilutedRulesWithoutAllowedStrength routeMapping doseRules rules

Parameters:
Returns: Message list

Returns a warning for each solution rule without diluents whose concentration limit allows no strength of the products it gives undiluted. A solution rule is checked against each dose rule with one component that it applies to and can share a patient with; a dose rule with more components is left out, because a second component can dilute the first. The products are reconstituted first, for the location and the department of the solution rule, or else of the dose rule. When neither rule names a location, the products are reconstituted for each location that their reconstitution rules name, and for no location; the same holds for the department. A reconstitution is used only when one patient can be in its age and weight ranges and in the patient categories of both rules.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

unknownLineGenerics formulary data

Full Usage: unknownLineGenerics formulary data

Parameters:
Returns: Message list

Returns one warning for each generic whose solution rule rows name, in CombY or NonCombY, a generic that the Formulary does not have. The names are compared without regard to case.

formulary : FormularyProduct[]
data : SolutionRuleData[]
Returns: Message list

unlimitedDoseRules routeMapping doseRules rules

Full Usage: unlimitedDoseRules routeMapping doseRules rules

Parameters:
Returns: Message list

One warning per dose rule without limits that a solution rule can meet, when no solution rule limits every component of it. Loading leaves such a dose rule out.

routeMapping : RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
Returns: Message list

unmarkedDiluents formulary data

Full Usage: unmarkedDiluents formulary data

Parameters:
Returns: Message list

One warning per name in a Diluents cell whose parenteral Formulary product is not marked IsDiluent, listing the generics whose solution rules name it. A name without a parenteral product is reported by missingDiluents.

formulary : FormularyProduct[]
data : SolutionRuleData[]
Returns: Message list

warningLabelOfRows parenteral rows

Full Usage: warningLabelOfRows parenteral rows

Parameters:
Returns: string option

Maps rows together to solution rules and returns the warning label of the first solution rule; None when the rows map to no solution rule. Rows with the same rule key fields and a dose range in different units map to more than one solution rule.

parenteral : ProductComponent[]
rows : SolutionRuleData array
Returns: string option

Type something to start searching.