Liking cljdoc? Tell your friends :D

com.eldrix.dmd.store4

dm+d storage using sqlite

dm+d storage using sqlite
raw docstring

apidsclj

(apids conn id)

Return AMP ids for the given product.

Return AMP ids for the given product.
sourceraw docstring

apids-for-appidsclj

(apids-for-appids conn appids)
source

apids-for-vpidsclj

(apids-for-vpids conn vpids)

Return APIDs for the given VPIDs.

Return APIDs for the given VPIDs.
sourceraw docstring

appidsclj

(appids conn id)

Return AMPP ids for the given product.

Return AMPP ids for the given product.
sourceraw docstring

appids-for-apidsclj

(appids-for-apids conn apids)
source

appids-for-vppidsclj

(appids-for-vppids conn vppids)
source

atc->eclcljdeprecated

(atc->ecl conn
          atc
          &
          {:keys [include-tf? include-product-packs?]
           :or {include-tf? false include-product-packs? false}})

DEPRECATED: use atc->products-for-ecl instead and use that data to build an ECL expression outside of this library.

Convert an ATC code into a SNOMED CT expression that will identify all dm+d products relating to that code. It is almost always better to build an ECL expression using atc->products-for-ecl rather than this function.

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.

DEPRECATED: use `atc->products-for-ecl` instead and use that data to build
an ECL expression outside of this library.

Convert an ATC code into a SNOMED CT expression that will identify all
dm+d products relating to that code. It is almost always better to build an
ECL expression using `atc->products-for-ecl` rather than this function.

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 conn atc)

Returns a map containing product type as key and a sequence of product identifiers as each value, designed for building an ECL expression. Parameters:

  • conn : database connection
  • atc : a string representing the ATC code, or prefix.

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.
Parameters:
- conn : database connection
- atc  : a string representing the ATC code, or prefix. 

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-codeclj

(atc-code conn id)

Return the ATC code for the product specified.

Return the ATC code for the product specified.
sourceraw docstring

atc-code-for-vpidsclj

(atc-code-for-vpids conn vpids)
source

batch->sqlclj

(batch->sql batch)

For the given batch of dm+d entities, return a map of :stmts and :errors

{:stmts ({:stmt "insert into SUPPLIER(CD,DESC) VALUES (?, ?) ON CONFLICT(CD) DO UPDATE SET DESC=excluded.DESC",
          :data  ([2070501000001104 "DDC Ltd"]
                  [3146101000001108 "Dragon Pharm Ltd"] ...)})}
 :errors nil
