HAPI problems with code:in?

181 views
Skip to first unread message

John Silva

unread,
Sep 11, 2020, 5:48:43 PM9/11/20
to HAPI FHIR
This question has been asked on the Zulip FHIR hapi channel but thought that maybe it would be better to ask it here.

    https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Does.20HAPI.20support.20code.3Ain.20searches.3F. (in implementers channel)

The problem we've noticed is that the code:in=<ValueSet-Url> doesn't work in certain situations. 

So far we've tested it with ValueSets where the system value is SNOMED ( http://snomed.info/sct ) and LONIC ( http://loinc.org ) and neither of those work. 
However, strangely enough, it does work with ICD10 ( http://hl7.org/fhir/sid/icd-10 ) system.

Is this a know HAPI bug or are we not using this correctly?

   John

jasil...@gmail.com

unread,
Sep 14, 2020, 2:34:25 PM9/14/20
to HAPI FHIR
FYI,
  I'm attaching a ZIP file with 3 sample ValueSet's; one with LOINC, one with SNOMED and one with ICD-10 code systems.   I've also included a simple patient resource and 3 Condition resources that use the code value from the respective ValueSet's.

 Here's an example of the FHIR code:in search I'm using:

      {{hapi_url}}/Condition?patient=testVS&code:in=http://hook.md/ValueSet/SnomedVS

(and I do the same search for the three URLs, essentially the same with different suffix, e.g. LonicVS and Icd10VS)



John

James Agnew

unread,
Sep 15, 2020, 6:27:53 PM9/15/20
to jasil...@gmail.com, HAPI FHIR
Hi John,

I suspect the issue is probably just with the size of the expansion.

Code:in is easy to support if it's a small expansion (say, <1000 codes) but we don't currently implement this as a pure database-join so the generated SQL fails if the ValueSet expands to more codes than we can fit in an SQL IN(...) clause.

This is something we could revisit for sure - Back wehen code:in was implemented, we didn't have the precalculated expansions in HAPI FHIR so there was nothing in the DB to join to. We do have the expansions in the DB now, so it would be possible technically to go back and change how this is implemented..

Cheers,
James


--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/c5ccf5fb-8a81-4b7d-b2e5-3b4fd251ff33o%40googlegroups.com.

Robert Hausam

unread,
Sep 15, 2020, 10:15:18 PM9/15/20
to HAPI FHIR
James, most of the value sets that we have been working with are quite small (<10 codes, actually, since it's a demo application).  A part of the issue was that the needed codes weren't actually loaded and supported on the servers.  But after taking care of that by loading the needed terminology content, there are still issues.

I'm seeing and am generally able to reproduce some unexpected and seemingly rather odd behavior with servers on a couple of different HAPI versions (4.0.0 and 4.2.0 - but not 5.x yet).  Here are some example resources and responses:

HAPI 4.0.0

{
"resourceType": "CodeSystem",
"id": "snomed-test-2",
"name": "SNOMED CT",
"status": "active",
"content": "fragment",
"concept": [
{
"code": "161640005"
},
{
"code": "230461009"
}
]
}

{
"resourceType": "ValueSet",
"status": "active",
"name": "SnomedVStest2",
"id": "SnomedVStest2",
"title": "SnomedVS Valueset test 2",
"compose": {
"include": [
{
"concept": [
{
"code": "230461009"
}
]
}
]
}
}


With CodeSystem.content = "fragment", the $expand operation fails with "Unable to find code system http://hook.md/snomed-test-2".
If CodeSystem.content is updated to "example" (or "example" is updated to "fragment") there is no change. But if CodeSystem.content is then
further updated to "complete", the $expand operation succeeds (along with the other terminology dependent functions such as code:in). Then,
if CodeSystem.content is again updated back to either "fragment" or "example", the $expand operation and the other terminology functions
continue to succeed as they did before (while it was set to "complete").

HAPI 4.2.0

With HAPI 4.2.0, if the same API calls are performed as stated above, when the $expand operation is performed it is not successful and this is the result:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Failed to call access method: org.hibernate.search.exception.SearchException: HSEARCH000222: The SearchFactory was not initialized</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Failed to call access method: org.hibernate.search.exception.SearchException: HSEARCH000222: The SearchFactory was not initialized"
}
]
}

It will be great to get some further thoughts on what is going on here. I'm also intending to try this on a HAPI 5.1.0 instance, and I'll report back the results that I get with that.

Rob
To unsubscribe from this group and stop receiving emails from it, send an email to hapi...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi...@googlegroups.com.

Robert Hausam

unread,
Sep 16, 2020, 12:13:54 AM9/16/20
to HAPI FHIR
Well, I can happily report that all of this seems to be working correctly with HAPI 5.1.0!  Regardless of whether the CodeSystem is posted with CodeSystem.content as "fragment" or "complete" (and presumably "example", as well), both $expand and 'code:in' work correctly the first time (and with any subsequent changes that I tried).  I don't know what the issues are with the server instances of the earlier versions, but it's definitely good news that I can verify that it's working with the 5.1.0 release.

Rob

jasil...@gmail.com

unread,
Sep 18, 2020, 8:31:45 AM9/18/20
to HAPI FHIR
An update, we believe this works with HAPI 5.1.0 because the SNOMED CT and LOINC terminologies are already uploaded as part of the default configuration.

We tried to use the hapi-fhir-cli to upload the terminologies to one of our HAPI servers, which is not local (i.e. not on local file system) and the cli will not allow this.   James (or others), do you know if there is a way around this that would allow us to use the cli to upload a terminology to an existing HAPI server?  (happens to be 4.2.0)?   [Or do we have to get the source for the cli and modify it so that it allows us to do this?]

   Thanks,
      John
To unsubscribe from this group and stop receiving emails from it, send an email to hapi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages