DoseRule Module
Builds dose rules from grouped sheet rows, adds form limits and products, reconstitutes and pre-dilutes the products of a dose rule, removes empty limits and the dose rules left without limits, maps dose rules back to rows, filters dose rules and reports warnings.
Nested modules
| Modules | Description |
|
Prints the schedule and the doses of a dose rule and writes the dose rules of a generic as Markdown. |
Functions and values
| Function or value |
Description
|
Full Usage:
addFormLimits routeMapping formRoutes dr
Parameters:
RouteMapping array
formRoutes : FormRoute[]
dr : DoseRule
Returns: DoseRule
|
|
Returns "kg" or "m2" for an adjust unit, or an empty string for any other or no unit.
|
|
|
|
|
Checks whether a component limit has no limit value and no substance limit with a value.
|
Full Usage:
componentWarnings check rules
Parameters:
ComponentLimit -> string option
rules : DoseRule[]
Returns: Message list
|
Returns a warning for each component limit for which the check returns a message, with the dose rule and the component. Duplicate warnings, from the dose rules per product form, are removed.
|
|
Returns the distinct departments of the dose rules, sorted, ignoring case.
|
|
|
|
|
|
|
|
|
Full Usage:
filter routeMapping filter drs
Parameters:
RouteMapping array
-
The route mapping that matches the route names.
filter : DoseFilter
-
The filter.
drs : DoseRule array
-
The dose rules.
Returns: DoseRule array
|
Returns the dose rules that match the filter; an empty filter returns all of them.
|
Returns the distinct pharmaceutical forms of the dose rules, sorted, ignoring case.
|
|
|
Returns the time unit of a frequency unit, such as the day of times per day, or an empty string.
|
|
Returns the distinct frequencies of the dose rules as text.
|
|
|
|
|
Returns the distinct genders of the dose rules, sorted, ignoring case.
|
|
Returns the distinct generic labels of the dose rules, sorted, ignoring case.
|
|
|
|
|
|
|
|
|
Returns the distinct indications of the dose rules, sorted, ignoring case.
|
|
|
Describes a dose rule by generic, route, indication, patient category and dose type, so a sheet author can find it.
|
|
Full Usage:
mapToComponentLimits prods dd
Parameters:
ProductComponent[]
dd : DoseRuleData array
Returns: ComponentLimit array
|
|
|
|
|
Whether the patient data mark a dose rule for adults: IsAdult is set and there is no minimum and no maximum age. Patient data with IsAdult and an age give the age range instead.
|
|
|
|
|
|
Returns the distinct patient categories of the dose rules as text, in patient category order.
|
|
Maps the patient data of a dose rule to its patient category.
|
|
Returns the fields of a patient category that go into the Id of a dose rule: every field except the access, each as its exact value, with an empty text for a field without a value.
|
|
Returns the unit after the last "per" of a range unit, such as the time unit of a rate, or an empty string.
|
Full Usage:
predilute mapping loc dep fits preds dr
Parameters:
RouteMapping array
loc : string option
dep : string option
fits : Predilution -> bool
preds : ProductPredilution[]
dr : DoseRule
Returns: DoseRule
|
Pre-dilutes the products of a dose rule with Product.predilute for the route and the indication of the dose rule. Run it after DoseRule.reconstitute, so that a powder is first a liquid.
|
Full Usage:
reconstitute mapping loc dep fits dr
Parameters:
RouteMapping array
-
The route mapping.
loc : string option
-
The location that selects the reconstitution.
dep : string option
-
The department that selects the reconstitution.
fits : Reconstitution -> bool
-
Whether a reconstitution applies to the patient.
dr : DoseRule
-
The dose rule.
Returns: DoseRule * string seq
|
Replaces each product of a dose rule that needs reconstitution by its reconstituted products. Returns the dose rule and the distinct reconstitution warnings.
|
|
Removes substance limits without values, then component limits without any limit, then dose rules without
component limits. A row without dose values passes
A dose rule without limits for which
|
Full Usage:
reverseDoseLimit cmpBased cmpName dl
Parameters:
bool
cmpName : string
dl : DoseLimit
Returns: DoseLimitData
|
Maps a dose limit back to the dose limit columns of a row for the component cmpName. cmpBased is true for a component limit, a row without a substance.
|
|
Maps a generic back to the generic columns of a row. The form and brand come from the label and the GPKs and HPKs from the products; the expanded form of the generic is not used.
|
|
Maps a patient category back to the patient columns of a row.
|
Full Usage:
reverseSchedule dr dl dld
Parameters:
DoseRule
dl : DoseLimit
dld : DoseLimitData
Returns: ScheduleData
|
Maps the schedule of a dose rule and a dose limit back to the schedule columns of a row.
|
Returns the distinct routes of the dose rules, sorted, ignoring case.
|
|
|
|
|
Returns the unit of a time range, such as an administration time, or an empty string.
|
|
Maps a dose rule back to its sheet rows: one CmpBased row for a component without substance limits, or one row per substance limit. A component without any limit gives a row without values. The form limit is left out, because it comes from the form routes.
|
Returns a unit as short text without the unit group, which UnitsParse.fromString reads back as the same unit.
|
GenPRES