Logo GenPRES

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

Print

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

addFormLimits routeMapping formRoutes dr

Full Usage: addFormLimits routeMapping formRoutes dr

Parameters:
Returns: DoseRule
routeMapping : RouteMapping array
formRoutes : FormRoute[]
dr : DoseRule
Returns: DoseRule

adjStr u

Full Usage: adjStr u

Parameters:
Returns: string

Returns "kg" or "m2" for an adjust unit, or an empty string for any other or no unit.

u : Unit option
Returns: string

allLimits dr

Full Usage: allLimits dr

Parameters:
Returns: DoseLimit array

Returns all dose limits of a dose rule: each component limit with its substance limits, then the form limit.

dr : DoseRule
Returns: DoseLimit array

componentHasNoLimits cl

Full Usage: componentHasNoLimits cl

Parameters:
Returns: bool

Checks whether a component limit has no limit value and no substance limit with a value.

cl : ComponentLimit
Returns: bool

componentWarnings check rules

Full Usage: componentWarnings check rules

Parameters:
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.

check : ComponentLimit -> string option
rules : DoseRule[]
Returns: Message list

departments

Full Usage: departments

Returns: DoseRule[] -> string array

Returns the distinct departments of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

disagreeingDivisibles rules

Full Usage: disagreeingDivisibles rules

Parameters:
Returns: Message list

Returns a warning for each component limit whose products in a volume unit have different Divisible values.

rules : DoseRule[]
Returns: Message list

divisibleWarnings rules

Full Usage: divisibleWarnings rules

Parameters:
Returns: Message list

Returns all warnings for the Divisible of the products in the dose rules.

rules : DoseRule[]
Returns: Message list

doseTypes dsrs

Full Usage: doseTypes dsrs

Parameters:
Returns: DoseType array
dsrs : DoseRule[]
Returns: DoseType array

emptyDoseLimitData

Full Usage: emptyDoseLimitData

Returns: DoseLimitData
Returns: DoseLimitData

filter routeMapping filter drs

Full Usage: filter routeMapping filter drs

Parameters:
    routeMapping : 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.

routeMapping : RouteMapping array

The route mapping that matches the route names.

filter : DoseFilter

The filter.

drs : DoseRule array

The dose rules.

Returns: DoseRule array

forms

Full Usage: forms

Returns: DoseRule[] -> string array

Returns the distinct pharmaceutical forms of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

freqUnitStr vuOpt

Full Usage: freqUnitStr vuOpt

Parameters:
Returns: string

Returns the time unit of a frequency unit, such as the day of times per day, or an empty string.

vuOpt : ValueUnit option
Returns: string

frequencies drs

Full Usage: frequencies drs

Parameters:
Returns: string array

Returns the distinct frequencies of the dose rules as text.

drs : DoseRule array
Returns: 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

genders

Full Usage: genders

Returns: DoseRule[] -> string array

Returns the distinct genders of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

generics

Full Usage: generics

Returns: DoseRule[] -> string array

Returns the distinct generic labels of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

getDoseLimits rs

Full Usage: getDoseLimits rs

Parameters:
Returns: DoseLimit array
rs : DoseRuleData[]
Returns: DoseLimit array

getNormDose dr

Full Usage: getNormDose dr

Parameters:
Returns: NormDose option
dr : DoseRule
Returns: NormDose option

hasNoLimits dr

Full Usage: hasNoLimits dr

Parameters:
Returns: bool

Checks whether no component of a dose rule has a limit value.

dr : DoseRule
Returns: bool

indications

Full Usage: indications

Returns: DoseRule[] -> string array

Returns the distinct indications of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

invertedRanges rules

Full Usage: invertedRanges rules

Parameters:
Returns: Message list

Returns a warning for each range with a minimum above its maximum. A sheet row gives a dose rule per product form, so duplicate warnings are removed.

rules : DoseRule[]
Returns: Message list

label dr

Full Usage: label dr

Parameters:
Returns: string

Describes a dose rule by generic, route, indication, patient category and dose type, so a sheet author can find it.

dr : DoseRule
Returns: string

mapToComponentLimits prods dd

Full Usage: mapToComponentLimits prods dd

Parameters:
Returns: ComponentLimit array
prods : ProductComponent[]
dd : DoseRuleData array
Returns: ComponentLimit array

mapToDoseRule grp

Full Usage: mapToDoseRule grp

Parameters:
Returns: DoseRule array
grp : GroupedRuleData
Returns: DoseRule array

marksAdults p

Full Usage: marksAdults p

Parameters:
Returns: bool

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.

