Logo GenPRES

Product Module

Parses the Formulary sheet and builds, reconstitutes, pre-dilutes and filters the product components from G-Standaard products and Formulary rows.

Nested modules

Modules Description

Enteral

Creates the virtual products of the enteral rows of the Formulary sheet. A row without a parsable unit is left out.

FormRoute

Tells whether the FormRoute mapping marks a pharmaceutical form as a solution. A form without a mapping is not a solution.

Location

Converts a venous access to and from the sheet codes PVL, CVL and TUBE. Any other code gives AnyAccess.

Parenteral

Creates the virtual products of the parenteral rows of the Formulary sheet, with millilitre as the form unit.

Predilution

Parses the Predilution sheet and tests whether a predilution rule applies to a setting, an indication and a patient.

ProductPredilution

Creates the product predilution of a predilution rule, with the substances of the diluent.

ProductReconstitution

Creates the product reconstitution of a reconstitution rule, with the substances of the solvent.

Reconstitution

Parses the Reconstitution sheet and selects the reconstitution rules for a location, a department, a route and a patient.

Functions and values

Function or value Description

create gen frm rte substs

Full Usage: create gen frm rte substs

Parameters:
    gen : GenericName
    frm : string
    rte : string
    substs : string array

Returns: ProductComponent
gen : GenericName
frm : string
rte : string
substs : string array
Returns: ProductComponent

createSubstance logger name conc unit formUnit unitMapping

Full Usage: createSubstance logger name conc unit formUnit unitMapping

Parameters:
Returns: SubstanceItem option
logger : Logger
name : string
conc : RationalX option
unit : string
formUnit : Unit
unitMapping : UnitMapping array
Returns: SubstanceItem option

createVirtualProduct logger name form routes formUnit unitMapping substs

Full Usage: createVirtualProduct logger name form routes formUnit unitMapping substs

Parameters:
Returns: ProductComponent

Creates a virtual product from a parenteral or enteral row of the Formulary sheet, with the nutrient columns as its substances. The form is lowercased like the form of a G-Standaard product. Raises a FormatException for a substance name that is not a name and a unit.

logger : Logger
name : GPK
form : string
routes : string[]
formUnit : Unit
unitMapping : UnitMapping array
substs : (string * RationalX option) list
Returns: ProductComponent

filter mapping route name form brand gpks hpks prods

Full Usage: filter mapping route name form brand gpks hpks prods

Parameters:
    mapping : RouteMapping array - The route mapping.
    route : string - The route.
    name : string - The generic name; empty matches any name. Ignores case and / + ( ).
    form : string - The pharmaceutical form; empty matches any form, compared like the name.
    brand : string - The brand of the trade products to keep; empty keeps every brand.
    gpks : GPK array - The GPKs to keep; empty keeps every GPK.
    hpks : HPK array - The HPKs of the trade products to keep when no brand is given; empty keeps every HPK.
    prods : ProductComponent[] - The products.

Returns: ProductComponent[]

Returns the products that match the route, and the name, form and GPKs when given, with their trade products narrowed by brand or HPKs. When a brand or HPKs are given, a product without a matching trade product is left out.

mapping : RouteMapping array

The route mapping.

route : string

The route.

name : string

The generic name; empty matches any name. Ignores case and / + ( ).

form : string

The pharmaceutical form; empty matches any form, compared like the name.

brand : string

The brand of the trade products to keep; empty keeps every brand.

gpks : GPK array

The GPKs to keep; empty keeps every GPK.

hpks : HPK array

The HPKs of the trade products to keep when no brand is given; empty keeps every HPK.

prods : ProductComponent[]

The products.

Returns: ProductComponent[]

filterGenPresProductsByData routeMapping formularyProducts data genPresProducts

Full Usage: filterGenPresProductsByData routeMapping formularyProducts data genPresProducts

Parameters:
Returns: GenPresProduct[]

Keeps only the ZIndex generic products that the dose rule data can select, so fewer product components are built. A generic product is kept when its GPK is in the GPKs of a row, when one of its trade products is in the HPKs of a row, or, for a row with neither, when its product name is the component name of the row and one of its routes is the route of the row. Returns the GenPresProducts with only the kept generic products, and leaves out a GenPresProduct with none. Product.filter then selects the products per rule from this result, so the dose rules are the same as without this filter.

routeMapping : RouteMapping array
formularyProducts : FormularyProduct[]
data : DoseRuleData[]
genPresProducts : GenPresProduct[]
Returns: GenPresProduct[]

filterOutTradeProducts brand ids prods

Full Usage: filterOutTradeProducts brand ids prods

