How EHR.Network terminology service APIs add SNOMED CT search & lookup in your Angular 9 EHR application
The EHR.Network terminology service APIs allow SNOMED CT coding to be implemented easily without any additional service or tools. You can read more about this service from here.
SNOMED CT is an ontological library that allows the coding of EHR data to make it semantically interoperable. You need a way to search SNOMED CT and provide a list of suitable terms to the users of your application. This will enable them to select the most suited term from the displayed SNOMED CT terms so that the application can code the data when saved into the EHR repository.
The requirement here is to allow the user to key in some characters and, based on the keyed-in value, display the matching results using this terminology service APIs. In this document, we explain about the API, input parameters required and output parameters that can be used by the applications to display the results.
Using Search API to retrieve matching terms from EHR.Network terminology service
The search API of the terminology service enables searching using words or combination of words to retrieve a matching list of SNOMED CT terms. It supports the following input parameters.
- semantictag – This parameter restricts search results to specific semantic area(s). Please visit https://gitlab.com/healthelife/ehr.network/ehrnetwork-developer-tools/-/tree/master/terminology%20service for a list of suitable semantictags for different requirements.
- term – The query string that is used for searching for matching concepts. Can include multiple strings separated by space. This is normally what the user types into the search field. When you use typeahead search, you can initiate the call to the API after 3 or 4 characters.
- returnLimit – Number of results to retrieve in one call. For most use cases 50 would bea good number to use. Using a large value can return large amount of data and slow down performance
- state – In EHR application context you should use ‘active’ option for this
- acceptability – This parameter is to let the SNOMED CT know what results to return. The commonly recommended options are ‘synonyms’ or ‘preferredexcludingfsn’. The first option returns all the available synonyms while the second option returns only the preferred terms.
- parentid – You can pass a SNOMED CT conceptid in this parameter to restrict the search to the hierarchy of terms below is. Normally you pass ‘null’ here
Sample code
JS file:
Sample javascript code that can be used to implement the search
$scope.search = function (item, semantictag) {
console.log("calling description " + item);
if (semantictag) {
$scope.semantictag = semantictag;
}
var baseUrl = 'https://terminology.ehr.network/csnoservNew'; // use appropriate terminology server URL
return $.ajax({
url: baseUrl + '/api/search/search?state=active&semantictag=' + $scope.semantictag
+ '&acceptability=preferredexcludingfsn&returnlimit=200&parentid=null',
method: "GET",
contentType: "application/json",
data: { term: item },
dataType: "jsonp",
crossDomain: true,
}).success(function (success) {
return success;
}).error(function (error) {
return error;
})
}
HTML:
Please visit https://sitepoint.com/creating-a-typeahead-widget-with-angularjs/ To understand the implementation of typeahead.
<input class="form-control input-sm" id="cause" name="cause" ng-model="allergy.substance" placeholder="Enter 3 characters to search"
uib-typeahead="state as state.term for state in search(allergy.substance,'finding')" typeahead-loading="loading" typeahead-no-results="noResults" typeahead-min-length="3" typeahead-wait-ms="300" required />
<i ng-show="loading" class="fa fa-spinner fa-spin"></i>
<div ng-show="noResults"><i class="fa fa-times"></i> No Terms Found</div>
Result data
[{
activeStatus: 1
caseSignificanceId: "CASE_INSENSITIVE"
conceptFsn: "Allotype (finding)"
conceptId: "1168007"
conceptState: "1"
definitionStatus: "900000000000074008"
effectiveTime: "Jul 31, 2017 5:30:00 AM"
hierachy: "finding"
id: "3053017"
isPreferredTerm: "1"
languageCode: "en"
moduleId: "900000000000207008"
term: "Allotype"
typeId: "SYNONYM”
},
{
activeStatus: 1
caseSignificanceId: "CASE_SENSITIVE"
conceptFsn: "Allo-erotism (finding)"
conceptId: "67793007"
conceptState: "1"
definitionStatus: "900000000000074008"
effectiveTime: "Jan 31, 2002 5:30:00 AM"
hierachy: "finding"
id: "112601016"
isPreferredTerm: "1"
languageCode: "en"
moduleId: "900000000000207008"
term: "Allo-erotism"
typeId: "SYNONYM"
}]
Binding data from the results
Display options in the UI
The array of values from ‘term’ key in the result JSON are used to create a list of options for the user to select from
Saving selection to the EHR
Once the user selects a term from the displayed list the term and corresponding conceptId are committed into the EHR. It is also a good practice to save the name of the terminology being used for coding. In this case it is ‘SNOMED CT’
- value – variable term is picked up and sent as value
- code – variable conceptId is used
- terminology – SNOMED CT
0 Comments