Logo GenPRES

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

adjustUnitColumns l

Full Usage: adjustUnitColumns l

Parameters:
Returns: BigRational option list

Returns the per kg and per m2 columns, which use the adjust unit.

l : DoseLimitData
Returns: BigRational option list

adjustUnitOf d

Full Usage: adjustUnitOf d

Parameters:
Returns: Unit option

The adjust unit of a row: kg, m2, or none.

d : DoseRuleData
Returns: Unit option

adjustUnitRefusals rows

Full Usage: adjustUnitRefusals rows

Parameters:
Returns: string list

Returns a reason for each row with an adjust unit that is not empty and not kg or m2.

rows : DoseRuleData[]
Returns: string list

adultRowsWithAge data

Full Usage: adultRowsWithAge data

Parameters:
Returns: string array

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.

data : DoseRuleData[]
Returns: string array

checkRules data

Full Usage: checkRules data

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

data : DoseRuleData[]
Returns: DoseRuleData array * string[]

dataGroupKey d

Full Usage: dataGroupKey d

Parameters:
Returns: DataGroupKey

dataToCsv data

Full Usage: dataToCsv data

Parameters:
Returns: string list

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

data : DoseRuleData[]
Returns: string list

dedupRowsByRowId rows

Full Usage: dedupRowsByRowId rows

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

rows : DoseRuleData[]
Returns: DoseRuleData[] * string list

describe d

Full Usage: describe d

Parameters:
Returns: string

Describes the dose rule of a row by generic, route, indication, source, patient and dose type, so a sheet author can find it.

d : DoseRuleData
Returns: string

distinctByDoseLimit d

Full Usage: distinctByDoseLimit d

Parameters:
Returns: string * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool
d : DoseRuleData
Returns: string * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool

doseFields dd

Full Usage: doseFields dd

Parameters:
Returns: string list

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.

dd : DoseRuleData
Returns: string list

doseRanges r

Full Usage: doseRanges r

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

r : DoseRuleData
Returns: (string * BigRational option * BigRational option) list

doseRuleDataToString dd

Full Usage: doseRuleDataToString dd

Parameters:
Returns: string

Formats a dose rule row as text for the log.

dd : DoseRuleData
Returns: string

doseUnitColumns l

Full Usage: doseUnitColumns l

Parameters:
Returns: BigRational option list

Returns all dose limit columns, which all use the dose unit.

l : DoseLimitData
Returns: BigRational option list

genericAndRouteRefusals rows

Full Usage: genericAndRouteRefusals rows

Parameters:
Returns: string list

Returns a reason for each row without a generic and for each row without a route.

rows : DoseRuleData[]
Returns: string list

groupKeyFields dd

Full Usage: groupKeyFields dd

Parameters:
Returns: string list

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 setDataHashIds hashes them into the GrpId, so both use the same definition.

dd : DoseRuleData
Returns: string list

hasAdjustedValue d

Full Usage: hasAdjustedValue d

Parameters:
Returns: bool

Checks whether a row has a value in a per kg or per m2 column.

d : DoseRuleData
Returns: bool

hasValueIn columns d

Full Usage: hasValueIn columns d

Parameters:
Returns: bool
Type parameters: 'a

Checks whether a row has a value in one of the given dose limit columns.

columns : DoseLimitData -> 'a option list
d : DoseRuleData
Returns: bool

headers

Full Usage: headers

Returns: string list

The header line of the DoseRules sheet, with the columns in the order that dataToCsv writes them.

Returns: string list

ignoreValuesNotForDoseType d

Full Usage: ignoreValuesNotForDoseType d

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

d : DoseRuleData
Returns: DoseRuleData * string option

limitedPatientRanges r

Full Usage: limitedPatientRanges r

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

r : DoseRuleData
Returns: (string * BigRational option * BigRational option * RationalX * RationalX) list

missingUnitRefusals rows

Full Usage: missingUnitRefusals rows

Parameters:
Returns: string list

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.

rows : DoseRuleData[]
Returns: string list

optBrToStr

Full Usage: optBrToStr

Returns: BigRational option -> string

Returns the value as text, or an empty text for no value.

Returns: BigRational option -> string

parseDoseRuleData data

Full Usage: parseDoseRuleData data

Parameters:
    data : string array array

Returns: Result<DoseRuleData array, Message list>
data : string array array
Returns: Result<DoseRuleData array, Message list>

patientRanges r

Full Usage: patientRanges r

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

r : DoseRuleData
Returns: (string * BigRational option * BigRational option) list

patientWarning rows

Full Usage: patientWarning rows

Parameters:
Returns: string option

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.

rows : DoseRuleData[]
Returns: string option

rangeProblems ranges

Full Usage: rangeProblems ranges

Parameters:
Returns: string list

Returns what is wrong with each of the ranges: a negative value, a max of 0, or a min greater than the max. A min of 0 and a min equal to the max are valid.

ranges : (string * RationalX option * RationalX option) seq
Returns: string list

rangeRefusals rows

Full Usage: rangeRefusals rows

Parameters:
Returns: string list

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.

rows : DoseRuleData[]
Returns: string list

rateUnitColumns l

Full Usage: rateUnitColumns l

Parameters:
Returns: BigRational option list

Returns the rate columns, which use the rate unit.

l : DoseLimitData
Returns: BigRational option list

refusals rows

Full Usage: refusals rows

Parameters:
Returns: string list

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.

rows : DoseRuleData[]
Returns: string list

rowName l

Full Usage: rowName l

Parameters:
Returns: string

Returns the substance of a row, or the component when the row has no substance.

l : DoseLimitData
Returns: string

setDataHashIds dd

Full Usage: setDataHashIds dd

Parameters:
Returns: DoseRuleData

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.

dd : DoseRuleData
Returns: DoseRuleData

setNumbers data

Full Usage: setNumbers data

Parameters:
Returns: DoseRuleData array

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.

data : DoseRuleData[]
Returns: DoseRuleData array

unitRefusals rows

Full Usage: unitRefusals rows

Parameters:
Returns: string list

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.

rows : DoseRuleData[]
Returns: string list

unitWarning rows

Full Usage: unitWarning rows

Parameters:
Returns: string option

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.

rows : DoseRuleData[]
Returns: string option

validateData dd

Full Usage: validateData dd

Parameters:
Returns: string list

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.

dd : DoseRuleData
Returns: string list

withSingleNarrowing g

Full Usage: withSingleNarrowing g

Parameters:
Returns: GenericData

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.

g : GenericData
Returns: GenericData

Type something to start searching.