A datalog store for dm+d.
A datalog store for dm+d.
Returns identifiers for the AMPs associated with this product.
Returns identifiers for the AMPs associated with this product.
(atc->ecl st
re-atc
&
{:keys [include-tf? include-product-packs?]
:or {include-tf? false include-product-packs? false}})
Convert an ATC code regexp into a SNOMED CT expression that will identify all dm+d products relating to that code.
Not all VMPs have a VTM, but a given VTM will subsume all VTMs, VMPs and AMPs in the SNOMED drug model.
Unfortunately, while the UK SNOMED drug extension includes trade family entities, dm+d does not. This is unfortunate. In order to identify the TF concept for any given AMP, we can use an ECL expression of the form (>'amp-concept-id' AND <9191801000001103|Trade Family|) to identify parent concepts in the hierarchy up to and not including the TF concept itself. However, this can result in a very long expression indeed. If you need to build an ECL expression that includes TF, this is better done within the context of the SNOMED drug extension. You can use 'atc->products-for-ecl' to help build that ECL expression.
It would not be usual to want to include VMPP or AMPP, but you can include if required. All AMPPs are subsumed by VMPPs, so we simply add clauses to include VMPPs and descendants for each VMP using the 'Has VMP' relationship.
Convert an ATC code regexp into a SNOMED CT expression that will identify all dm+d products relating to that code. Not all VMPs have a VTM, but a given VTM will subsume all VTMs, VMPs and AMPs in the SNOMED drug model. Unfortunately, while the UK SNOMED drug extension includes trade family entities, dm+d does not. This is unfortunate. In order to identify the TF concept for any given AMP, we can use an ECL expression of the form (>'amp-concept-id' AND <9191801000001103|Trade Family|) to identify parent concepts in the hierarchy up to and not including the TF concept itself. However, this can result in a very long expression indeed. If you need to build an ECL expression that includes TF, this is better done within the context of the SNOMED drug extension. You can use 'atc->products-for-ecl' to help build that ECL expression. It would not be usual to want to include VMPP or AMPP, but you can include if required. All AMPPs are subsumed by VMPPs, so we simply add clauses to include VMPPs and descendants for each VMP using the 'Has VMP' relationship.
(atc->products-for-ecl st re-atc)
Returns a map containing product type as key and a sequence of product identifiers as each value, designed for building an ECL expression.
As the child relationships of a VTM include all VMPs and AMPs, we do not have to include VMPs or AMPs unless there is no VTM for a given VMP. As such, VMPs are only returned iff there is no associated VTM. However, all AMPs are returned as it is likely that those will be needed in order to derive a list of TF products. It is sadly the case that the stock dm+d does not include TF products, while the SNOMED drug extension does include those products.
Returns a map containing product type as key and a sequence of product identifiers as each value, designed for building an ECL expression. As the child relationships of a VTM include all VMPs and AMPs, we do not have to include VMPs or AMPs unless there is no VTM for a given VMP. As such, VMPs are only returned iff there is no associated VTM. However, all AMPs are returned as it is likely that those will be needed in order to derive a list of TF products. It is sadly the case that the stock dm+d does not include TF products, while the SNOMED drug extension does include those products.
Return the ATC code associated with this product.
Return the ATC code associated with this product.
(eids->ids st eids)
Return a sequence of product identifiers for the eids specified.
Return a sequence of product identifiers for the eids specified.
(fetch-lookup st nm)
Returns the lookup for the kind specified. Parameters:
Returns the lookup for the kind specified. Parameters: - st : dm+d store - kind : kind, e.g. :BASIS_OF_NAME :FLAVOUR :UNIT_OF_MEASURE
Declarative description of how how individual properties can be supplemented by adding a datalog reference using the property and the foreign key specified.
A nested map of <file-type> <component-type> with a tuple representing
For example, the :VTMID property of the VMP component is turned into a property :VMP/VTM that will reference using the key :PRODUCT/ID.
Declarative description of how how individual properties can be supplemented by adding a datalog reference using the property and the foreign key specified. A nested map of <file-type> <component-type> with a tuple representing - property : name of property to contain the reference - foreign-key : the attribute representing the foreign key. For example, the :VTMID property of the VMP component is turned into a property :VMP/VTM that will reference using the key :PRODUCT/ID.
(parse m)
Parse a dm+d component into a map suitable for storing in the datalog store. Each component is given a type, a tuple of the file type and the component type. We use that tuple to determine how to parse data. Parameters:
Parse a dm+d component into a map suitable for storing in the datalog store. Each component is given a type, a tuple of the file type and the component type. We use that tuple to determine how to parse data. Parameters: - m : dm+d component with :TYPE property a tuple of file and component type.
(parse-entity m nspace)
Turn an arbitrary entity into something readily importable into datalog. In essence, this namespaces any properties and turns lookups into datalog references. It is most useful in parsing complete components or properties of a dm+d component that are themselves entities (e.g. ingredients) in which there are multiple properties (ingredient, amount etc).
Turn an arbitrary entity into something readily importable into datalog. In essence, this namespaces any properties and turns lookups into datalog references. It is most useful in parsing complete components or properties of a dm+d component that are themselves entities (e.g. ingredients) in which there are multiple properties (ingredient, amount etc).
(parse-flat-property m product-key)
Parse a simple to-one or to-many property that is simply a reference type. For example, {:TYPE [:VMP :DRUG_ROUTE], :VPID 318248001, :ROUTECD 26643006} will be parsed into: {:VMP/DRUG_ROUTES [:ROUTE/CD 26643006], :PRODUCT/ID 318248001}.
Parse a simple to-one or to-many property that is simply a reference type. For example, {:TYPE [:VMP :DRUG_ROUTE], :VPID 318248001, :ROUTECD 26643006} will be parsed into: {:VMP/DRUG_ROUTES [:ROUTE/CD 26643006], :PRODUCT/ID 318248001}.
(parse-lookup m)
Parse the definition of a lookup, or similar.
Parse the definition of a lookup, or similar.
(parse-nested-property m entity-name property-name product-key)
Parse a product's set of properties (e.g. VPI) by creating a new entity. This is most suitable for complex to-many relationships. For example, {:TYPE [:VMP :VIRTUAL_PRODUCT_INGREDIENT], :VPID 319996000, :ISID 387584000, :BASIS_STRNTCD "0001", :STRNT_NMRTR_VAL 10.0, :STRNT_NMRTR_UOMCD 258684004} will be parsed into: {:PRODUCT/ID 319996000 :VMP/INGREDIENTS { ... }} so that the values are nested under the property specified.
Parse a product's set of properties (e.g. VPI) by creating a new entity. This is most suitable for complex to-many relationships. For example, {:TYPE [:VMP :VIRTUAL_PRODUCT_INGREDIENT], :VPID 319996000, :ISID 387584000, :BASIS_STRNTCD "0001", :STRNT_NMRTR_VAL 10.0, :STRNT_NMRTR_UOMCD 258684004} will be parsed into: {:PRODUCT/ID 319996000 :VMP/INGREDIENTS { ... }} so that the values are nested under the property specified.
(parse-reference m)
Turn an arbitrary entity into a flattened reference. This is most suitable for simple properties such as lookups.
Turn an arbitrary entity into a flattened reference. This is most suitable for simple properties such as lookups.
(product-by-exact-name st nm)
Returns a single product identifier for a search by exact name.
Returns a single product identifier for a search by exact name.
(product-by-name st re-nm)
Simple search by name. Warning: this is not designed for operational use as text search is slow - it will take ~500ms. It is intended for testing and exploration purposes only.
Simple search by name. Warning: this is not designed for operational use as text search is slow - it will take ~500ms. It is intended for testing and exploration purposes only.
(product-eids-from-atc st re-atc)
(product-eids-from-atc st re-atc product-types)
The datalog-based schema is a close representation to the source dm+d data structures. The key characteristics are:
The datalog-based schema is a close representation to the source dm+d data structures. The key characteristics are: - all products are given a :PRODUCT/ID property and a :PRODUCT/TYPE property. - properties are namespaced using a code representing the filename from which they were derived (e.g. :VTM :VMP :AMP etc), except lookups are given their own namespace representing that lookup (e.g. :BASIS_OF_NAME). - lookups are referenced by their code (e.g. :BASIS_OF_NAME/CD 3) and the source entity has a property :VMP/BASIS based on the original reference (e.g. :VMP/BASISCD).
(vmp-eids-from-atc st re-atc)
Returns VMP entity ids for the ATC code regular expression. Parameters:
It is usual to use a prefix match match for the ATC given its code structure.
The Anatomical Therapeutic Chemical (ATC) code: a unique code assigned to a medicine according to the organ or system it works on and how it works. The classification system is maintained by the World Health Organization (WHO).
The dm+d ATC mapping only includes VMPs, so depending on usage, extending the codeset to include the appropriate other dm+d structures might be required.
Returns VMP entity ids for the ATC code regular expression. Parameters: - st : dm+d store - re-atc : regular expression (e.g. #"L04AX.*"). It is usual to use a prefix match match for the ATC given its code structure. The Anatomical Therapeutic Chemical (ATC) code: a unique code assigned to a medicine according to the organ or system it works on and how it works. The classification system is maintained by the World Health Organization (WHO). The dm+d ATC mapping only includes VMPs, so depending on usage, extending the codeset to include the appropriate other dm+d structures might be required.
(vmp-eids-without-vtms st)
(vmp-eids-without-vtms st vmp-eids)
Return VMP eids without VTMs. Parameters:
To help with testing, if vmp-eids is omitted, all VMPs without an associated VTM are returned.
Return VMP eids without VTMs. Parameters: - st : DmdStore - vmp-eids : a sequence of VMP eids To help with testing, if vmp-eids is omitted, all VMPs without an associated VTM are returned.
Returns the VMPs associated with this product.
Returns the VMPs associated with this product.
Return the entity ids for the VTMs associated with this product.
Return the entity ids for the VTMs associated with this product.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close