IHTSDO / snowstorm

Scalable SNOMED CT Terminology Server using Elasticsearch
Other
208 stars 83 forks source link

ValueSet $expand returning 0 expanded records #285

Closed dwnz1 closed 3 years ago

dwnz1 commented 3 years ago

Firstly, apologies as this is likely a lack of understanding on my part, but I can't see a better place to ask the question.

I'm new to Snowstorm and I've (battled, but got there eventually, after having to find workarounds for HTTP timeouts amongst other things which I can see previous people have also encountered) to deploy an instance using the Docker-compose to Azure ACI and got it running.

I'm now wanting to make a GET request to get an expanded set of all substance-code values, as per the ValueSet defined here: https://www.hl7.org/fhir/valueset-substance-code.json

I've used the FHIR API to upload the valueset json file, as /fhir/ValueSet/substance-code, and if I make a GET to the valueset, I get the json back exactly as per the above json. However, when I make a GET request to /fhir/ValueSet/substance-code/$expand, I get the ValueSet json back, but the expand element is "expansion":{"total":0,"offset":0}}.

I've tried other public FHIR APIs and compared the non-expanded response, and its the same, but on those servers, I can call $expand and get the expanded result set.

Is there a step I have missed in my Snowstorm instance? It has just had the Snomed International 2021 snapshot loaded, and I can otherwise query fine and get results as I'd expect, e.g. /fhir/ValueSet/$expand?url=http://snomed.info/sct?fhir_vs=ecl/<<27624003 returns "expansion":{"total":2449,"offset":0,"contains":..."

pgwilliams commented 3 years ago

Hi @dwnz1 thanks for your query here. It looks like I've taken a wrong (?) interpretation of the spec here in http://build.fhir.org/valueset-definitions.html#ValueSet.compose.include.filter where it says "If multiple filters are specified, they SHALL all be true." and I've taken that to mean logical AND.

You can see this in the logs where the ECL formed is explicitly stated: o.s.s.f.services.FHIRValueSetProvider : Recovered 0 Concepts from branch MAIN/2021-07-31 with ECL << 105590001 AND << 373873005.

Obviously a concept can't be both a substance and a product at the same time, which is why you're seeing 0 concepts. I'll change that to a logical OR now, since obviously that's the intention of that VS, and I'll bring it up for discussion at our next SNOMED on FHIR meeting to see if that line in the spec needs clarification. The filters cannot both be true at the same time, so I don't know what to make of the spec in that regard.

kaicode commented 3 years ago

Fixed in release 7.1.2.