# Accessing the LOINC Ontology from a FHIR Terminology Server

When working with the LOINC Ontology, leveraging a FHIR terminology server can simplify access and management. The server allows you to handle the content as a specific CodeSystem version, providing access to all FHIR Terminology operations.

## LOINC Extension FHIR URIsing <a href="#id-6.4.2accessingtheloincontologyfromafhirterminologyserver-loincextensionfhirurising" id="id-6.4.2accessingtheloincontologyfromafhirterminologyserver-loincextensionfhirurising"></a>

The SNOMED International URI standard specifies that identify unversioned editions (i.e. editions) and versioned editions (i.e. versions) take the following respective forms:

* `http://snomed.info/sct/{sctid}`
* `http://snomed.info/sct/{sctid}/version/{timestamp}`

These URIs apply to the 'version' element of codes and the 'URL' parameter in FHIR Operations. The 'system" element value is always '<http://snomed.info/sct>' for all SNOMED editions. For more information on the URI Specification, please refer to the [URI Standard](https://app.gitbook.com/o/h8Z6qGxuQrzM9vbx5bPT/s/kgrE9Yh9vMDqL5ThuXjH/) document.

### Examples <a href="#id-6.4.2accessingtheloincontologyfromafhirterminologyserver-examples" id="id-6.4.2accessingtheloincontologyfromafhirterminologyserver-examples"></a>

The following table shows some examples of URIs for editions and versions relevant when working with the LOINC Ontology.

| Resource                                  | URI                                                                                                                      |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| SNOMED CT International Edition           | <http://snomed.info/sct/900000000000207008>                                                                              |
| SNOMED CT International Edition, 20250101 | [http://snomed.info/sct/900000000000207008/version/20250101](http://snomed.info/sct/900000000000207008/version/20240731) |
| SNOMED CT-LOINC                           | <http://snomed.info/sct/11010000107>                                                                                     |
| SNOMED CT-LOINC, 31 March 2025            | <http://snomed.info/sct/11010000107/version/20250531>                                                                    |

## FHIR Operations <a href="#id-6.4.2accessingtheloincontologyfromafhirterminologyserver-fhiroperations" id="id-6.4.2accessingtheloincontologyfromafhirterminologyserver-fhiroperations"></a>

The following table lists a few key requests relevant for retrieving content from the LOINC Ontology using the FHIR Terminology services API.

| Service Name and Status                                                                                                                                                     | Input                                                                                                                                                                                                                    | Output                                                                                                     |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| **$lookup**                                                                                                                                                                 | A conceptId and a CodeSystem url                                                                                                                                                                                         | <ul><li>Concept metadata, including status, designations, etc.</li></ul>                                   |
| <p><strong>$expand</strong></p><p><strong>Get all members of the reference set</strong><br></p><p><strong>REQUIRED</strong><br></p>                                         | <ul><li>A reference set specified by its refsetId, in this case the identifiers for the set of Orderable and Observable LOINC Terms:</li></ul><p><a href="http://snomed.info/id/635111010000100">635111010000100</a></p> | LOINC Orderable Reference Set                                                                              |
| <p><strong>$validate-code</strong></p><p><strong>Test if a concept or description is a member of a specified reference set</strong></p><p><strong>REQUIRED</strong><br></p> | <ul><li>A reference set specified by its refsetId</li><li>A candidate <a href="http://concept.id">concept.id</a></li></ul>                                                                                               | <ul><li>If the candidate concept is a member of the reference set: TRUE</li><li>Otherwise: FALSE</li></ul> |

Please refer to the [SNOMED CT Terminology Services Guide](https://app.gitbook.com/o/h8Z6qGxuQrzM9vbx5bPT/s/t4wRQcj6gyQPunraJrP0/) for a comprehensive guidance on SNOMED CT enabled terminology services.

## Example FHIR Requests <a href="#id-6.4.2accessingtheloincontologyfromafhirterminologyserver-examplefhirrequests" id="id-6.4.2accessingtheloincontologyfromafhirterminologyserver-examplefhirrequests"></a>

These examples use the concept [635111010000100 |LOINC Orderable Reference Set|](http://snomed.info/id/635111010000100) as the refsetId.

<table data-full-width="true"><thead><tr><th width="131.484375">Service Name</th><th width="374.29296875">API Call</th><th>Result</th></tr></thead><tbody><tr><td><strong>Get concept metadata</strong></td><td><pre data-overflow="wrap"><code>GET fhir]/ValueSet/$expand
?url=http://snomed.info/sct?fhir_vs=refset/[refsetId]
&#x26;code=537131010000109
</code></pre></td><td>Returns a JSON representation of concept metadata</td></tr><tr><td><strong>Get all members of the reference set</strong></td><td><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$expand
?url=http://snomed.info/sct?fhir_vs=refset/[refsetId]
&#x26;count=10
</code></pre><p>for example</p><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$expand
?url=http%3A%2F%2Fsnomed.info%2Fsct%3Ffhir_vs%3Drefset%2F635111010000100&#x26;count=10
</code></pre><p>An alternative solution is to use the expression constraint language, as shown here:</p><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$expand
?url=http%3A%2F%2Fsnomed.info%2Fsct%3Ffhir_vs%3Decl%2F%5E%5B635111010000100%5D
&#x26;count=10
</code></pre><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$expand
?url=http%3A%2F%2Fsnomed.info%2Fsct%3Ffhir_vs%3Decl%2F%5E635111010000100&#x26;count=10
</code></pre></td><td><p>Returns a JSON representation of data about each of the reference set member.</p><p>The data returned for each concept includes:</p><ul><li><strong>code:</strong> the conceptId of the reference set member</li><li><strong>display:</strong> the preferred term for the reference set member</li></ul><p>Also returns the <strong>total</strong> number of reference set members</p><p>As some reference sets have very large numbers of children, this service is paged. Requests parameters include:</p><ul><li><strong>count</strong> to restrict the number of members returned.</li><li><strong>offset</strong> to specify the start in the results (in multiples of the limit).</li></ul></td></tr><tr><td><strong>Test if a concept is a member of the reference set</strong></td><td><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$validate-code
?system=http://snomed.info/sct&#x26;code=537131010000109 &#x26;url=http://snomed.info/sct/[moduleId]/version/[effectiveTime]?fhir_vs=refset/[refsetId]
</code></pre><p>for example</p><pre data-overflow="wrap"><code>GET [fhir]/ValueSet/$validate-code
?system=http://snomed.info/sct&#x26;code=537131010000109 &#x26;url=http://snomed.info/sct/900000000000207008/version/20200131?fhir_vs=refset/635111010000100
</code></pre></td><td>Returns a JSON object with a "Parameters" resource, including a "result" parameter with a boolean value (true/false) indicating whether the member validated OK or not against the reference set.</td></tr></tbody></table>

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=LOINC+Implementation+Guide&#x26;entry.670899847=6Accessing%20the%20LOINC%20Ontology%20from%20a%20FHIR%20Terminology%20Server" class="button primary">Provide Feedback</a>