Parameters:
Returns: ProductComponent[]
brand : string
ids : HPK array
prods : ProductComponent[]
Returns: ProductComponent[]

forms products

Full Usage: forms products

Parameters:
Returns: string array

Returns the distinct pharmaceutical forms of the products.

products : ProductComponent array
Returns: string array

fromGenPresProducts logger unitMapping routeMapping validForms formRoutes reconstitution parenteral enteral formularyProducts genPresProducts

Full Usage: fromGenPresProducts logger unitMapping routeMapping validForms formRoutes reconstitution parenteral enteral formularyProducts genPresProducts

Parameters:
Returns: ProductComponent[]

Builds the product components from ZIndex GenPresProducts that are already loaded, and adds the parenteral and enteral virtual products. Performs no IO.

logger : Logger
unitMapping : UnitMapping array
routeMapping : RouteMapping array
validForms : string array
formRoutes : FormRoute[]
reconstitution : Reconstitution array
parenteral : ProductComponent[]
enteral : ProductComponent array
formularyProducts : FormularyProduct[]
genPresProducts : GenPresProduct[]
Returns: ProductComponent[]

generics products

Full Usage: generics products

Parameters:
Returns: GenericName array

Returns the distinct generics of the products.

products : ProductComponent array
Returns: GenericName array

get logger unitMapping routeMapping validForms formRoutes reconstitution parenteral enteral formularyProducts

Full Usage: get logger unitMapping routeMapping validForms formRoutes reconstitution parenteral enteral formularyProducts

Parameters:
Returns: ProductComponent[]

Reads the ZIndex GenPresProducts and builds the product components with fromGenPresProducts, timing the call.

logger : Logger
unitMapping : UnitMapping array
routeMapping : RouteMapping array
validForms : string array
formRoutes : FormRoute[]
reconstitution : Reconstitution array
parenteral : ProductComponent[]
enteral : ProductComponent array
formularyProducts : FormularyProduct[]
Returns: ProductComponent[]

getAdditionalSubstances fp

Full Usage: getAdditionalSubstances fp

Parameters:
Returns: (string * BigRational option) list
fp : FormularyProduct
Returns: (string * BigRational option) list

getFormularyProducts dataUrlId

Full Usage: getFormularyProducts dataUrlId

Parameters:
    dataUrlId : string

Returns: Result<FormularyProduct[], Message list>
dataUrlId : string
Returns: Result<FormularyProduct[], Message list>

gstandName fp gp

Full Usage: gstandName fp gp

Parameters:
Returns: string

The G-Standaard name of a generic product: the GStand column of its Formulary row, else the Generic column, lowercased; the ZIndex name when the product has no Formulary row.

fp : FormularyProduct option
gp : GenericProduct
Returns: string

map logger unitMapping routeMapping formRoutes reconstitution name synonyms formQuantities fpOpt gp

Full Usage: map logger unitMapping routeMapping formRoutes reconstitution name synonyms formQuantities fpOpt gp

Parameters:
Returns: ProductComponent
logger : Logger
unitMapping : UnitMapping array
routeMapping : RouteMapping array
formRoutes : FormRoute[]
reconstitution : ProductReconstitution[]
name : string
synonyms : string array
formQuantities : RationalX[]
fpOpt : FormularyProduct option
gp : GenericProduct
Returns: ProductComponent

matchesSetting routeMapping loc dep rte route location department

Full Usage: matchesSetting routeMapping loc dep rte route location department

Parameters:
    routeMapping : RouteMapping array
    loc : string option
    dep : string option
    rte : string option
    route : string
    location : string option
    department : string option

Returns: bool

Whether a rule for a route, a location and a department applies to a setting. The route must match when the setting gives one, the location as PatientCategory.locationMatches decides, and the department as PatientCategory.departmentMatches decides.

routeMapping : RouteMapping array
loc : string option
dep : string option
rte : string option
route : string
location : string option
department : string option
Returns: bool

mixSubstances total liquidVol substs addedVol added

Full Usage: mixSubstances total liquidVol substs addedVol added

Parameters:
Returns: SubstanceItem[]

Returns the substances of a volume of a liquid mixed with a volume of an added liquid, in a total volume. Each concentration and molar concentration of the liquid is multiplied by the volume of the liquid, and of the added liquid by the added volume, and divided by the total volume. A substance of the added liquid is added to the substance of the liquid with the same name, or else added as a new substance; a concentration in another unit group, such as mg against mmol, is not added.

total : ValueUnit
liquidVol : ValueUnit
substs : SubstanceItem[]
addedVol : ValueUnit
added : SubstanceItem[]
Returns: SubstanceItem[]

