Liking cljdoc? Tell your friends :D

com.eldrix.dmd.store2

A datalog store for dm+d.

A datalog store for dm+d.
raw docstring

amp-eids-for-vmp-eidsclj

(amp-eids-for-vmp-eids st vmp-eids)
source

amp-eids-for-vmpidclj

(amp-eids-for-vmpid st vmpid)
source

amp-eids-for-vtmidclj

(amp-eids-for-vtmid st vtmid)
source

amp-propertiesclj

source

ampp-eids-for-amp-eidsclj

(ampp-eids-for-amp-eids st amp-eids)
source

ampp-propertiesclj

source

ampscljmultimethod

Returns identifiers for the AMPs associated with this product.

Returns identifiers for the AMPs associated with this product.
sourceraw docstring

atc->eclclj

(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.
sourceraw docstring

atc->products-for-eclclj

(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.
sourceraw docstring

atc-codecljmultimethod

Return the ATC code associated with this product.

Return the ATC code associated with this product.
sourceraw docstring

create-storeclj

(create-store dir ch & {:keys [batch-size release-date] :or {batch-size 500}})
source

eids->idsclj

(eids->ids st eids)

Return a sequence of product identifiers for the eids specified.

Return a sequence of product identifiers for the eids specified.
sourceraw docstring

fetch-ampclj

(fetch-amp st apid)
source

fetch-amppclj

(fetch-ampp st appid)
source

fetch-lookupclj

(fetch-lookup st nm)

Returns the lookup for the kind specified. Parameters:

  • st : dm+d store
  • kind : kind, e.g. :BASIS_OF_NAME :FLAVOUR :UNIT_OF_MEASURE
Returns the lookup for the kind specified.
Parameters:
- st    : dm+d store
- kind  : kind, e.g. :BASIS_OF_NAME :FLAVOUR  :UNIT_OF_MEASURE
sourceraw docstring

fetch-productclj

(fetch-product st id)
source

fetch-release-dateclj

(fetch-release-date st)
source

fetch-vmpclj

(fetch-vmp st vpid)
source

fetch-vmppclj

(fetch-vmpp st vppid)
source

fetch-vtmclj

(fetch-vtm st vtmid)
source

lookup-referencesclj

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.

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.
sourceraw docstring

open-storeclj

(open-store dir)
source

parseclj

(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:

  • m : dm+d component with :TYPE property a tuple of file and component type.
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.
sourceraw docstring

parse-entityclj

(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).
sourceraw docstring

parse-flat-propertyclj

(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}.
sourceraw docstring

parse-lookupclj

(parse-lookup m)

Parse the definition of a lookup, or similar.

Parse the definition of a lookup, or similar. 
sourceraw docstring

parse-nested-propertyclj

(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.
sourceraw docstring

parse-productclj

(parse-product m id-key)
source

parse-referenceclj

(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.
sourceraw docstring

product-by-exact-nameclj

(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.
sourceraw docstring

product-by-nameclj

(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.
sourceraw docstring

product-eids-from-atcclj

(product-eids-from-atc st re-atc)
(product-eids-from-atc st re-atc product-types)
source

product-typeclj

(product-type st id)
source

results-for-eidsclj

(results-for-eids st eids)
source

schemaclj

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).
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).
sourceraw docstring

store-versionclj

source

supported-product-types-for-atc-mapclj

source

vmp-eid-for-ampidclj

(vmp-eid-for-ampid st ampid)
source

vmp-eids-for-vtmidclj

(vmp-eids-for-vtmid st vtmid)
source

vmp-eids-from-atcclj

(vmp-eids-from-atc st re-atc)

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.

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.
sourceraw docstring

vmp-eids-without-vtmsclj

(vmp-eids-without-vtms st)
(vmp-eids-without-vtms st vmp-eids)

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.

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.
sourceraw docstring

vmp-propertiesclj

source

vmpp-eids-for-vmp-eidsclj

(vmpp-eids-for-vmp-eids st vmp-eids)
source

vmpp-propertiesclj

source

vmpscljmultimethod

Returns the VMPs associated with this product.

Returns the VMPs associated with this product.
sourceraw docstring

vtm-eid-for-ampidclj

(vtm-eid-for-ampid st ampid)
source

vtm-eid-for-vmpidclj

(vtm-eid-for-vmpid st vmpid)
source

vtm-eids-for-vmp-eidsclj

(vtm-eids-for-vmp-eids st vmp-eids)
source

vtmscljmultimethod

Return the entity ids for the VTMs associated with this product.

Return the entity ids for the VTMs associated with this product.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close