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

(atc->ecl conn
          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. 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.

Convert an ATC code regexp 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.

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

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)
source

fetch-amp*clj

(fetch-amp* conn apid)
source

fetch-amppclj

(fetch-ampp conn appid)
source

fetch-ingredientclj

(fetch-ingredient conn isid)
source

fetch-lookupclj

(fetch-lookup conn lookup code)
source

fetch-productclj

(fetch-product conn id)
source

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)
source

fetch-vmp*clj

(fetch-vmp* conn vpid)
source

fetch-vmp-bnf-detailsclj

(fetch-vmp-bnf-details conn vpid)
source

fetch-vmp-control-drug-infoclj

(fetch-vmp-control-drug-info conn vpid)
source

fetch-vmp-drug-formclj

(fetch-vmp-drug-form conn vpid)
source

fetch-vmp-drug-routesclj

(fetch-vmp-drug-routes conn vpid)
source

fetch-vmp-ingredientsclj

(fetch-vmp-ingredients conn vpid)
source

fetch-vmp-ont-drug-formsclj

(fetch-vmp-ont-drug-forms conn vpid)
source

fetch-vmppclj

(fetch-vmpp conn vppid)
source

fetch-vmpp*clj

(fetch-vmpp* conn vppid)
source

fetch-vtmclj

source

fetch-vtm*clj

(fetch-vtm* conn vtmid)
source

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)
source

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)

Returns VPIDs for the given VTMIDs.

Returns 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)

Returns 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.

Returns 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