narrow brand gpks hpks prods

Full Usage: narrow brand gpks hpks prods

Parameters:
Returns: ProductComponent[]

Returns the products with one of the GPKs, and of those the trade products of the brand, or with one of the HPKs when no brand is given. Empty GPKs keep every product; an empty brand and empty HPKs keep every trade product. When a brand or HPKs are given, a product without a matching trade product is left out.

brand : string
gpks : GPK array
hpks : HPK array
prods : ProductComponent[]
Returns: ProductComponent[]

parseFormularyProducts data

Full Usage: parseFormularyProducts data

Parameters:
    data : string[][]

Returns: Result<FormularyProduct[], Message list>
data : string[][]
Returns: Result<FormularyProduct[], Message list>

predilute mapping loc dep fits rte indication preds prod

Full Usage: predilute mapping loc dep fits rte indication preds prod

Parameters:
Returns: ProductComponent array

Returns the product followed by one pre-diluted product per matching predilution of its GPK: the product volume of the product with the diluent volume of diluent, in the prepared volume of the two, as mixSubstances mixes the substances. The product is a liquid: a liquid product, or a product after the reconstitution. The label of a pre-diluted product names the predilution, for example "..., 3 mL verdund met 7 mL gluc 5%".

mapping : RouteMapping array
loc : string option
dep : string option
fits : Predilution -> bool
rte : string
indication : string
preds : ProductPredilution[]
prod : ProductComponent
Returns: ProductComponent array

productName virtualNames fp gp

Full Usage: productName virtualNames fp gp

Parameters:
Returns: string

Returns the name of a generic product: the AltName of its Formulary row as written, else its G-Standaard name. An AltName that is also the name of a virtual product is not used, so the parenteral fluids keep their virtual products until #1444 replaces them.

virtualNames : Set<string>
fp : FormularyProduct option
gp : GenericProduct
Returns: string

reconstitute mapping loc dep fits rte prod

Full Usage: reconstitute mapping loc dep fits rte prod

Parameters:
    mapping : RouteMapping array - The route mapping.
    loc : string option - The location.
    dep : string option - The department.
    fits : Reconstitution -> bool - Whether a reconstitution applies to the patient.
    rte : string - The route; an empty route is not checked.
    prod : ProductComponent - The product.

Returns: ProductComponent array * string seq The product unchanged when it requires no reconstitution, else one product per matching reconstitution rule: 1 mL of the product mixed with the solvent volume of solvent in the solvent volume plus the expansion volume, as mixSubstances mixes the substances. A reconstituted product holds only the reconstitution it was made with. Also returns a warning when no reconstitution rule matches.

Reconstitutes a product for a location, a department and a route.

mapping : RouteMapping array

The route mapping.

loc : string option

The location.

dep : string option

The department.

fits : Reconstitution -> bool

Whether a reconstitution applies to the patient.

rte : string

The route; an empty route is not checked.

prod : ProductComponent

The product.

Returns: ProductComponent array * string seq

The product unchanged when it requires no reconstitution, else one product per matching reconstitution rule: 1 mL of the product mixed with the solvent volume of solvent in the solvent volume plus the expansion volume, as mixSubstances mixes the substances. A reconstituted product holds only the reconstitution it was made with. Also returns a warning when no reconstitution rule matches.

rename defaultName useGenName subst

Full Usage: rename defaultName useGenName subst

Parameters:
Returns: string
defaultName : string
useGenName : bool
subst : ProductSubstance
Returns: string

substancesOf parenteral name

Full Usage: substancesOf parenteral name

Parameters:
Returns: SubstanceItem array

Returns the substances of the parenteral product whose generic name equals the name, ignoring case, and none when there is no such product.

parenteral : ProductComponent[]
name : string
Returns: SubstanceItem array

synonyms products

Full Usage: synonyms products

Parameters:
Returns: string array

Returns the distinct synonyms and generics of the products.

products : ProductComponent array
Returns: string array

virtualProductNames formularyProducts

Full Usage: virtualProductNames formularyProducts

Parameters:
Returns: Set<string>

The names of the virtual products: the Generic of every parenteral and enteral row, lowercased.

formularyProducts : FormularyProduct[]
Returns: Set<string>

virtualRoutes routeMapping fp

Full Usage: virtualRoutes routeMapping fp

Parameters:
Returns: string array

Returns the routes of a virtual product as ZIndex names, through the route mapping. Raises a FormatException for a route that the route mapping does not know.

routeMapping : RouteMapping array
fp : FormularyProduct
Returns: string array

Type something to start searching.