Medication Module
Creates the medications of a prescription rule, one for each solution rule or a single medication when the rule has no solution rules, each with its product components, substance items and limits, and builds an order from a medication.
Nested modules
| Modules | Description |
|
Holds the serializable shape of a medication, used for the medication text and its schema, and converts a medication to and from the Dto. Reading a Dto returns every error with the path of its field. A missing value is null or an empty array, and a number is written as its exact text. A limit has no target field; the target follows from where the limit is placed. The Dto classes allow null, so the serializer can leave a missing field out of the text. |
|
|
Builds an order from a medication: first the structure, then one pass for each kind of constraint, each pass changing only its own part. |
|
|
Holds an empty product component, creates a product component from its parts and tells whether a product can be made from given substances. |
|
|
Holds an empty substance item and creates a substance item from its name, quantities, concentrations, dose limit and dilution limit. |
|
|
Checks that the unit of a dose limit field has the adjust unit and the time unit the field needs. |
Functions and values
| Function or value |
Description
|
Full Usage:
addSolutionRule logger solRule med
Parameters:
Logger
solRule : SolutionRule option
med : Medication
Returns: Medication
|
Applies a solution rule, when there is one, to a medication. The medication gets the drip rate as a dose rate in mL, the volumes, the Div and the dose count of the rule, and a component for the first diluent. Each substance and component gets its dilution limit.
|
|
Whether there are medications and each one is given undiluted while its concentration limit allows none of its product concentrations.
|
|
The name and unit of each component with a quantity, when those components are in more than one unit group, otherwise an empty list.
|
Full Usage:
concentrationsWithinDilutionLimit si
Parameters:
SubstanceItem
Returns: ValueUnit option
|
Returns the concentrations of a substance that its dilution concentration limit allows, with the bounds that withItemDilution sets. A substance without concentrations or without a concentration limit keeps its concentrations. So does a substance with concentrations in another unit group than the limit, such as a molar concentration against a mass limit, because the bounds are compared on base values.
|
Full Usage:
create logger patientData dose dr solRule
Parameters:
Logger
patientData : PatientData
dose : DoseLimit option
dr : DoseRule
solRule : SolutionRule option
Returns: Medication
|
Creates a medication from the patient data, the dose limit, a dose rule and an optional solution rule. The medication adjusts by the adjust unit of the dose rule, else that of the solution rule, and not at all when neither rule has one. Without a solution rule the dose count is 1.
|
Full Usage:
createComponents logger limits
Parameters:
Logger
limits : ComponentLimit[]
Returns: ProductComponent list
|
Creates a product component for every component limit, with its dose limit, products and substances. The values of a list in more than one unit group keep only the largest group, with a warning. A product that cannot be made of the substances of the component is left out.
|
Full Usage:
fromRule logger pr
Parameters:
Logger
pr : PrescriptionRule
Returns: Medication[]
|
Creates a medication for every solution rule of the prescription rule, or one medication when it has no solution rules, and logs each medication.
|
|
Returns the predilution a product was made with; None for a product that is not pre-diluted.
|
|
|
|
Returns the reconstitution a product was made with: the single reconstitution of a product that requires reconstitution. Returns None for a product that requires no reconstitution, or that does not have exactly one reconstitution.
|
Full Usage:
setDilutionLimit dls items
Parameters:
DilutionLimit[]
items : SubstanceItem list
Returns: SubstanceItem list
|
Sets on each substance item the dilution limit whose target is that substance.
|
|
|
|
An empty medication record.
|
Full Usage:
toOrder start med
Parameters:
DateTime
med : Medication
Returns: Result<Order, Message>
|
Builds an Order from a Medication, or returns OrderCouldNotBeCreated with the reason. The caller gives the start in UTC. A medication given undiluted at a concentration that its dilution limit does not allow is refused, because no diluent can bring it within the limit. A medication with components in different unit groups is refused, because the components add up to the orderable.
|
|
Converts a Medication to an Order Dto. Raises the exception with the reason when the medication cannot be ordered; toOrder returns the same failure as a value.
|
Full Usage:
undilutedOutsideDilutionLimit med
Parameters:
Medication
Returns: SubstanceItem list
|
Returns the substances of a medication given undiluted whose dilution limit allows none of the product concentrations. Only a medication with one component is given undiluted; with more components the solver calculates the orderable concentration.
|
GenPRES