A SNOMED CT terminology service.
A SNOMED CT terminology service.
(active-association-targets svc component-id refset-id)
Return the active association targets for a given component.
Return the active association targets for a given component.
(all-children svc concept-id)
(all-children svc concept-id type-id)
Returns a set of concept ids of the children of the specified concept. By design, this includes the concept itself.
Returns a set of concept ids of the children of the specified concept. By design, this includes the concept itself.
(all-parents svc concept-id-or-ids)
(all-parents svc concept-id-or-ids type-id)
Returns a set of concept ids of the parents of the specified concept(s). By design, this includes the concept(s).
Returns a set of concept ids of the parents of the specified concept(s). By design, this includes the concept(s).
(are-any? svc concept-ids parent-ids)
Are any of the concept-ids subsumed by any of the parent-ids?
Checks the is-a relationships of the concepts in question against the set of parent identifiers.
Are any of the concept-ids subsumed by any of the parent-ids? Checks the is-a relationships of the concepts in question against the set of parent identifiers.
DEPRECATED: Use index
instead
DEPRECATED: Use [[index]] instead
DEPRECATED: Use index
instead
DEPRECATED: Use [[index]] instead
(child-relationships-of-type svc concept-id type-concept-id)
Returns a set of identifiers representing the child relationships of the specified type of the specified concept.
Returns a set of identifiers representing the child relationships of the specified type of the specified concept.
(component-refset-ids svc component-id)
Returns a collection of refset identifiers to which this concept is a member.
Returns a collection of refset identifiers to which this concept is a member.
(component-refset-items svc component-id)
(component-refset-items svc component-id refset-id)
Returns a sequence of refset items for the given component.
Returns a sequence of refset items for the given component.
(component-refset-items-extended svc component-id)
(component-refset-items-extended svc component-id refset-id)
Returns a sequence of refset items for the given component, supplemented with a map of extended attributes as defined by the refset descriptor
Returns a sequence of refset items for the given component, supplemented with a map of extended attributes as defined by the refset descriptor
(concept svc concept-id)
Return the concept with the specified identifier.
Return the concept with the specified identifier.
(concrete-values svc concept-id)
Returns a sequence of concrete values for the given concept.
Returns a sequence of concrete values for the given concept.
(create-service root import-from)
Create a terminology service combining both store and search functionality in a single step. It would be unusual to use this; usually each step would be performed interactively by an end-user.
Create a terminology service combining both store and search functionality in a single step. It would be unusual to use this; usually each step would be performed interactively by an end-user.
(description svc description-id)
Return the description with the specified identifier.
Return the description with the specified identifier.
(descriptions svc concept-id)
Return a sequence of descriptions for the given concept.
Return a sequence of descriptions for the given concept.
(ecl-contains? svc concept-ids ecl)
DEPRECATED: use intersect-ecl
instead.
Do any of the concept-ids satisfy the constraint expression specified? This is an alternative to expanding the valueset and then checking membership.
DEPRECATED: use [[intersect-ecl]] instead. Do any of the concept-ids satisfy the constraint expression specified? This is an alternative to expanding the valueset and then checking membership.
(expand-ecl svc ecl)
(expand-ecl svc ecl max-hits)
Expand an ECL expression. Results are ordered iff max-hits is specified.
It's usually more appropriate to use expand-ecl*
.
Expand an ECL expression. Results are ordered iff max-hits is specified. It's usually more appropriate to use [[expand-ecl*]].
(expand-ecl* svc ecl language-refset-ids)
Expand an ECL expression returning only preferred descriptions for the language reference set(s) specified.
Use match-locale
to determine a set of language reference set ids for a given 'Accept-Language' language range
as defined in RFC3066, or manually specify language reference set ids if required. In order to return a single
term per concept, use a single language reference set. Also see expand-ecl
and expand-ecl-historic
.
Expand an ECL expression returning only preferred descriptions for the language reference set(s) specified. Use [[match-locale]] to determine a set of language reference set ids for a given 'Accept-Language' language range as defined in RFC3066, or manually specify language reference set ids if required. In order to return a single term per concept, use a single language reference set. Also see [[expand-ecl]] and [[expand-ecl-historic]].
(expand-ecl-historic svc ecl)
Expand an ECL expression and include historic associations of the results, so that the results will include now inactive/deprecated concept identifiers.
Expand an ECL expression and include historic associations of the results, so that the results will include now inactive/deprecated concept identifiers.
(extended-concept svc concept-id)
Return an extended concept that includes the concept, and related data
such as descriptions, relationships, concrete values and reference set
memberships. See com.eldrix.hermes.snomed/ExtendedConcept
.
:concept
: the concept:descriptions
: a sequence of Description
items:parentRelationships
: a map of relationship type to a set of concept ids:directParentRelationships
: as per :parentRelationships but only proximal:concreteValues
: a sequence of ConcreteValue
items:refsets
: a set of reference set ids to which concept a memberReturn an extended concept that includes the concept, and related data such as descriptions, relationships, concrete values and reference set memberships. See `com.eldrix.hermes.snomed/ExtendedConcept`. - `:concept` : the concept - `:descriptions` : a sequence of `Description` items - `:parentRelationships` : a map of relationship type to a set of concept ids - `:directParentRelationships` : as per :parentRelationships but only proximal - `:concreteValues` : a sequence of `ConcreteValue` items - `:refsets` : a set of reference set ids to which concept a member
(extended-refset-item svc item)
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 svc concept-id)
(fully-specified-name svc concept-id language-range)
Return the fully specified name for the concept specified. If no language preferences are provided the database default locale will be used.
Return the fully specified name for the concept specified. If no language preferences are provided the database default locale will be used.
(get-reference-sets svc component-id)
DEPRECATED: use component-refset-items
instead.
DEPRECATED: use [[component-refset-items]] instead.
(get-status
root
&
{:keys [counts? installed-refsets? modules? log?]
:or {counts? false installed-refsets? true modules? false log? true}})
Backwards-compatible status report. Use status
instead. This flattens the
component counts at the top-level to mimic legacy deprecated behaviour.
Backwards-compatible status report. Use [[status]] instead. This flattens the component counts at the top-level to mimic legacy deprecated behaviour.
(historical-associations svc component-id)
Returns all historical-type associations for the specified component. Result is a map, keyed by the type of association (e.g. SAME-AS) and a sequence of reference set items for that association. Some concepts may be ambiguous and therefore map to multiple targets. Annoyingly, but understandably, the 'moved-to' reference set does not actually reference the new component - but the namespace to which it has moved - so for example an ancient International release may have accidentally including UK specific concepts - so they will have been removed. It is hoped that most MOVED-TO concepts will also have a SAME-AS or POSSIBLY-EQUIVALENT-TO historical association.
See https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.5.1+Historical+Association+Reference+Sets and https://confluence.ihtsdotools.org/display/editorialag/Component+Moved+Elsewhere
Note: Unlike some other functions that deal with historical associations, this returns the reference set items themselves and will include both active and inactive reference set items. Other functions usually only take into account active reference set items.
Returns all historical-type associations for the specified component. Result is a map, keyed by the type of association (e.g. SAME-AS) and a sequence of reference set items for that association. Some concepts may be ambiguous and therefore map to multiple targets. Annoyingly, but understandably, the 'moved-to' reference set does not actually reference the new component - but the namespace to which it has moved - so for example an ancient International release may have accidentally including UK specific concepts - so they will have been removed. It is hoped that most MOVED-TO concepts will also have a SAME-AS or POSSIBLY-EQUIVALENT-TO historical association. See https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.5.1+Historical+Association+Reference+Sets and https://confluence.ihtsdotools.org/display/editorialag/Component+Moved+Elsewhere Note: Unlike some other functions that deal with historical associations, this returns the reference set items themselves and will include both active *and* inactive reference set items. Other functions usually only take into account *active* reference set items.
(history-profile svc profile)
Returns a set of reference sets matching the named profile. Use in
conjunction with with-historical
:
(with-historical svc [24700007] (history-profile :HISTORY-MIN)
See https://confluence.ihtsdotools.org/display/DOCECL/6.11+History+Supplements
Returns a set of reference sets matching the named profile. Use in conjunction with [[with-historical]]: ``` (with-historical svc [24700007] (history-profile :HISTORY-MIN) ``` See https://confluence.ihtsdotools.org/display/DOCECL/6.11+History+Supplements
(import-snomed root dirs)
Import SNOMED distribution files from the directories dirs
specified into
the database directory root
specified.
Import is performed in three phases for each directory:
Interim indexing is necessary in order to ensure correct reification in subsequent import(s).
Import SNOMED distribution files from the directories `dirs` specified into the database directory `root` specified. Import is performed in three phases for each directory: 1. import of core components and essential metadata, and 2. interim indexing 3. import of non-core and extension files. Interim indexing is necessary in order to ensure correct reification in subsequent import(s).
(index root)
Build component and search indices for the database in directory 'root' specified.
Build component and search indices for the database in directory 'root' specified.
(installed-reference-sets svc)
Return a set of identifiers representing installed reference sets. Unlike simply using the SNOMED ontology to find all reference sets, this only returns reference sets with at least one installed member item.
Return a set of identifiers representing installed reference sets. Unlike simply using the SNOMED ontology to find all reference sets, this only returns reference sets with at least one installed member item.
(intersect-ecl svc concept-ids ecl)
Returns the subset of the concept identifiers that satisfy the SNOMED ECL
expression. Use intersect-ecl-fn
if the same ECL expression will be
used repeatedly.
Returns the subset of the concept identifiers that satisfy the SNOMED ECL expression. Use [[intersect-ecl-fn]] if the same ECL expression will be used repeatedly.
(intersect-ecl-fn svc ecl)
Return a function that can return the subset the specified concept identifiers that satisfy the SNOMED ECL expression.
Return a function that can return the subset the specified concept identifiers that satisfy the SNOMED ECL expression.
(map-concept-into svc concept-id target)
Returns a set of concept identifiers representing the result of mapping a
single concept into the target. For efficiency, it is almost always
better to use map-into
with a collection of identifiers, as the target
will be then determined only once for all identifiers to be processed.
Returns a set of concept identifiers representing the result of mapping a single concept into the target. For efficiency, it is almost always better to use [[map-into]] with a collection of identifiers, as the `target` will be then determined only once for all identifiers to be processed.
(map-features svc source-concept-ids target)
DEPRECATED: Use map-into
instead.
DEPRECATED: Use [[map-into]] instead.
(map-into svc source-concept-ids target)
Map the source-concept-ids into the target, usually in order to reduce the dimensionality of the dataset. Returns a sequence of sets of identifiers that are in the 'target'. The target can be a collection of identifiers, an ECL expression or, for convenience, an identifier representing a reference set. The latter two will be expanded into a set of identifiers.
Parameters:
svc
: hermes servicesource-concept-ids
: a collection of concept identifierstarget
: one of:
- a collection of concept identifiers
- an ECL expression
- a refset identifierIf a source concept id resolves to multiple concepts in the target collection, then a collection will be returned such that no member of the subset is subsumed by another member.
Callers will usually need to map any source concept identifiers into their
modern active replacements, if they are now inactive, as inactive source
concepts do not have relationships that can be used to perform map-into
.
The use of map-into
is in reducing the granularity of user-entered
data to aid analytics. For example, rather than limiting data entry to the UK
emergency reference set, a set of commonly seen diagnoses in emergency
departments in the UK, we can allow clinicians to enter highly specific,
granular terms, and map to the contents of that reference set as required
for analytics and reporting.
For example, '991411000000109' is the UK emergency unit diagnosis refset:
(map-into svc [24700007 763794005] 991411000000109)
=> (#{24700007} #{45170000})
As multiple sclerosis (24700007) is in the reference set, it is returned. However, LGI1-associated limbic encephalitis (763794005) is not in the reference set, the best terms are returned ("Encephalitis" - 45170000).
This can be used to do simple classification tasks - such as determining the broad types of illness. For example, here we use ECL to define a set to include 'neurological disease', 'respiratory disease' and 'infectious disease':
(map-into svc [24700007 763794005 95883001] "118940003 OR 50043002 OR 40733004")
=> (#{118940003} #{118940003} #{40733004 118940003})
Both multiple sclerosis and LGI-1 encephalitis are types of neurological disease (118940003). However, 'Bacterial meningitis' (95883001) is mapped to both 'neurological disease' (118940003) AND 'infectious disease' (40733004).
Map the source-concept-ids into the target, usually in order to reduce the dimensionality of the dataset. Returns a sequence of sets of identifiers that are in the 'target'. The target can be a collection of identifiers, an ECL expression or, for convenience, an identifier representing a reference set. The latter two will be expanded into a set of identifiers. Parameters: - `svc` : hermes service - `source-concept-ids` : a collection of concept identifiers - `target` : one of: - a collection of concept identifiers - an ECL expression - a refset identifier If a source concept id resolves to multiple concepts in the target collection, then a collection will be returned such that no member of the subset is subsumed by another member. Callers will usually need to map any source concept identifiers into their modern active replacements, if they are now inactive, as inactive source concepts do not have relationships that can be used to perform `map-into`. The use of `map-into` is in reducing the granularity of user-entered data to aid analytics. For example, rather than limiting data entry to the UK emergency reference set, a set of commonly seen diagnoses in emergency departments in the UK, we can allow clinicians to enter highly specific, granular terms, and map to the contents of that reference set as required for analytics and reporting. For example, '991411000000109' is the UK emergency unit diagnosis refset: ``` (map-into svc [24700007 763794005] 991411000000109) => (#{24700007} #{45170000}) ``` As multiple sclerosis (24700007) is in the reference set, it is returned. However, LGI1-associated limbic encephalitis (763794005) is not in the reference set, the best terms are returned ("Encephalitis" - 45170000). This can be used to do simple classification tasks - such as determining the broad types of illness. For example, here we use ECL to define a set to include 'neurological disease', 'respiratory disease' and 'infectious disease': ``` (map-into svc [24700007 763794005 95883001] "118940003 OR 50043002 OR 40733004") => (#{118940003} #{118940003} #{40733004 118940003}) ``` Both multiple sclerosis and LGI-1 encephalitis are types of neurological disease (118940003). However, 'Bacterial meningitis' (95883001) is mapped to both 'neurological disease' (118940003) AND 'infectious disease' (40733004).
(match-locale svc)
(match-locale svc language-range)
(match-locale svc language-range fallback?)
Return an ordered sequence of refset ids that are the best match for the required language range, or the database default.
language-range
should be a single string containing a list of
comma-separated language ranges or a list of language ranges in the form of
the "Accept-Language " header defined in RFC3066.
If the installed language reference sets are not matched by any of the
languages in the list, and fallback?
is true, then the database default
locale will be used. With no fallback, no reference set identifiers will be
returned, which may mean that locale-specific functions may return nil.
Return an ordered sequence of refset ids that are the best match for the required language range, or the database default. `language-range` should be a single string containing a list of comma-separated language ranges or a list of language ranges in the form of the "Accept-Language " header defined in RFC3066. If the installed language reference sets are not matched by any of the languages in the list, and `fallback?` is true, then the database default locale will be used. With no fallback, no reference set identifiers will be returned, which may mean that locale-specific functions may return nil.
(member-field svc refset-id field s)
Returns a set of referenced component identifiers that are members of the given reference set with a matching value 's' for the 'field' specified. For example, to perform a reverse map from ICD-10:
(member-field svc 447562003 "mapTarget" "G35")
Returns a set of referenced component identifiers that are members of the given reference set with a matching value 's' for the 'field' specified. For example, to perform a reverse map from ICD-10: ``` (member-field svc 447562003 "mapTarget" "G35") ```
(member-field-prefix svc refset-id field prefix)
Return a set of referenced component identifiers that are members of the given reference set with a matching 'prefix' for the 'field' specified. Example:
(member-field-prefix svc 447562003 "mapTarget" "G3")
Return a set of referenced component identifiers that are members of the given reference set with a matching 'prefix' for the 'field' specified. Example: ``` (member-field-prefix svc 447562003 "mapTarget" "G3") ```
(member-field-wildcard svc refset-id field s)
Return a set of referenced component identifiers that are members of the given reference set with a matching wildcard 'value' for the 'field' specified. Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character. '' is the escape character. Example:
(member-field-wildcard svc 447562003 "mapTarget" "G3?")
Return a set of referenced component identifiers that are members of the given reference set with a matching wildcard 'value' for the 'field' specified. Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character. '\' is the escape character. Example: ``` (member-field-wildcard svc 447562003 "mapTarget" "G3?") ```
(module-dependencies svc)
Returns a sequence of module dependencies, each item a map containing:
:source
: source of the dependency (a map of :moduleId, :version):target
: target on which the source depends (a map of :moduleId, :version):actual
: actual version; may be nil:valid
: is this dependency satisfied and consistent?Versions are represented as java.time.LocalDate
.
Dependencies are not transitive as per https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.4.2+Module+Dependency+Reference+Set
Returns a sequence of module dependencies, each item a map containing: - `:source` : source of the dependency (a map of :moduleId, :version) - `:target` : target on which the source depends (a map of :moduleId, :version) - `:actual` : actual version; may be nil - `:valid` : is this dependency satisfied and consistent? Versions are represented as `java.time.LocalDate`. Dependencies are not transitive as per https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.4.2+Module+Dependency+Reference+Set
(module-dependencies* items)
Given a collection of module dependency reference set items, return
transformed as :source
, :target
, :actual
and :valid
representing
module dependencies. Returns a sequence of:
:source
: source of the dependency (a map of :moduleId, :version):target
: target on which the source depends (a map of :moduleId, :version):actual
: actual version; may be nil:valid
: is this dependency satisfied and consistent?Versions are represented as java.time.LocalDate
.
Dependencies are not transitive as per https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.4.2+Module+Dependency+Reference+Set
Given a collection of module dependency reference set items, return transformed as `:source`, `:target`, `:actual` and `:valid` representing module dependencies. Returns a sequence of: - `:source` : source of the dependency (a map of :moduleId, :version) - `:target` : target on which the source depends (a map of :moduleId, :version) - `:actual` : actual version; may be nil - `:valid` : is this dependency satisfied and consistent? Versions are represented as `java.time.LocalDate`. Dependencies are not transitive as per https://confluence.ihtsdotools.org/display/DOCRELFMT/5.2.4.2+Module+Dependency+Reference+Set
(module-dependency-problems svc)
Returns a human-readable report of invalid dependencies and version mismatches.
Returns a human-readable report of invalid dependencies and version mismatches.
(mrcm-domains {:keys [store memberSearcher] :as svc})
Return a sequence of MRCM Domain reference set items for the given service. Each item essentially represents an 'MRCM domain'.
Return a sequence of MRCM Domain reference set items for the given service. Each item essentially represents an 'MRCM domain'.
(open root)
(open root {:keys [quiet default-locale] :or {quiet false}})
Open a (read-only) SNOMED service from root
, which should be anything
coercible to a java.io.File
. Use default-locale
to set the default
fallback locale for functions taking language preferences called without
explicit priority lists, or when installed language reference sets don't
support a requested language range.
Open a (read-only) SNOMED service from `root`, which should be anything coercible to a `java.io.File`. Use `default-locale` to set the default fallback locale for functions taking language preferences called without explicit priority lists, or when installed language reference sets don't support a requested language range.
(parent-relationships svc concept-id)
Returns a map of the parent relationships keyed by type.
Returns a map of the parent relationships keyed by type.
(parent-relationships-expanded svc concept-id)
(parent-relationships-expanded svc 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 svc 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.
(paths-to-root svc 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.
(paths-to-root svc 24700007)
=>
((24700007 6118003 80690008 23853001 118940003 362965005 64572001 404684003 138875005)
(24700007 6118003 80690008 23853001 246556002 404684003 138875005)
(24700007 6118003 80690008 362975008 64572001 404684003 138875005)
(24700007 39367000 23853001 118940003 362965005 64572001 404684003 138875005)
(24700007 39367000 23853001 246556002 404684003 138875005)
(24700007 39367000 363171009 362965005 64572001 404684003 138875005)
(24700007 39367000 363171009 363170005 128139000 64572001 404684003 138875005)
(24700007 414029004 64572001 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. ``` (paths-to-root svc 24700007) => ((24700007 6118003 80690008 23853001 118940003 362965005 64572001 404684003 138875005) (24700007 6118003 80690008 23853001 246556002 404684003 138875005) (24700007 6118003 80690008 362975008 64572001 404684003 138875005) (24700007 39367000 23853001 118940003 362965005 64572001 404684003 138875005) (24700007 39367000 23853001 246556002 404684003 138875005) (24700007 39367000 363171009 362965005 64572001 404684003 138875005) (24700007 39367000 363171009 363170005 128139000 64572001 404684003 138875005) (24700007 414029004 64572001 404684003 138875005)) ```
(pprint-properties svc props)
(pprint-properties svc props {:keys [key-fmt value-fmt fmt language-range]})
Pretty print properties. Keys and values can be formatted using fmt
or
separately using key-fmt
and value-fmt
. language-range
should be a
language range such as "en-GB". If language-range
is omitted, or does not
match any installed reference sets, the database default language range will
be used instead.
Valid formats are:
format | description |
---|---|
:map-id-syn | map of id to synonym |
:vec-id-syn | vector of id and synonym |
:str-id-syn | id and synonym as a string |
:syn | synonym |
:id | id |
For example,
(pprint-properties svc (properties svc 1231295007) {:fmt :vec-id-syn})
=>
{0 {[116680003 "Is a"] [[779653004 "Lamotrigine only product in oral dose form"]],
[411116001 "Has manufactured dose form"] [385060002 "Prolonged-release oral tablet"],
[763032000 "Has unit of presentation"] [732936001 "Tablet"],
[766939001 "Plays role"] [[773862006 "Anticonvulsant therapeutic role"]],
[1142139005 "Count of base of active ingredient"] "#1"},
1 {[732943007 "Has BoSS"] [387562000 "Lamotrigine"],
[732945000 "Has presentation strength numerator unit"] [258684004 "mg"],
[732947008 "Has presentation strength denominator unit"] [732936001 "Tablet"],
[762949000 "Has precise active ingredient"] [387562000 "Lamotrigine"],
[1142135004 "Has presentation strength numerator value"] "#250",
[1142136003 "Has presentation strength denominator value"] "#1"}}
Pretty print properties. Keys and values can be formatted using `fmt` or separately using `key-fmt` and `value-fmt`. `language-range` should be a language range such as "en-GB". If `language-range` is omitted, or does not match any installed reference sets, the database default language range will be used instead. Valid formats are: | format | description | |---------------|------------------------------| | `:map-id-syn` | map of id to synonym | | `:vec-id-syn` | vector of id and synonym | | `:str-id-syn` | id and synonym as a string | | `:syn` | synonym | | `:id` | id | For example, ``` (pprint-properties svc (properties svc 1231295007) {:fmt :vec-id-syn}) => {0 {[116680003 "Is a"] [[779653004 "Lamotrigine only product in oral dose form"]], [411116001 "Has manufactured dose form"] [385060002 "Prolonged-release oral tablet"], [763032000 "Has unit of presentation"] [732936001 "Tablet"], [766939001 "Plays role"] [[773862006 "Anticonvulsant therapeutic role"]], [1142139005 "Count of base of active ingredient"] "#1"}, 1 {[732943007 "Has BoSS"] [387562000 "Lamotrigine"], [732945000 "Has presentation strength numerator unit"] [258684004 "mg"], [732947008 "Has presentation strength denominator unit"] [732936001 "Tablet"], [762949000 "Has precise active ingredient"] [387562000 "Lamotrigine"], [1142135004 "Has presentation strength numerator value"] "#250", [1142136003 "Has presentation strength denominator value"] "#1"}} ```
(preferred-synonym svc concept-id)
(preferred-synonym svc concept-id language-range)
(preferred-synonym svc concept-id language-range fallback?)
Return the preferred synonym for the concept based on the language preferences specified.
Use match-locale
and then repeated calls to preferred-synonym*
if
preferred synonyms of a number of concepts are required (e.g. in a map/reduce etc).
Parameters:
svc
: hermes serviceconcept-id
: concept identifierlanguage-range
: a single string containing a list of comma-separated
language ranges or a list of language ranges in the form of
the "Accept-Language " header defined in RFC3066.fallback?
: whether to fall back to database default language.When fallback?
is true, there will always be a result for every concept.
Return the preferred synonym for the concept based on the language preferences specified. Use [[match-locale]] and then repeated calls to [[preferred-synonym*]] if preferred synonyms of a number of concepts are required (e.g. in a map/reduce etc). Parameters: - `svc` : hermes service - `concept-id` : concept identifier - `language-range` : a single string containing a list of comma-separated language ranges or a list of language ranges in the form of the "Accept-Language " header defined in RFC3066. - `fallback?` : whether to fall back to database default language. When `fallback?` is true, there will *always* be a result for every concept.
(preferred-synonym* svc concept-id language-refset-ids)
Given an ordered sequence of preferred language reference set ids, return the preferred synonym for the concept specified.
Given an ordered sequence of preferred language reference set ids, return the preferred synonym for the concept specified.
(properties svc concept-id)
(properties svc concept-id {:keys [expand]})
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.
Attribute values will be returned as a set of values optionally expanded to include the transitive relationships. If the value for the attribute is a concrete value or the SNOMED machine-readable concept model (MRCM) for the attribute in the context of the concept's domain states that the cardinality of the property is 0..1 or 1..1 and the values are not expanded to include transitive dependencies, the value will be unwrapped to a single value.
e.g. for lamotrigine:
(properties svc (properties svc 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."
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. Attribute values will be returned as a set of values optionally expanded to include the transitive relationships. If the value for the attribute is a concrete value or the SNOMED machine-readable concept model (MRCM) for the attribute in the context of the concept's domain states that the cardinality of the property is 0..1 or 1..1 and the values are not expanded to include transitive dependencies, the value will be unwrapped to a single value. e.g. for lamotrigine: ``` (properties svc (properties svc 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."
(ranked-search svc params)
A version of search
that performs a ranked search in which results are
returned that best match the tokens specified. Unlike the operation of
search
, in which no results would be returned if there is a token that
matches no results, ranked-search
simply scores from best to worst.
This function is most useful for finding best matches, while search
is best used for autocompletion. Unlike search
, this function returns
no results if there is no search string, or no tokens in the search string.
A version of [[search]] that performs a ranked search in which results are returned that best match the tokens specified. Unlike the operation of [[search]], in which no results would be returned if there is a token that matches no results, [[ranked-search]] simply scores from best to worst. This function is most useful for finding best matches, while [[search]] is best used for autocompletion. Unlike [[search]], this function returns no results if there is no search string, or no tokens in the search string.
(refset-descriptor-attribute-ids svc 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.
(refset-item svc uuid)
Return a specific refset item by UUID.
Return a specific refset item by UUID.
(refset-members svc refset-id & more)
Return a set of identifiers for the members of the given refset(s).
Parameters:
Return a set of identifiers for the members of the given refset(s). Parameters: - refset-id - SNOMED identifier representing the reference set.
(relationship svc relationship-id)
Return the relationship with the specified identifier.
Return the relationship with the specified identifier.
(release-information svc)
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
(reverse-map svc refset-id code)
Returns a sequence of reference set items representing the reverse mapping
from the reference set and mapTarget specified. It's almost always better to
use member-field
or member-field-prefix
directly.
A code in a target codesystem may map to multiple concepts. Each concept may
map to multiple codes in that target codesystem. reverse-map-prefix
returns
only results that would meet the original criteria. This mimics the original
behaviour of an older implementation and should be regarded as semi-deprecated.
For more control, use member-field
.
Returns a sequence of reference set items representing the reverse mapping from the reference set and mapTarget specified. It's almost always better to use [[member-field]] or [[member-field-prefix]] directly. A code in a target codesystem may map to multiple concepts. Each concept may map to multiple codes in that target codesystem. [[reverse-map-prefix]] returns only results that would meet the original criteria. This mimics the original behaviour of an older implementation and should be regarded as semi-deprecated. For more control, use [[member-field]].
(reverse-map-prefix svc refset-id prefix)
Returns a sequence of reference set items representing the reverse mapping
from the reference set and mapTarget. It is almost always better to use
member-field
or member-field-prefix
directly.
A code in a target codesystem may map to multiple concepts. Each concept may
map to multiple codes in that target codesystem. reverse-map-prefix
returns
only results that would meet the original criteria. This mimics the original
behaviour of an older implementation and should be regarded as semi-deprecated.
For more control, use member-field-prefix
.
Returns a sequence of reference set items representing the reverse mapping from the reference set and mapTarget. It is almost always better to use [[member-field]] or [[member-field-prefix]] directly. A code in a target codesystem may map to multiple concepts. Each concept may map to multiple codes in that target codesystem. `reverse-map-prefix` returns only results that would meet the original criteria. This mimics the original behaviour of an older implementation and should be regarded as semi-deprecated. For more control, use [[member-field-prefix]].
(search svc params)
Perform a search optimised for autocompletion against the index.
Parameters:
keyword | description |
---|---|
:s | search string |
:max-hits | maximum hits (see note below) |
:constraint | SNOMED ECL constraint |
:fuzzy | fuzziness (0-2, default 0) |
:fallback-fuzzy | if no results, try fuzzy search (0-2, default 0). |
:remove-duplicates? | remove duplicate results (default, false) |
:accept-language | locales for preferred synonyms in results |
`:language-refset-ids | languages for preferred synonyms in results |
If max-hits
is omitted, search will return unlimited unsorted results.
Example: to search for neurologist as an occupation ('IS-A' '14679004')
(search svc {:s "neurologist" :constraint "<14679004"})
For autocompletion, it is recommended to use fuzzy=0
, and fallback-fuzzy=2
.
There are some lower-level search parameters available, but it is usually more appropriate to use a SNOMED ECL constraint instead of these.
keyword | description |
---|---|
:query | additional Lucene Query to apply |
:show-fsn? | show FSNs in results? |
:inactive-concepts? | search descriptions of inactive concepts? |
:inactive-descriptions? | search inactive descriptions? |
:properties | a map of properties and their possible values. |
:concept-refsets | a collection of refset ids to limit search |
By default, :show-fsn?
and :inactive-concepts?
are false
, while
:inactive-descriptions?
is true
.
The properties map contains keys for a property and then either a single identifier or vector of identifiers to limit search. For example
(search svc {:s "neurologist" :properties {snomed/IsA [14679004]}})
However, concrete values are not supported, so to search using concrete values use a SNOMED ECL constraint instead.
A FSN is a fully-specified name and should generally be left out of search.
Perform a search optimised for autocompletion against the index. Parameters: - svc : hermes service - params : a map of search parameters, which include: | keyword | description | |-----------------------|---------------------------------------------------| | `:s` | search string | | `:max-hits` | maximum hits (see note below) | | `:constraint` | SNOMED ECL constraint | | `:fuzzy` | fuzziness (0-2, default 0) | | `:fallback-fuzzy` | if no results, try fuzzy search (0-2, default 0). | | `:remove-duplicates?` | remove duplicate results (default, false) | | `:accept-language` | locales for preferred synonyms in results | | `:language-refset-ids | languages for preferred synonyms in results | If `max-hits` is omitted, search will return unlimited *unsorted* results. Example: to search for neurologist as an occupation ('IS-A' '14679004') ``` (search svc {:s "neurologist" :constraint "<14679004"}) ``` For autocompletion, it is recommended to use `fuzzy=0`, and `fallback-fuzzy=2`. There are some lower-level search parameters available, but it is usually more appropriate to use a SNOMED ECL constraint instead of these. | keyword | description | |---------------------------|------------------------------------------------| | `:query` | additional Lucene `Query` to apply | | `:show-fsn?` | show FSNs in results? | | `:inactive-concepts?` | search descriptions of inactive concepts? | | `:inactive-descriptions?` | search inactive descriptions? | | `:properties` | a map of properties and their possible values. | | `:concept-refsets` | a collection of refset ids to limit search | By default, `:show-fsn?` and `:inactive-concepts?` are `false`, while `:inactive-descriptions?` is `true`. The properties map contains keys for a property and then either a single identifier or vector of identifiers to limit search. For example ``` (search svc {:s "neurologist" :properties {snomed/IsA [14679004]}}) ``` However, concrete values are not supported, so to search using concrete values use a SNOMED ECL constraint instead. A FSN is a fully-specified name and should generally be left out of search.
(search-concept-ids svc)
(search-concept-ids svc
{:keys [language-refset-ids accept-language language-range
fallback?]
:or {fallback? true}})
(search-concept-ids svc
{:keys [language-refset-ids accept-language language-range
fallback?]
:or {fallback? true}}
concept-ids)
Return search results containing the preferred descriptions of the concepts
specified. Returns a transducer if no concept ids are specified. If a
preferred description cannot be found for the locale specified, nil
will be
returned in the results unless fallback?
is true, in which case the default
fallback locale will be used.
Parameters: |- svc : service |- options : a map | |- :language-refset-ids | | A collection of reference set ids for the preferred language(s). |- |- :accept-language | | A single string containing a list of comma-separated language ranges | | or a list of language ranges in the form of the "Accept-Language" | | header as per RFC3066 | |- :fallback? (default true) | | Fallback to database default fallback locale if explicit language | | preference not available in installed reference sets |- concept-ids : a collection of concept identifiers.
For backwards compatibility, :language-range
can be used instead of
:accept-language
.
Return search results containing the preferred descriptions of the concepts specified. Returns a transducer if no concept ids are specified. If a preferred description cannot be found for the locale specified, `nil` will be returned in the results unless `fallback?` is true, in which case the default fallback locale will be used. Parameters: |- svc : service |- options : a map | |- :language-refset-ids | | A collection of reference set ids for the preferred language(s). |- |- :accept-language | | A single string containing a list of comma-separated language ranges | | or a list of language ranges in the form of the "Accept-Language" | | header as per RFC3066 | |- :fallback? (default true) | | Fallback to database default fallback locale if explicit language | | preference not available in installed reference sets |- concept-ids : a collection of concept identifiers. For backwards compatibility, `:language-range` can be used instead of `:accept-language`.
(some-indexed pred coll)
Returns index and first logical true value of (pred x) in coll, or nil.
e.g.
(some-indexed #{64572001} '(385093006 233604007 205237003 363169009 363170005 123946008 64572001 404684003 138875005))
returns: [6 664572001]
Returns index and first logical true value of (pred x) in coll, or nil. e.g. ``` (some-indexed #{64572001} '(385093006 233604007 205237003 363169009 363170005 123946008 64572001 404684003 138875005)) ``` returns: `[6 664572001]`
(source-historical svc component-id)
(source-historical svc 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.
(source-historical-associations svc component-id)
Returns all historical-type associations in which the specified component is
the target. For example, searching for 24700007
will result in a map keyed
by refset-id (e.g. SAME-AS
reference set) and a set of concept identifiers.
Returns all historical-type associations in which the specified component is the target. For example, searching for `24700007` will result in a map keyed by refset-id (e.g. `SAME-AS` reference set) and a set of concept identifiers.
(status root)
(status root {:keys [log?] :as opts})
Return status information for the database at 'root' where root
is
something coercible to java.io.File
. This is a convenience wrapper for
status*
that opens and closes the service for you.
Return status information for the database at 'root' where `root` is something coercible to `java.io.File`. This is a convenience wrapper for [[status*]] that opens and closes the service for you.
(status* svc
{:keys [counts? modules? installed-refsets?]
:or {counts? true installed-refsets? false modules? false}})
Return status information for the given service. Returns a map containing:
:releases
: a sequence of strings for installed distributions:locales
: installed/supported locales:components
: a map of component counts and indices:modules
: a map of module id to term, for installed modules:installed-refsets
: a map of reference set id to termWhat is returned is configurable using options:
:counts?
: whether to include counts of components:modules?
: whether to include installed modules:installed-refsets?
: whether to include installed reference setsReturn status information for the given service. Returns a map containing: - `:releases` : a sequence of strings for installed distributions - `:locales` : installed/supported locales - `:components` : a map of component counts and indices - `:modules` : a map of module id to term, for installed modules - `:installed-refsets` : a map of reference set id to term What is returned is configurable using options: - `:counts?` : whether to include counts of components - `:modules?` : whether to include installed modules - `:installed-refsets?` : whether to include installed reference sets
(stream-all-concepts svc ch)
(stream-all-concepts svc ch close?)
Streams all concepts on the channel specified. By default, closing the channel when done. Blocking, so run in a background thread.
Streams all concepts on the channel specified. By default, closing the channel when done. Blocking, so run in a background thread.
(subsumed-by? svc concept-id subsumer-concept-id)
Is concept-id
subsumed by subsumer-concept-id
?
Is `concept-id` subsumed by `subsumer-concept-id`?
(synonyms svc concept-id)
(synonyms svc concept-id language-refset-ids)
Returns a sequence of synonyms for the given concept. If language-refset-ids is provided, then only synonyms that are preferred or acceptable in those reference sets are returned.
Returns a sequence of synonyms for the given concept. If language-refset-ids is provided, then only synonyms that are preferred or acceptable in those reference sets are returned.
(transitive-synonyms svc params)
Returns all synonyms of the specified concepts, including those of its descendants.
Parameters:
svc : hermes service
params : search parameters to select concepts; one of:
- a map : search parameters as per [[search]]
- a string : a string containing an ECL expression
- a collection : a collection of concept identifiers
Returns all synonyms of the specified concepts, including those of its descendants. Parameters: - svc : hermes service - params : search parameters to select concepts; one of: - a map : search parameters as per [[search]] - a string : a string containing an ECL expression - a collection : a collection of concept identifiers
(valid-ecl? s)
Is the ECL valid? This does not attempt to expand the ECL, but simply checks that it is valid ECL according to the grammar.
Is the ECL valid? This does not attempt to expand the ECL, but simply checks that it is valid ECL according to the grammar.
(with-historical svc concept-ids)
(with-historical svc concept-ids 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 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 types of historical associations except MoveTo and MovedFrom are included, but this is configurable.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close