FHIR Chat · Comparing collections with subsetOf · fhirpath

Stream: fhirpath

Topic: Comparing collections with subsetOf


view this post on Zulip Corey Spears (Nov 10 2021 at 19:49):

I have a situation where I want to make sure I want the all of the values of one collection of elements be a subset of the collection of other values. It is working on https://hl7.github.io/fhirpath.js/ but not in the build.
Specifically I need to make sure all of the numbers in Explanation.supportingInfo.sequence (where supporting info has certain info in it) are included in the collection of ExplanationOfBenefit.item.informationSequence values.

Here is the example. I would expect [1, 2] to be a subset of [1, 2]
FHIRPath expression: supportingInfo.where(category.coding.code = 'additionalbodysite').sequence.subsetOf(item.informationSequence)
Stripped Resource:

{
  "resourceType" : "ExplanationOfBenefit",
  "supportingInfo" : [
    {
      "sequence" : 1,
      "category" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
            "code" : "additionalbodysite"
          }
        ]
      }
    },
    {
      "sequence" : 2,
      "category" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
            "code" : "additionalbodysite"
          }
        ]
      }
    }
  ],
  "item" : [
    {
      "sequence" : 1,
      "informationSequence" : [
        2
      ]
    },
    {
      "sequence" : 2,
      "informationSequence" : [
        1
      ]
    }
  ]
}

view this post on Zulip Lloyd McKenzie (Nov 13 2021 at 15:05):

@Grahame Grieve

view this post on Zulip Bryn Rhodes (Nov 13 2021 at 19:41):

Added a test case for this:

view this post on Zulip Bryn Rhodes (Nov 13 2021 at 19:41):

https://github.com/FHIR/fhir-test-cases/pull/100

view this post on Zulip Bryn Rhodes (Nov 13 2021 at 20:47):

I'm not able to debug though because the current master of org.hl7.fhir.core fails for me on package tests, not sure what's happening there.

view this post on Zulip Grahame Grieve (Nov 13 2021 at 20:48):

not failing for me. what's your error?

view this post on Zulip Bryn Rhodes (Nov 13 2021 at 21:01):

Hmm... testJavaHomeDirectory failed:

view this post on Zulip Bryn Rhodes (Nov 13 2021 at 21:01):

org.opentest4j.AssertionFailedError:
Expected :C:\Program Files\AdoptOpenJDK\jdk-11.0.5.10-openj9\test.txt
Actual :C:\Program Files\AdoptOpenJDK\jdk-11.0.5.10-openj9\\test.txt

view this post on Zulip Grahame Grieve (Dec 06 2021 at 03:31):

@David Otasek can you look into this?

@Bryn Rhodes what OS is this on?

view this post on Zulip David Otasek (Dec 06 2021 at 14:24):

I'll look into it. From the path, it looks to be triggered by Windows, but it would be good to have this confirmed. It also looks to be very similar to the MacOS test I fixed a few weeks ago, so the fix might be pretty easy.

view this post on Zulip David Otasek (Dec 06 2021 at 22:49):

Fix is in this PR: https://github.com/hapifhir/org.hl7.fhir.core/pull/683/

I'm waiting for the other PRs and builds to settle down, and then I'll merge.


Last updated: Apr 12 2022 at 19:14 UTC