Search for LOINC codes with keywords using the FHIR REST API

Hello,
I’m trying to use the FHIR REST API to find a LOINC code containing a given keyword. A bit like SearchLOINC, but using the API directly.

For example I want to find a test result containing “calcium”:

According to the FHIR standard, this should work:
https://fhir.loinc.org/CodeSystem/_search?description:contains=calcium

But I get a “HAPI-1258: :contains modifier is disabled on this server”.

Any idea on how to to this ?

Cheers,

Antonio

Hello Antonio,

Actually, we quietly announced a new LOINC Search API at the end of last year. I would suggest using it for this purpose. This is the same API that runs SearchLOINC. The API is not yet documented. Here are the endpoints to use. Be sure to pass your LOINC username/password as authentication.

EndPoints - all of these endpoints search the scope specified and utilize the same parameters

https://loinc.regenstrief.org/searchapi/loincs
https://loinc.regenstrief.org/searchapi/answerlists
https://loinc.regenstrief.org/searchapi/parts
https://loinc.regenstrief.org/searchapi/groups

Parameters

  • query – search string
  • rows* – integer value to indicate the number of rows to return
  • offset* – integer value to indicate the offset, for paging
  • sortorder* – string value, specifying which field to sort on and order (desc and asc)
  • language* – integer value to indicate which language to return. The integer value for specific languages can be found in the LingusticVariants.csv file in the LOINC release.
  • includefiltercounts* – boolean value to indicate if information for filters should be returned with the results

*All of these parameters have default values and are optional

Example Queries

Without Optional Parameters
https://loinc.regenstrief.org/searchapi/loincs?query=glucose

With All Optional Parameters
https://loinc.regenstrief.org/searchapi/loincs?query=glucose&rows=100&offset=100&sortorder=loinc_num

Please report back any feedback you have on this as it is a new endeavor.

1 Like

Perfect, Thanks a lot Tim! It works well.

As finding the right code can be tricky, we will use this API to develop a help tool for the lab people to find the right code, directly in our LIS app.

-antonio

2 Likes