p : PatientCategoryData
Returns: bool

missingDivisibles rules

Full Usage: missingDivisibles rules

Parameters:
Returns: Message list

Returns one warning per product without a Divisible, by GPK. A product without a GPK is skipped: it stands for a generic without a product in the formulary and has no row to give a Divisible.

rules : DoseRule[]
Returns: Message list

mixedDivisibles rules

Full Usage: mixedDivisibles rules

Parameters:
Returns: Message list

Returns a warning for each component limit with products both with and without a Divisible.

rules : DoseRule[]
Returns: Message list

patientCategories drs

Full Usage: patientCategories drs

Parameters:
Returns: string array

Returns the distinct patient categories of the dose rules as text, in patient category order.

drs : DoseRule array
Returns: string array

patientCategory p

Full Usage: patientCategory p

Parameters:
Returns: PatientCategory

Maps the patient data of a dose rule to its patient category.

p : PatientCategoryData
Returns: PatientCategory

patientHashFields pat

Full Usage: patientHashFields pat

Parameters:
Returns: string list

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.

pat : PatientCategory
Returns: string list

perUnitStr mm

Full Usage: perUnitStr mm

Parameters:
Returns: string

Returns the unit after the last "per" of a range unit, such as the time unit of a rate, or an empty string.

mm : MinMax
Returns: string

predilute mapping loc dep fits preds dr

Full Usage: predilute mapping loc dep fits preds dr

Parameters:
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.

mapping : RouteMapping array
loc : string option
dep : string option
fits : Predilution -> bool
preds : ProductPredilution[]
dr : DoseRule
Returns: DoseRule

ranges dr

Full Usage: ranges dr

Parameters:
Returns: (string * MinMax) list

Returns all ranges of a dose rule with their names: patient, schedule, form limit and component limits.

dr : DoseRule
Returns: (string * MinMax) list

reconstitute mapping loc dep fits dr

Full Usage: reconstitute mapping loc dep fits dr

Parameters:
    mapping : 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.

mapping : 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

removeEmptyLimits hasLimitingSolutionRule drs

Full Usage: removeEmptyLimits hasLimitingSolutionRule drs

Parameters:
Returns: DoseRule array

Removes substance limits without values, then component limits without any limit, then dose rules without component limits. A row without dose values passes validateData, so its dose rule has only empty limits.

A dose rule without limits for which hasLimitingSolutionRule is true is returned unchanged: its limits are in a solution rule, and an order needs its components.

hasLimitingSolutionRule : DoseRule -> bool
drs : DoseRule[]
Returns: DoseRule array

reverseDoseLimit cmpBased cmpName dl

Full Usage: reverseDoseLimit cmpBased cmpName dl

Parameters:
    cmpBased : 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.

cmpBased : bool
cmpName : string
dl : DoseLimit
Returns: DoseLimitData

reverseGeneric g

Full Usage: reverseGeneric g

Parameters:
Returns: GenericData

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.

g : Generic
Returns: GenericData

reversePatient pc

Full Usage: reversePatient pc

Parameters:
Returns: PatientCategoryData

Maps a patient category back to the patient columns of a row.

pc : PatientCategory
Returns: PatientCategoryData

reverseSchedule dr dl dld

Full Usage: reverseSchedule dr dl dld

Parameters:
Returns: ScheduleData

Maps the schedule of a dose rule and a dose limit back to the schedule columns of a row.

dr : DoseRule
dl : DoseLimit
dld : DoseLimitData
Returns: ScheduleData

routes

Full Usage: routes

Returns: DoseRule[] -> string array

Returns the distinct routes of the dose rules, sorted, ignoring case.

Returns: DoseRule[] -> string array

setDoseRuleHashId unitGroup dr

Full Usage: setDoseRuleHashId unitGroup dr

Parameters:
Returns: HashId

Returns the Id of a dose rule: a hash of the unit group of its products and the fields that select the dose rule.

unitGroup : Group
dr : DoseRule
Returns: HashId

timeUnitStr mm

Full Usage: timeUnitStr mm

Parameters:
Returns: string

Returns the unit of a time range, such as an administration time, or an empty string.

mm : MinMax
Returns: string

toData dr

Full Usage: toData dr

Parameters:
Returns: DoseRuleData[]

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.

dr : DoseRule
Returns: DoseRuleData[]

unitStr u

Full Usage: unitStr u

Parameters:
Returns: string

Returns a unit as short text without the unit group, which UnitsParse.fromString reads back as the same unit.

u : Unit
Returns: string

Type something to start searching.