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