Logo GenPRES

Analyze Module

Checks the mapping of dose rules back to sheet rows by a round trip of the rows through the dose rules. Loading merges all rows with the same identity, such as the same source, generic, route, patient, dose type and dose text, into one dose rule, so the mapping back cannot return the separate rows. Instead, runPass checks that every input row that loading keeps is contained in an output row with the same identity. Quantities are compared in base units, so 1000 mg equals 1 g. A first pass on the source data reports a missing row when the source has different content under one identity. A second pass on the output of the first pass, which has one rule per identity, finds every row, and fixpointDelta compares the rows of both passes.

Types

Type Description

FixpointDelta

Compares the output of pass 1 (gen1) with the output of pass 2 (gen2) by rowKey. gen2 can lack rows of gen1, because the second forward map merges rows with the same identity but different dose values. This comes from the forward merge, not from a defect in the reverse map.

PassResult

The result of one round-trip pass: the generated rows and the containment counts.

Functions and values

Function or value Description

allLimitsEmpty d

Full Usage: allLimitsEmpty d

Parameters:
Returns: bool
d : DoseRuleData
Returns: bool

brStr

Full Usage: brStr

Returns: BigRational option -> string
Returns: BigRational option -> string

containedIn gen orig

Full Usage: containedIn gen orig

Parameters:
Returns: bool True when every quantity of orig is present in gen with the same value.

Tells whether a generated row contains an original row. The generated row may have more values. The caller checks the identity first.

gen : DoseRuleData

The generated row.

orig : DoseRuleData

The original input row.

Returns: bool

True when every quantity of orig is present in gen with the same value.

doseLeaves d

Full Usage: doseLeaves d

Parameters:
Returns: Map<string, string>

Returns the dose limits of a row as tokens by limit name. Uses DoseRule.getDoseLimits, which builds the combined units such as mg/kg/day and drops values without a unit, as the forward map does.

d : DoseRuleData
Returns: Map<string, string>

fixpointDelta gen1 gen2

Full Usage: fixpointDelta gen1 gen2

Parameters:
Returns: FixpointDelta The counts per direction and the rows of gen1 that are absent from gen2.

Compares the rows of two passes by rowKey, in both directions.

gen1 : DoseRuleData[]

The rows generated by pass 1.

gen2 : DoseRuleData[]

The rows generated by pass 2 from gen1.

Returns: FixpointDelta

The counts per direction and the rows of gen1 that are absent from gen2.

freqSet d

Full Usage: freqSet d

Parameters:
Returns: Set<string>

Returns the frequencies of a row as a set of canonical tokens, one per frequency, built with the units of the forward map. Equal frequencies in different time units give the same token. One token per frequency lets containedIn check for a subset.

d : DoseRuleData
Returns: Set<string>

genKey g

Full Usage: genKey g

Parameters:
Returns: string
g : GenericData
Returns: string

idKey d

Full Usage: idKey d

Parameters:
Returns: string

Returns the identity key of a row. Leaves out the generated ids, the row and group numbers and the quantities.

d : DoseRuleData
Returns: string

patKey p

Full Usage: patKey p

Parameters:
Returns: string
p : PatientCategoryData
Returns: string

reasonLines genById orig

Full Usage: reasonLines genById orig

Parameters:
Returns: string list One line per value that the best generated row lacks or has different; "no identity match" when no generated row has the same identity.

Explains why an input row is missing, using the generated row with the same identity that matches the most values.

genById : Map<string, DoseRuleData[]>

The generated rows by identity key.

orig : DoseRuleData

The missing input row.

Returns: string list

One line per value that the best generated row lacks or has different; "no identity match" when no generated row has the same identity.

rowKey d

Full Usage: rowKey d

Parameters:
Returns: string

Returns the key of a row used to remove duplicates: the identity key and all quantities as canonical tokens.

d : DoseRuleData
Returns: string

rowLine d

Full Usage: rowLine d

Parameters:
Returns: string
d : DoseRuleData
Returns: string

runPass forward label input

Full Usage: runPass forward label input

Parameters:
    forward : DoseRuleData[] -> DoseRule[] - Builds the dose rules from rows; a parameter so this module needs no resource provider.
    label : string - The name of the pass in the report.
    input : DoseRuleData[] - The dose rule data rows to check.

Returns: PassResult The counts and the generated rows.

Runs one round trip over the input and checks that a generated row contains every surviving input row. Prints nothing.

forward : DoseRuleData[] -> DoseRule[]

Builds the dose rules from rows; a parameter so this module needs no resource provider.

label : string

The name of the pass in the report.

input : DoseRuleData[]

The dose rule data rows to check.

Returns: PassResult

The counts and the generated rows.

schedLeaves d

Full Usage: schedLeaves d

Parameters:
Returns: Map<string, string>

Returns the administration time, interval and duration limits of a row as tokens by name.

d : DoseRuleData
Returns: Map<string, string>

surviving doseRules data

Full Usage: surviving doseRules data

Parameters:
Returns: DoseRuleData array

Returns the rows that loading keeps: the valid rows, without the rows that have no substance and no dose limits. A row without limits stays when its dose rule is kept without limits, because a solution rule limits it. A row belongs to the dose rule whose DataId has the RuleId of the row; a sheet row has no RuleId, so the RuleId is computed.

doseRules : DoseRule[]
data : DoseRuleData[]
Returns: DoseRuleData array

trunc n s

Full Usage: trunc n s

Parameters:
    n : int
    s : string

Returns: string
n : int
s : string
Returns: string

Type something to start searching.