LOINC subset expansion using FHIR endpoint

Hi,
I’m just trying to work out what the correct way is to subset by class in the compose of an expansion, but I’m finding some strange behaviour of the loinc endpoint: https://fhir.loinc.org
The International Patient Summary IG has a ValueSet implicitly defined in the compose like this…
I’ve left out the quite large exclusion section as it is irrelevant to this discussion.

  {
        "system" : "http://loinc.org",
        "filter" : [
          {
            "property" : "STATUS",
            "op" : "=",
            "value" : "ACTIVE"
          },
          {
            "property" : "CLASSTYPE",
            "op" : "=",
            "value" : "Laboratory class"
          }
        ]
      }

I think the IPS example is incorrect, because the LOINC properties defined in FHIR R4 are
CLASSTYPE string 1=Laboratory class; 2=Clinical class; 3=Claims attachments; 4=Surveys
So when I tried this corrected expansion against ontoserver, I correctly got an expansion containing laboratory class LOINC terms

**"contains"****: [**

**{**

**"system"****:** "http://loinc.org"**,**

**"code"****:** "14437-8"**,**

**"display"****:** "Albumin/Globulin [Mass Ratio] in Synovial fluid"

**},**

**{**

**"system"****:** "http://loinc.org"**,**

**"code"****:** "22249-7"**,**

**"display"****:** "Cytomegalovirus IgM Ab [Titer] in Serum or Plasma"

**},**

**{**

**"system"****:** "http://loinc.org"**,**

**"code"****:** "58765-9"**,**

**"display"****:** "Histone Ab [Presence] in Serum by Immunoassay"

**}**

**]**

etc…
When I run this against fhir.loinc.org I get a too costly error, which is also fine, but I would have expected that if I send a count parameter e.g. count=10, then it would short-circuit the API call and return the first 10 LOINC terms in the expansion, however, the loinc terminology server returns the too costly error again.

{
  "resourceType": "OperationOutcome",
  "issue": [ {
    "severity": "error",
    "code": "processing",
    "diagnostics": "HAPI-0831: Expansion of ValueSet produced too many codes (maximum 10) - Operation aborted! - ValueSet with URL \"Unidentified ValueSet\" was expanded using an in-memory expansion"
  } ]

My script (minus my personal credentials) is shown below:

#!/bin/sh
#ep='https://tx.ontoserver.csiro.au/fhir'
ep='https://fhir.loinc.org'
curl --user 'myself:mypassword' "${ep}/ValueSet/\$expand" \
--header 'Content-Type: application/fhir+json' \
--data '{
    "resourceType": "Parameters",
    "parameter": [
        {
            "name": "count",
            "valueInteger": 3
        },
        {
            "name": "valueSet",
            "resource": {
                "resourceType": "ValueSet",
                "compose": {
					"include" : [
						{
							"system" : "http://loinc.org",
							"filter" : [
							{
								"property" : "CLASSTYPE",
								"op" : "=",
								"value" : "1"
							}
							]
						}
					]
                }

            }
        }
    ]
}'
1 Like

Hi Michael,
I see there’s not been a response to your FHIR question. I will ping the Regenstrief LOINC & Health Data Standards team and see what can be answered.
Best regards,
Pam Banning
Lab LOINC Committee Chair

1 Like

Hi @osbornemj ,

My apologies for the delay, especially given the fact that I still do not have a solution to your issue. I have tried the same command as you, with many permutations including with count parameter and nothing seems to work. Our server is obviously struggling with this type of expansion.

Can you please point me to the full compose statement for the IPS that you mention? I’m wondering if we save this IPS ValueSet so that our server can pre-expand it. That may result in a better outcome.

Best,
Tim

Hi Tim,
With IPS 2 just around the corner, I want to re-raise this issue.
The full IPS ValueSet CLD is shown here:

The JIRA Issue that I raised against IPS is here: https://jira.hl7.org/browse/FHIR-48662
Thanks very much.
Michael Osborne

1 Like

Thank you for this, Michael. As we have seen, our current TX is unable to handle this as an intensionally designed value set.

Alternatively, we can create it as an extensional value set. We have the internal tooling to create this value set using an intensional definition (basically SQL) and push it to our TX as extensional. This pseudo-intensional value set would then be updated with each new version of LOINC. I realize this is not ideal, but would this be of value?

Thanks Tim,
My question was more to the point that is it valid from LOINC’s perspective to send the text string in the definition instead of the numeral…
So is it intended to allow this?

 {
            "property" : "CLASSTYPE",
            "op" : "=",
            "value" : "Laboratory class"
          }

or this (or both)

 {
            "property" : "CLASSTYPE",
            "op" : "=",
            "value" : "1"
          }

I think the issue here is really down to the FHIR LOINC page which defines the property as a String, but it looks like a code.

Tagging Daniel in - he might know the history.
@dvreeman

CLASSTYPE is only the numeric value. It is defined as a data element in our Knowledge Base:

CLASSTYPE

Type: Number
Width: N/A

1=Laboratory class; 2=Clinical class; 3=Claims attachments; 4=Surveys

I agree this should be clarified. It is terribly confusing how it is written/defined now for use in FHIR.

The good news (and to give this some closure), IPS have applied a fix to the Laboratory Results ValueSet to be published in IPS R2.

1 Like

Thanks for reporting back, Michael!