DoseRuleData Module
Parses the rows of the DoseRules sheet, sets the hash ids and the numbers of the rows, removes the values a dose type does not use, refuses the dose rules with a wrong unit or range or without a generic or route, and writes the rows as TSV.
Functions and values
| Function or value |
Description
|
|
Returns the per kg and per m2 columns, which use the adjust unit.
|
|
|
|
Returns a reason for each row with an adjust unit that is not empty and not kg or m2.
|
|
Returns a warning for each dose rule with a row that has IsAdult and an age, with the age in days; the rule gets the age range.
|
Full Usage:
checkRules data
Parameters:
DoseRuleData[]
Returns: DoseRuleData array * string[]
|
Returns the rows of the dose rules without refusals, with a message for each refused rule, each rule with an adjust unit but no per kg or per m2 value, and each rule with a patient value outside the limits for a patient. The rows have their ids; the rows of a rule share a RuleId.
|
|
|
|
Writes dose rule rows as tab-separated lines in the column order of
|
Full Usage:
dedupRowsByRowId rows
Parameters:
DoseRuleData[]
Returns: DoseRuleData[] * string list
|
Removes rows of one dose rule with the same RowId, that is the same component and substance, and keeps the first row. Returns a warning for each RowId whose rows have different dose limits.
|
|
Describes the dose rule of a row by generic, route, indication, source, patient and dose type, so a sheet author can find it.
|
Full Usage:
distinctByDoseLimit d
Parameters:
DoseRuleData
Returns: string * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool
|
|
|
Returns the schedule and the dose limit fields of a row that are in none of the other ids. The source text, the patient text and the schedule text are left out.
|
Full Usage:
doseRanges r
Parameters:
DoseRuleData
Returns: (string * BigRational option * BigRational option) list
|
Returns the schedule and the dose limit ranges of a row, each as the name of its columns without Min or Max, with the min and the max.
|
|
|
|
Returns all dose limit columns, which all use the dose unit.
|
|
Returns a reason for each row without a generic and for each row without a route.
|
|
Returns the fields that identify a dose rule group: rows in one group differ only in dose type, dose text,
component and substance. The loader groups rows by these fields and
|
|
|
Full Usage:
hasValueIn columns d
Parameters:
DoseLimitData -> 'a option list
d : DoseRuleData
Returns: bool
Type parameters: 'a |
Checks whether a row has a value in one of the given dose limit columns.
|
Full Usage:
headers
Returns: string list
|
The header line of the DoseRules sheet, with the columns in the order that
|
Full Usage:
ignoreValuesNotForDoseType d
Parameters:
DoseRuleData
Returns: DoseRuleData * string option
|
Removes the values of a row that its dose type does not use, and returns the row with a warning that names the columns, or None when the row has no such values.
|
Full Usage:
limitedPatientRanges r
Parameters:
DoseRuleData
Returns: (string * BigRational option * BigRational option * RationalX * RationalX) list
|
Returns the patient ranges of a row that GenCORE has limits for, each as the name of its columns without Min or Max, the min, the max, the lower limit and the upper limit: the age in days, the weight in grams and the gestational age in days. GenCORE has no limits for the BSA and the postmenstrual age.
|
|
Returns a reason for each row with a limit value but no dose unit, or a rate value but no rate unit. Such a value would be lost. An unknown unit text still gives a general unit, so only an empty unit loses the value. A per time value is not checked: a row that uses it is not valid without a frequency unit.
|
|
Returns the value as text, or an empty text for no value.
|
Full Usage:
parseDoseRuleData data
Parameters:
string array array
Returns: Result<DoseRuleData array, Message list>
|
|
Full Usage:
patientRanges r
Parameters:
DoseRuleData
Returns: (string * BigRational option * BigRational option) list
|
Returns the patient ranges of a row, each as the name of its columns without Min or Max, with the min and the max. The rows of a dose rule have the same patient ranges.
|
|
Returns a warning for a dose rule, given as its rows, with a patient value outside the limits for a patient, and None for a rule within the limits. The warning gives each value with its limits. A min of 0 counts as no lower limit.
|
|
|
|
Returns a reason for each range of a dose rule, given as its rows, that has a problem. A patient range is checked once for the rule, a schedule or a dose limit range for each row.
|
|
Returns the rate columns, which use the rate unit.
|
|
Returns the reasons to refuse a dose rule, given as its rows: the reasons of unitRefusals, an adjust unit that is not kg or m2, a range with a negative value, a max of 0 or a min greater than the max, and a row without a generic or a route.
|
|
Returns the substance of a row, or the component when the row has no substance.
|
|
Sets the GrpId, RuleId, RowId and Id of a row from its fields. The Id hashes the RowId with the schedule and the dose limit fields, so it changes when one of those fields changes, and the other ids stay as they are.
|
|
Numbers rows that have their ids, in the order of the rows. GrpNo becomes the place of the dose rule of the row among the dose rules of its group, RowNo the place of the row in its dose rule, both counted from 0. The rows keep their order.
|
|
Returns the reasons to refuse a dose rule, given as its rows: rows with different adjust units (an empty unit counts as one), a per kg or per m2 value without an adjust unit, or a value without its dose or rate unit. The rule takes its adjust unit from its first row, so mixed adjust units can give a wrong dose. A value without its unit is lost, so the rule could lose a maximum. The adjust units are compared as text, ignoring case, so an adjust unit that is not kg or m2 is named as it is written.
|
|
Returns a warning for a dose rule with one adjust unit and dose limit values, but no per kg or per m2 value in any row. Returns None for a rule without dose limit values.
|
|
Returns the warnings for a dose rule row with a missing dose type, a missing schedule unit or frequency, or, for a once timed or a timed row, a missing maximum administration time. Checks only the schedule; the component and substance data are checked once the rows form a dose rule.
|
|
Keeps one product restriction of a generic, in the order HPKs, GPKs, Brand, Form, and clears the fields after it. A generic without a restriction is returned unchanged.
|
GenPRES