Dto Module
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.
Types
| Type | Description |
|
A component of the medication. |
|
|
A dilution limit. Its target follows from where it is placed; it reads back without products. |
|
|
A dose limit. Its target follows from where it is placed: the medication, a component or a substance. |
|
|
The medication. |
|
|
A minimum or a maximum: a value with its unit, inclusive or exclusive. |
|
|
A range: an optional minimum and maximum. |
|
|
The predilution a product was made with. |
|
|
A product a component can be made of. |
|
|
The reconstitution a product was made with. |
|
|
The strength of one substance of a product. |
|
|
A substance of a component. |
|
|
A value with its unit: the numbers as their exact text. |
Functions and values
| Function or value |
Description
|
Full Usage:
componentFromDto path dto
Parameters:
string
dto : ComponentDto
Returns: Validation<ProductComponent, DtoError>
|
|
|
|
Full Usage:
dilutionLimitFromDto target path dto
Parameters:
DilutionTarget
path : string
dto : DilutionLimitDto
Returns: Result<DilutionLimit option, DtoError list>
|
|
Full Usage:
dilutionLimitToDto dilutionLimit
Parameters:
DilutionLimit
Returns: DilutionLimitDto
|
|
Full Usage:
doseLimitFromDto target path dto
Parameters:
LimitTarget
path : string
dto : DoseLimitDto
Returns: Result<DoseLimit option, DtoError list>
|
|
|
|
|
Reads a medication from its Dto. Returns every error, each with the path of its field.
|
|
|
|
|
Full Usage:
madeOfSubstances path substances products
Parameters:
string
substances : SubstanceItem list
products : ComponentProduct list
Returns: Result<ComponentProduct list, DtoError list>
|
Checks that every product can be made of the substances. Returns a NotMadeOf error for every product that cannot.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
predilutionFromDto path dto
Parameters:
string
dto : PredilutionDto
Returns: Result<ComponentPredilution option, DtoError list>
|
Reads the predilution of a product; a null Dto is a product that is not pre-diluted.
|
|
|
Full Usage:
productFromDto path dto
Parameters:
string
dto : ProductDto
Returns: Validation<ComponentProduct, DtoError>
|
|
|
|
Full Usage:
reconstitutionFromDto path dto
Parameters:
string
dto : ReconstitutionDto
Returns: Result<ComponentReconstitution option, DtoError list>
|
Reads the reconstitution of a product; a null Dto is a product that is not reconstituted.
|
|
|
Full Usage:
strengthFromDto path dto
Parameters:
string
dto : StrengthDto
Returns: Result<ProductStrength, DtoError list>
|
|
|
|
Full Usage:
substanceFromDto path dto
Parameters:
string
dto : SubstanceDto
Returns: Validation<SubstanceItem, DtoError>
|
|
|
|
|
|
|
Parses a unit from its text, or returns None. A FormatException of the parser, for an unknown unit group as in mg[Banana] or a factor of 0 as in 0 IU/ml, also gives None.
|
|
|
|
Writes a unit in English short form without its group, or with the group when the form without the group does not parse back to the same unit.
|
|
|
|
|
|
|
|
GenPRES