Resources Module
Declares the resources of the formulary, loads each resource once in dependency order, and provides the loaded resources with an optional cache.
Types and nested modules
| Type/Module | Description |
|
Collects the distinct departments named by the dose rules, the solution rules and the reconstitutions, and tests whether a department is known. |
|
|
Holds the typed key of every resource. |
|
|
Collects the distinct locations named by the dose rules, the solution rules and the reconstitutions. |
|
|
Creates the typed key of a resource from the name of the resource. |
|
|
A resource provider that loads the resources on first use and caches them. With a TTL in minutes it loads them again after the TTL; without one the cache never expires. A failed load is cached as empty resources. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gives the loaded resources, built and in memory. |
|
|
Resolves the other resources a loader depends on while the loader runs. |
|
|
Resolves a resource on its first request, after the resources it depends on, and caches the value. Collects the warnings of every loader. Raises ResourceLoadError for a loader error, a cyclic dependency or a resource that is not registered. |
|
|
The loaded resources as a typed ResourceState, and as a map of every resolved resource by name for IResourceProvider.Get and the resources that are functions. |
|
|
A cache of the prescription rules per patient for the dose rules and the stand-alone dose rules of a load, with the other rules of the load it is built from. |
|
|
|
|
|
The name of a resource, typed with the value type 'T of the resource. |
|
|
|
|
|
Takes the resolver for the dependencies and returns the boxed value with the non-fatal warnings, or the fatal errors. The value is boxed so one registry holds every resource type; the typed keys unbox it at the right type. |
|
|
A plain provider over an already-loaded resource set. |
|
|
The loader of every resource by name. A new resource needs only a new entry. |
|
|
The loaded resources: the data read from the sources in Data, and the products and rules built from it at the top level. |
Functions and values
| Function or value |
Description
|
Full Usage:
calculationWeightsAndHeightsOf rows
Parameters:
Map<string, string[][]>
Returns: Result<(CalculationWeightsAndHeights * Message list), Message list>
|
Parses the calculation weights and heights from the rows with GenCORE. Returns them with a warning for each correction, or an error for each problem.
|
Full Usage:
defaultRegistry logger dataUrlId
Parameters:
Logger
dataUrlId : string
Returns: ResourceRegistry
|
The default registry, which reads the sheets of dataUrlId. A loader names its dependencies with r.Get, and the engine loads each resource once. The parenteral, enteral and other products all read the formularyProducts resource, so the Formulary sheet is read once.
|
|
The departments of a resolved resource set; none when the rules did not load.
|
Full Usage:
derive f r
Parameters:
IResourceResolver -> 'T
r : IResourceResolver
Returns: Result<(obj * Message list), Message list>
Type parameters: 'T |
Makes a loader that builds a value from other resources, without warnings.
|
Full Usage:
deriveWith f r
Parameters:
IResourceResolver -> 'T * Message list
r : IResourceResolver
Returns: Result<(obj * Message list), Message list>
Type parameters: 'T |
Makes a loader that builds a value from other resources, with warnings.
|
Full Usage:
distinctNames named
Parameters:
string option seq
Returns: string array
|
Returns the names the rules give, such as the departments or the locations: trimmed, blanks ignored, distinct and sorted.
|
Full Usage:
egfrBandOptionsOf rows
Parameters:
string[][]
Returns: EGFRBandOption list * Message list
|
Parses the eGFR band options from the rows with GenCORE, with a warning for every problem. Empty rows give no options and no warning, because the failed sheet read has already warned.
|
Full Usage:
egfrBandSheetWarningText warning
Parameters:
EGFRBandSheetWarning
Returns: string
|
Returns the message text for a problem in the eGFR band sheet.
|
Full Usage:
loadAllResources logger dataUrlId
Parameters:
Logger
dataUrlId : string
Returns: Result<LoadedResources, Message list>
|
Loads every resource of the default registry.
|
Full Usage:
loadAllResourcesWithRegistry registry
Parameters:
ResourceRegistry
Returns: Result<LoadedResources, Message list>
|
Loads every resource of the registry. Returns the errors of the first resource that fails.
|
|
The locations of a resolved resource set; none when the rules did not load.
|
Full Usage:
maxCachedPatients
Returns: int
|
The number of distinct patients the prescription rules are cached for.
|
|
Returns the message text for an error in the normal-value rows.
|
|
Returns the message text for an error in the rows of the sheet of the calculation weights or heights.
|
Full Usage:
normalValueSheetWarningText warning
Parameters:
NormalValueSheetWarning
Returns: string
|
Returns the message text for a problem in the sheet of the calculation weights or heights that the parse corrects.
|
Full Usage:
normalValueTablesOf rows
Parameters:
Map<string, string[][]>
Returns: NormalValueTables option * Message list
|
Parses the normal-value tables from the rows with GenCORE. Returns None with a warning per error when the rows do not parse. Empty rows return None without a warning, because the failed sheet read has already warned.
|
|
|
Full Usage:
ofResultOrDefault note fallback f arg4
Parameters:
string
-
Says what was not loaded and what that means.
fallback : 'T
-
The value returned on an error.
f : unit -> Result<'T, Message list>
-
The read.
arg3 : IResourceResolver
Returns: Result<(obj * Message list), Message list>
Type parameters: 'T |
Makes a loader without dependencies whose failure does not fail the whole load. On an error the loader returns fallback and turns each error into a warning that starts with note. The warning shows in ResourceInfo.Messages, and a reload of the resources retries the read.
|
|
|
|
Builds the prescription rule cache over the solution and renal rules, the route mappings, the additive lookup and the predilution rules of one load. The dose rules and the stand-alone dose rules of the load each get a memo of at most maxCachedPatients patients. A reload builds a new, empty cache.
|
|
The loader of the renal rule data. A renal sheet that fails to load fails the whole load, because empty renal rules would give every patient with a reduced kidney function the full dose.
|
GenPRES