Store provides a store of SNOMED CT data with appropriate indices to permit fast lookup. It is currently implemented using two LMDB key value stores on the local filesystem.
Store provides a store of SNOMED CT data with appropriate indices to permit fast lookup. It is currently implemented using two LMDB key value stores on the local filesystem.
(all-children store concept-id)
(all-children store concept-id type-id)
Returns all child concepts for the concept. It takes 3500 milliseconds on my 2013 laptop to return all child concepts of the root SNOMED CT concept, so this should only be used for more granular concepts generally, or used asynchronously / via streaming.
Parameters:
concept-id
type-id
, defaults to 'IS-A' (116680003).Returns all child concepts for the concept. It takes 3500 milliseconds on my 2013 laptop to return all child concepts of the root SNOMED CT concept, so this should only be used for more granular concepts generally, or used asynchronously / via streaming. Parameters: - store - `concept-id` - `type-id`, defaults to 'IS-A' (116680003).
(all-parents store concept-id-or-ids)
(all-parents store concept-id-or-ids type-id)
Returns all parent concepts for the concept(s), including that concept or those concepts, by design. Parameters:
store
concept-id-or-ids
a concept identifier, or collection of identifierstype-id
, defaults to 'IS-A' (116680003).Returns all parent concepts for the concept(s), including that concept or those concepts, by design. Parameters: - `store` - `concept-id-or-ids` a concept identifier, or collection of identifiers - `type-id`, defaults to 'IS-A' (116680003).
(child-relationships-of-type store concept-id type-concept-id)
Returns a set of identifiers representing the parent relationships of the specified type of the specified concept.
Returns a set of identifiers representing the parent relationships of the specified type of the specified concept.
(description-refsets store description-id)
Get the refsets and language applicability for a description.
Returns a map containing:
Example:
(map #(merge % (description-refsets store (:id %)))
(concept-descriptions store 24700007))
Get the refsets and language applicability for a description. Returns a map containing: - refsets : a set of refsets to which this description is a member - preferredIn : refsets for which this description is preferred - acceptableIn : refsets for which this description is acceptable. Example: ``` (map #(merge % (description-refsets store (:id %))) (concept-descriptions store 24700007)) ```
(extended-concept store concept-id)
Get an extended concept for the concept specified.
Get an extended concept for the concept specified.
(extended-refset-item store
{:keys [refsetId] :as item}
&
{:keys [attr-ids?] :or {attr-ids? true}})
Merges a map of extended attributes to the specified reference set item. The attributes will be keyed based on information from the reference set descriptor information and known field names.
Merges a map of extended attributes to the specified reference set item. The attributes will be keyed based on information from the reference set descriptor information and known field names.
(fully-specified-name store concept-id)
(fully-specified-name store concept-id language-refset-ids fallback?)
Return the fully specified name for the concept specified. If no language preferences are provided the first
description of type FSN will be returned. If language preferences are provided, but there is no
match and fallback?
is true, then the first description of type FSN will be returned.
Return the fully specified name for the concept specified. If no language preferences are provided the first description of type FSN will be returned. If language preferences are provided, but there is no match *and* `fallback?` is true, then the first description of type FSN will be returned.
(history-profile st)
(history-profile st profile)
Return a sequence of reference set identifiers representing the history profile requested, or HISTORY-MAX, if not specified. See https://confluence.ihtsdotools.org/display/DOCECL/6.11+History+Supplements
Return a sequence of reference set identifiers representing the history profile requested, or HISTORY-MAX, if not specified. See https://confluence.ihtsdotools.org/display/DOCECL/6.11+History+Supplements
(leaves store concept-ids)
Returns the subset of the specified concept-ids
such that no member of the
subset is subsumed by another member.
Parameters:
Returns the subset of the specified `concept-ids` such that no member of the subset is subsumed by another member. Parameters: - concept-ids : a collection of concept identifiers
(parent-relationships store concept-id)
Returns a map of the parent relationships, with each value a set of identifiers representing the targets of each relationship. Returns a map: key: concept-id of the relationship type (e.g. identifier representing finding site) value: a set of concept identifiers for that property.
See get-parent-relationships-expanded
to get each target expanded via
transitive closure tables.
Returns a map of the parent relationships, with each value a set of identifiers representing the targets of each relationship. Returns a map: key: concept-id of the relationship type (e.g. identifier representing finding site) value: a set of concept identifiers for that property. See `get-parent-relationships-expanded` to get each target expanded via transitive closure tables.
(parent-relationships-expanded store concept-id)
(parent-relationships-expanded store concept-id type-id)
Returns a map of the parent relationships, with each value a set of identifiers representing the targets and their transitive closure tables. This makes it trivial to build queries that find all concepts with, for example, a common finding site at any level of granularity.
Returns a map of the parent relationships, with each value a set of identifiers representing the targets and their transitive closure tables. This makes it trivial to build queries that find all concepts with, for example, a common finding site at any level of granularity.
(parent-relationships-of-type store concept-id type-concept-id)
Returns a set of identifiers representing the parent relationships of the specified type of the specified concept.
Returns a set of identifiers representing the parent relationships of the specified type of the specified concept.
(parent-relationships-of-types store concept-id type-concept-ids)
(paths-to-root store concept-id)
Return a sequence of paths from the concept to root node. Each path is a sequence of identifiers, starting with the concept itself and ending with the root node. e.g.
(sort-by count (paths-to-root store 24700007))
result (truncated):
((24700007 414029004 64572001 404684003 138875005)
(24700007 6118003 80690008 362975008 64572001 404684003 138875005)
(24700007 39367000 23853001 246556002 118234003 404684003 138875005)
(24700007 6118003 80690008 23853001 246556002 118234003 404684003 138875005))
Return a sequence of paths from the concept to root node. Each path is a sequence of identifiers, starting with the concept itself and ending with the root node. e.g. ``` (sort-by count (paths-to-root store 24700007)) ``` result (truncated): ``` ((24700007 414029004 64572001 404684003 138875005) (24700007 6118003 80690008 362975008 64572001 404684003 138875005) (24700007 39367000 23853001 246556002 118234003 404684003 138875005) (24700007 6118003 80690008 23853001 246556002 118234003 404684003 138875005)) ```
(preferred-description store concept-id description-type-id language-refset-id)
Return the preferred description for the concept specified as defined by the language reference set specified for the description type.
Possible description-type-ids:
900000000000013009: synonym (core metadata concept)
900000000000003001: fully specified name
Example language-refset-ids:
900000000000509007: US English language reference set
999001261000000100: UK English (clinical) language reference set
Return the preferred description for the concept specified as defined by the language reference set specified for the description type. - store : - concept-id : - description-type-id : type of description (e.g. synonym or FSN) - language-refset-id : language reference set Possible description-type-ids: ``` 900000000000013009: synonym (core metadata concept) 900000000000003001: fully specified name ``` Example language-refset-ids: ``` 900000000000509007: US English language reference set 999001261000000100: UK English (clinical) language reference set ```
(preferred-fully-specified-name store concept-id language-refset-ids)
(preferred-synonym store concept-id language-refset-ids)
Returns the preferred synonym for the concept specified, looking in the language reference sets specified in order, returning the first 'preferred' value. The ordering of the reference set identifiers is therefore significant.
Notes: We have a frustrating situation in that there are three language reference sets in the UK that might give a 'good' answer to the 'preferred' description for any given concept. 900000000000508004 : Great Britain English language reference set 999001261000000100 : NHS realm language (clinical part) 999000691000001104 : NHS Realm language (pharmacy part) (supercedes the old dm+d realm subset 30001000001134). This means that we need to be able to submit multiple language reference set identifiers.
Returns the preferred synonym for the concept specified, looking in the language reference sets specified in order, returning the first 'preferred' value. The ordering of the reference set identifiers is therefore significant. - store : store - concept-id : concept-id - language-refset-ids : an ordered list of language reference set identifiers Notes: We have a frustrating situation in that there are three language reference sets in the UK that might give a 'good' answer to the 'preferred' description for any given concept. 900000000000508004 : Great Britain English language reference set 999001261000000100 : NHS realm language (clinical part) 999000691000001104 : NHS Realm language (pharmacy part) (supercedes the old dm+d realm subset 30001000001134). This means that we need to be able to submit *multiple* language reference set identifiers.
(properties store concept-id)
Returns a concept's properties, including concrete values. Ungrouped properties are returned under key '0', with other groups returned with non-zero keys. There is no other intrinsic meaning to the group identifier.
e.g. for lamotrigine:
(properties store 1231295007)
=>
{0 {116680003 #{779653004}, 411116001 #{385060002}, 763032000 #{732936001},
766939001 #{773862006}, 1142139005 #{"#1"}},
1 {732943007 #{387562000}, 732945000 #{258684004}, 732947008 #{732936001},
762949000 #{387562000}, 1142135004 #{"#250"}, 1142136003 #{"#1"}}}
See https://confluence.ihtsdotools.org/display/DOCRELFMT/4.2.3+Relationship+File+Specification "The relationshipGroup field is used to group relationships with the same sourceId field into one or more logical sets. A relationship with a relationshipGroup field value of '0' is considered not to be grouped. All relationships with the same sourceId and non-zero relationshipGroup are considered to be logically grouped.".
Note: All values are returned as sets. It is only through access to the MRCM that cardinality rules could be applied safely, but that requires support for ECL, which is not available at this low level of the library.
Returns a concept's properties, including concrete values. Ungrouped properties are returned under key '0', with other groups returned with non-zero keys. There is no other intrinsic meaning to the group identifier. e.g. for lamotrigine: ``` (properties store 1231295007) => {0 {116680003 #{779653004}, 411116001 #{385060002}, 763032000 #{732936001}, 766939001 #{773862006}, 1142139005 #{"#1"}}, 1 {732943007 #{387562000}, 732945000 #{258684004}, 732947008 #{732936001}, 762949000 #{387562000}, 1142135004 #{"#250"}, 1142136003 #{"#1"}}} ``` See https://confluence.ihtsdotools.org/display/DOCRELFMT/4.2.3+Relationship+File+Specification "The relationshipGroup field is used to group relationships with the same sourceId field into one or more logical sets. A relationship with a relationshipGroup field value of '0' is considered not to be grouped. All relationships with the same sourceId and non-zero relationshipGroup are considered to be logically grouped.". Note: All values are returned as sets. It is only through access to the MRCM that cardinality rules could be applied safely, but that requires support for ECL, which is not available at this low level of the library.
(properties-by-group store concept-id)
Returns a concept's properties as a map of group-id to a map of type-id to a set of target identifiers. Results do not include concrete values. e.g.
(properties-by-group store 24700007)
=>
{0 {116680003 #{6118003 414029004 39367000}},
1 {116676008 #{32693004}, 363698007 #{21483005}, 370135005 #{769247005}},
2 {116676008 #{409774005}, 363698007 #{21483005}, 370135005 #{769247005}}}
Returns a concept's properties as a map of group-id to a map of type-id to a set of target identifiers. Results do not include concrete values. e.g. ``` (properties-by-group store 24700007) => {0 {116680003 #{6118003 414029004 39367000}}, 1 {116676008 #{32693004}, 363698007 #{21483005}, 370135005 #{769247005}}, 2 {116676008 #{409774005}, 363698007 #{21483005}, 370135005 #{769247005}}} ```
(properties-by-type store concept-id)
Return a concept's properties as a map of type-id to a map of group-id to a set of target-ids. e.g.
(properties-by-type store 24700007)
=>
{116676008 {1 #{32693004}, 2 #{409774005}},
116680003 {0 #{6118003 414029004 39367000}},
363698007 {1 #{21483005}, 2 #{21483005}},
370135005 {1 #{769247005}, 2 #{769247005}}}
Return a concept's properties as a map of type-id to a map of group-id to a set of target-ids. e.g. ``` (properties-by-type store 24700007) => {116676008 {1 #{32693004}, 2 #{409774005}}, 116680003 {0 #{6118003 414029004 39367000}}, 363698007 {1 #{21483005}, 2 #{21483005}}, 370135005 {1 #{769247005}, 2 #{769247005}}} ```
(properties-expanded store concept-id)
Return all properties grouped by relationship group, with results containing concept identifiers expanded to include transitive relationships.
Return all properties grouped by relationship group, with results containing concept identifiers expanded to include transitive relationships.
(proximal-parent-ids store concept-id)
(proximal-parent-ids store concept-id type-concept-id)
Returns a sequence of identifiers for the proximal parents of the given type, defaulting to the 'IS-A' relationship if no type is given.
Returns a sequence of identifiers for the proximal parents of the given type, defaulting to the 'IS-A' relationship if no type is given.
(refset-counts store)
Returns a map of reference set counts keyed by type. This simply iterates over all stored items Example results from the UK distribution:
{com.eldrix.hermes.snomed.SimpleMapRefsetItem 508618, ;; ~4 %
com.eldrix.hermes.snomed.LanguageRefsetItem 5829820, ;; ~45 %
com.eldrix.hermes.snomed.ExtendedMapRefsetItem 1858024, ;; ~14 %
com.eldrix.hermes.snomed.SimpleRefsetItem 1972073, ;; ~15 %
com.eldrix.hermes.snomed.AttributeValueRefsetItem 1261587, ;; ~10 %
com.eldrix.hermes.snomed.AssociationRefsetItem 1263064, ;; ~10 %
com.eldrix.hermes.snomed.RefsetDescriptorRefsetItem 1131} ;; 0.01 %
```.
Returns a map of reference set counts keyed by type. This simply iterates over all stored items Example results from the UK distribution: ``` {com.eldrix.hermes.snomed.SimpleMapRefsetItem 508618, ;; ~4 % com.eldrix.hermes.snomed.LanguageRefsetItem 5829820, ;; ~45 % com.eldrix.hermes.snomed.ExtendedMapRefsetItem 1858024, ;; ~14 % com.eldrix.hermes.snomed.SimpleRefsetItem 1972073, ;; ~15 % com.eldrix.hermes.snomed.AttributeValueRefsetItem 1261587, ;; ~10 % com.eldrix.hermes.snomed.AssociationRefsetItem 1263064, ;; ~10 % com.eldrix.hermes.snomed.RefsetDescriptorRefsetItem 1131} ;; 0.01 % ```.
(refset-descriptor-attribute-ids store refset-id)
Return a vector of attribute description concept ids for the given reference set.
Return a vector of attribute description concept ids for the given reference set.
(reify-refset-item store item)
Reifies a refset item when possible, turning it into a concrete class. Suitable for use at import as long as refset descriptor refsets have already been imported.
Reifies a refset item when possible, turning it into a concrete class. Suitable for use at import as long as refset descriptor refsets have already been imported.
(release-information st)
Returns descriptions representing the installed distributions. Ordering will be by date except that the description for the 'core' module will always be first. See https://confluence.ihtsdotools.org/display/DOCTIG/4.1.+Root+and+top-level+Concepts
Returns descriptions representing the installed distributions. Ordering will be by date except that the description for the 'core' module will always be first. See https://confluence.ihtsdotools.org/display/DOCTIG/4.1.+Root+and+top-level+Concepts
(source-historical st component-id)
(source-historical st component-id refset-ids)
Return the requested historical associations for the component of types as defined by refset-ids, or all association refsets if omitted.
Return the requested historical associations for the component of types as defined by refset-ids, or all association refsets if omitted.
(transitive-synonyms store concept-id)
(transitive-synonyms store concept-id {:keys [include-inactive?]})
Returns all synonyms of the specified concept, including those of its descendants.
Returns all synonyms of the specified concept, including those of its descendants.
(with-historical st concept-ids)
(with-historical st concept-ids historical-refset-ids)
For a given sequence of concept identifiers, expand to include historical associations both backwards and forwards in time.
For a currently active concept, this will return historic inactivated concepts in which it is the target. For a now inactive concept, this will return the active associations and their historic associations.
By default, all active types of historical associations except MoveTo and MovedFrom are included, but this is configurable.
For a given sequence of concept identifiers, expand to include historical associations both backwards and forwards in time. For a currently active concept, this will return historic inactivated concepts in which it is the target. For a now inactive concept, this will return the active associations and their historic associations. By default, all active types of historical associations except MoveTo and MovedFrom are included, but this is configurable.
Write a batch of SNOMED components to the store. Returns nil. Parameters:
Write a batch of SNOMED components to the store. Returns nil. Parameters: - store - SNOMED CT store implementation - batch - a map containing :type, :headings and :data keys. The implementation will be chosen via the :type of the batch.
(write-batch-one-by-one store batch)
Write out a batch one item at a time.
Write out a batch one item at a time.
(write-batch-with-fallback store batch)
Write a batch of data to the store. If there is an error, the write is retried one-by-one so that the parsing error can be identified down to an individual item.
Write a batch of data to the store. If there is an error, the write is retried one-by-one so that the parsing error can be identified down to an individual item.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close