For the given batch of dm+d entities, return a map of :stmts and :errors
```
{:stmts ({:stmt "insert into SUPPLIER(CD,DESC) VALUES (?, ?) ON CONFLICT(CD) DO UPDATE SET DESC=excluded.DESC",
          :data  ([2070501000001104 "DDC Ltd"]
                  [3146101000001108 "Dragon Pharm Ltd"] ...)})}
 :errors nil
sourceraw docstring

closeclj

(close conn)

Close the store.

Close the store.
sourceraw docstring

create-indexesclj

(create-indexes conn)
source

create-storeclj

(create-store filename
              dirs
              &
              {:keys [batch-size release-date] :or {batch-size 50000}})
source

create-tablesclj

(create-tables conn)

Creates all database tables for dm+d entities.

Creates all database tables for dm+d entities.
sourceraw docstring

entitiesclj

source

entity-by-typeclj

source

fetch-all-lookupclj

(fetch-all-lookup conn lookup)
source

fetch-ampclj

(fetch-amp conn apid)

Return the given AMP with extended information, including the parent VMP.

Return the given AMP with extended information, including the parent VMP.
sourceraw docstring

fetch-amp*clj

(fetch-amp* conn apid)

Return the given AMP without extended information.

Return the given AMP without extended information.
sourceraw docstring

fetch-amppclj

(fetch-ampp conn appid)

Return the given AMPP with extended information, including the parent AMP and VMP.

Return the given AMPP with extended information, including the parent AMP 
and VMP.
sourceraw docstring

fetch-ampp*clj

(fetch-ampp* conn appid)

Return the given AMPP without extended information.

Return the given AMPP without extended information.
sourceraw docstring

fetch-ingredientclj

(fetch-ingredient conn isid)

Returns the ingredient specified.

Returns the ingredient specified.
sourceraw docstring

fetch-lookupclj

(fetch-lookup conn lookup code)
source

fetch-productclj

(fetch-product conn id)

Returns extended information about the product with identifier specified.

Returns extended information about the product with identifier specified.
sourceraw docstring

fetch-product-by-exact-nameclj

(fetch-product-by-exact-name conn s)

Return a single product with the given exact name

Return a single product with the given exact name
sourceraw docstring

fetch-release-dateclj

(fetch-release-date conn)
source

fetch-vmpclj

(fetch-vmp conn vpid)

Return the given VMP with extended information to include its relationships such as its parent VTM.

Return the given VMP with extended information to include its 
relationships such as its parent VTM.
sourceraw docstring

fetch-vmp*clj

(fetch-vmp* conn vpid)

Return the given VMP without extended information.

Return the given VMP without extended information.
sourceraw docstring

fetch-vmppclj

(fetch-vmpp conn vppid)

Return the given VMPP with extended information, including its parent VMP.

Return the given VMPP with extended information, including its parent VMP.
sourceraw docstring

fetch-vmpp*clj

(fetch-vmpp* conn vppid)

Return the given VMPP without extended information.

Return the given VMPP without extended information.
sourceraw docstring

fetch-vtmclj

Returns the given VTM. VTMs do not have extended information so this returns the same as fetch-vtm*.

Returns the given VTM. VTMs do not have extended information so this
returns the same as `fetch-vtm*`.
sourceraw docstring

fetch-vtm*clj

(fetch-vtm* conn vtmid)

Returns the given VTM with no extended information.

Returns the given VTM with no extended information.
sourceraw docstring

open-storeclj

(open-store filename)
source

product-ids-from-atcclj

(product-ids-from-atc conn atc)
(product-ids-from-atc conn atc product-types)

Return a lazy sequence of product ids matching the ATC code

Return a lazy sequence of product ids matching the ATC code
sourceraw docstring

product-typeclj

(product-type conn id)

Returns a keyword :VTM :VMP :AMP :VMPP or :AMPP for the product with the identifier specified.

Returns a keyword :VTM :VMP :AMP :VMPP or :AMPP for the product with 
the identifier specified.
sourceraw docstring

store-versionclj

source

supported-product-types-for-atc-mapclj

source

vmps-from-atccljdeprecated

(vmps-from-atc conn atc)

Return VMPs matching the given ATC code as a prefix.

Return VMPs matching the given ATC code as a prefix.
sourceraw docstring

vpidsclj

(vpids conn id)

Return VMP ids for the given product.

Return VMP ids for the given product.
sourceraw docstring

vpids-for-apidsclj

(vpids-for-apids conn apids)

Return VPIDs for the given APIDs.

Return VPIDs for the given APIDs.
sourceraw docstring

vpids-for-vmppsclj

(vpids-for-vmpps conn vppids)
source

vpids-for-vtmidsclj

(vpids-for-vtmids conn vtmids)

Return VPIDs for the given VTMIDs.

Return VPIDs for the given VTMIDs.
sourceraw docstring

vpids-from-atcclj

(vpids-from-atc conn atc)

Return a vector of VPIDs matching the given ATC code/prefix.

Return a vector of VPIDs matching the given ATC code/prefix.
sourceraw docstring

vpids-from-atc-wo-vtmsclj

(vpids-from-atc-wo-vtms conn atc)

Return a vector of VPIDs matching the given ATC code/prefix that do not have an associated VTM. This is only useful when constructing SNOMED ECL expressions that use a combination of VTMs, VMPs and TFs, and therefore do not need VMPs unless there is no associated VTM.

Return a vector of VPIDs matching the given ATC code/prefix that do not
have an associated VTM. This is only useful when constructing SNOMED ECL
expressions that use a combination of VTMs, VMPs and TFs, and therefore do
not need VMPs unless there is no associated VTM.
sourceraw docstring

vppidsclj

(vppids conn id)

Return VMPP ids for the given product.

Return VMPP ids for the given product.
sourceraw docstring

vppids-for-appidsclj

(vppids-for-appids conn appids)
source

vppids-for-vpidsclj

(vppids-for-vpids conn vpids)
source

vtmidsclj

(vtmids conn id)

Return VTM ids for the given product.

Return VTM ids for the given product.
sourceraw docstring

vtmids-for-vpidsclj

(vtmids-for-vpids conn vpids)

Return VTMIDs for the given VPIDs.

Return VTMIDs for the given VPIDs.
sourceraw docstring

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

× close