snowstorm
snowstorm copied to clipboard
Loading concepts with embedded definitions
Is it possible to search for concepts (/{branch}/concepts?term=searchTerm endpoint) and to embed definitions in returned concepts?
We have a use-case where we need to find concepts according to a search term and to display the first definition. Making subqueries to /{branch}/concepts/{conceptId}/descriptions would be inefficient and too slow for real-time use. We could also do the reverse query and search for descriptions and aggregate by concept. However, the /{branch}/concepts/{conceptId}/descriptions do not offer much flexibility as we need to use an ECL query to filter the result by parent.
Hi @DurandA, I'm very sorry no one got back to you about your query, I'm not sure how your question got missed.
It sounds like you would like to search SNOMED CT and filter the results by parent. Could I suggest that rather than fetching the definitions of the concept to do the filtering, I recommend using the Expression Constraint Language (ECL). This would allow you to specify a parent filter and text filter at the same time.
For example the ECL query <404684003 |Clinical finding| would filter for all the concepts that are a descendant of Clinical finding. In ECL the term between the pipes is optional so this ECL gives the same results: <404684003.
This can be used when searching concepts using the ecl parameter. For example: /{branch}/concepts?ecl=<404684003&termActive=true&term=searchTerm
I have also added the termActive parameter here so that no inactive descriptions are used in the search.
Also, rather than using the native Snowstorm API, it's possible to achieve the same thing using the standardised FHIR Terminology API: https://snowstorm.ihtsdotools.org/fhir/ValueSet/$expand?url=http://snomed.info/sct?fhir_vs=ecl/%3C404684003&filter=asthma
Does that help to answer your question?
Kind regards, Kai Kewley
Please note that the public Snowstorm server is for light use and testing purposes only. If you need a production instance please set up your own Snowstorm instance.