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 |
|
Creates a dilution limit for a target without any limit set. |
|
|
Returns the name of a dilution target and a key of the kind and the lower case name. |
|
|
Formats solution rules, reconstitutions and predilutions as a Dutch preparation instruction in Markdown per generic. |
|
|
Holds the solution limit without any limit set. |
|
|
|
Functions and values
| Function or value |
Description
|
Full Usage:
adjustUnitMismatches routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
Full Usage:
adjustUnitsMatch dr solRule
Parameters:
DoseRule
solRule : SolutionRule
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.
|
Full Usage:
anyLimitsDoseRule routeMapping solutionRules dr
Parameters:
RouteMapping array
solutionRules : SolutionRule[]
dr : DoseRule
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.
|
Full Usage:
appliesToDoseRule routeMapping solRule dr
Parameters:
RouteMapping array
solRule : SolutionRule
dr : DoseRule
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.
|
Full Usage:
appliesToProducts products solRule
Parameters:
ProductComponent[]
solRule : SolutionRule
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.
|
|
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.
|
Full Usage:
canLimitComponent solRule name
Parameters:
SolutionRule
name : string
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.
|
Full Usage:
canMeetDoseRule routeMapping dr solRule
Parameters:
RouteMapping array
dr : DoseRule
solRule : SolutionRule
Returns: bool
|
Whether a solution rule applies to a dose rule, can meet a patient of that dose rule, and fits its adjust unit.
|
Full Usage:
canShareDoseRule routeMapping dr solRule
Parameters:
RouteMapping array
dr : DoseRule
solRule : SolutionRule
Returns: bool
|
Whether a solution rule applies to a dose rule and can meet a patient of that dose rule.
|
Full Usage:
competingRules routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
Full Usage:
componentDiluents dr solRule
Parameters:
DoseRule
solRule : SolutionRule
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.
|
Full Usage:
componentLimit name solRule
Parameters:
string
solRule : SolutionRule
Returns: DilutionLimit option
|
Returns the first dilution limit of the component, the one an order takes. Names are compared case-insensitively.
|
Full Usage:
conflictingLimits routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
|
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.
|
|
Writes solution rule rows as tab-separated lines in the column order of headers, after the header line. Numbers are written as doubles.
|
Full Usage:
dedupRowsByRowId rows
Parameters:
SolutionRuleData[]
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.
|
Full Usage:
dedupedRows parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData array
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.
|
Full Usage:
diluentComponent
Returns: string
|
The Component value of a SolutionRules row that limits the diluent of the rule, whichever diluent is chosen.
|
Full Usage:
diluentProducts parenteral r
Parameters:
ProductComponent[]
r : SolutionRuleData
Returns: ProductComponent array
|
Returns the parenteral products that the Diluents cell of a row names, in the order of the cell, each product once.
|
Full Usage:
diluentRowsWithoutDiluent parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData array
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.
|
Full Usage:
diluentsThatAreComponents routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
|
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.
|
|
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.
|
|
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.
|
Full Usage:
duplicateRows parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData[]
Returns: Message list
|
Returns one warning for each rule and dilution target whose rows give different dilution limits.
|
Full Usage:
expandDiluentRows parenteral rows
Parameters:
ProductComponent[]
rows : SolutionRuleData array
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.
|
Full Usage:
filter mapping filter solutionRules
Parameters:
RouteMapping array
filter : SolutionFilter
solutionRules : SolutionRule[]
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.
|
Full Usage:
filterPredilutions mapping pat rules preds
Parameters:
RouteMapping array
pat : PatientData
rules : SolutionRule[]
preds : ProductPredilution[]
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.
|
Full Usage:
forDoseRule dr solRules
Parameters:
DoseRule
solRules : SolutionRule array
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.
|
|
|
|
|
|
|
|
Returns the sorted distinct generics of the solution rules.
|
Full Usage:
get dataUrlId routeMapping parenteral products
Parameters:
string
routeMapping : RouteMapping array
parenteral : ProductComponent[]
products : ProductComponent[]
Returns: Result<SolutionRule array, Message list>
|
|
Full Usage:
getData dataUrlId
Parameters:
string
Returns: Result<SolutionRuleData array, Message list>
|
|
|
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.
|
|
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.
|
|
Whether a SolutionRules row has a volume or a quantity per adjust.
|
Full Usage:
headers
Returns: string list
|
The header line of the solution rules, with the columns in the order that dataToCsv writes them.
|
Full Usage:
hpksOutsideGpks genPresProducts data
Parameters:
GenPresProduct[]
data : SolutionRuleData[]
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.
|
|
|
|
Whether a SolutionRules row is a diluent row: "diluent" in the Component column and no substance.
|
|
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.
|
Full Usage:
map routeMapping parenteral products data
Parameters:
RouteMapping array
parenteral : ProductComponent[]
products : ProductComponent[]
data : SolutionRuleData array
Returns: Result<SolutionRule array, Message list>
|
|
Full Usage:
missingAdjustUnits parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData array
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.
|
Full Usage:
missingDiluents parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData array
Returns: Message list
|
One warning per solution rule whose Diluents cell names no parenteral product, so the rule loads without diluents.
|
Full Usage:
mixedAdjustUnits parenteral data
Parameters:
ProductComponent[]
data : SolutionRuleData array
Returns: Message list
|
One warning per solution rule whose rows give different adjust units, so the rows form separate rules.
|
|
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.
|
|
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.
|
|
|
|
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.
|
Full Usage:
pairConflicts solRule dr
Parameters:
SolutionRule
dr : DoseRule
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.
|
Full Usage:
parseSolutionRuleData data
Parameters:
string[][]
Returns: Result<SolutionRuleData array, Message list>
|
|
|
Returns every range of a solution rule with its name: the patient ranges, the dose, the solution limits and the dilution limits.
|
|
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.
|
|
|
|
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.
|
Full Usage:
rowsByRuleKeyFields data
Parameters:
SolutionRuleData array
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.
|
|
Returns the fields that identify a solution rule: every field that is the same for all rows of the rule, except the source text.
|
|
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.
|
Full Usage:
setDataHashIds data
Parameters:
SolutionRuleData[]
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.
|
|
Sets the Id of a row to the hash of every field of the row except the ids and the source text.
|
Full Usage:
substancesWithoutAllowedStrength products solRule
Parameters:
ProductComponent[]
solRule : SolutionRule
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.
|
Full Usage:
undilutedRulesWithoutAllowedStrength routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
Full Usage:
unknownLineGenerics formulary data
Parameters:
FormularyProduct[]
data : SolutionRuleData[]
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.
|
Full Usage:
unlimitedDoseRules routeMapping doseRules rules
Parameters:
RouteMapping array
doseRules : DoseRule[]
rules : SolutionRule[]
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.
|
Full Usage:
unmarkedDiluents formulary data
Parameters:
FormularyProduct[]
data : SolutionRuleData[]
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.
|
Full Usage:
warningLabelOfRows parenteral rows
Parameters:
ProductComponent[]
rows : SolutionRuleData array
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.
|
GenPRES