Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition:entry _include not supported #4230

Open
CHelfgott opened this issue Jul 14, 2023 · 2 comments
Open

Composition:entry _include not supported #4230

CHelfgott opened this issue Jul 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@CHelfgott
Copy link

CHelfgott commented Jul 14, 2023

Describe the bug
I have a Composition with two layers of sections, and resources referenced in the "entry" field of the subsection:

   { 
      resourceType: "Composition",
      encounter: { type: "Encounter", reference: "Encounter/18950d5c0c9-1806ad9f-e7da-422c-be68-a08b3f5a6241" },
      ...,
      section: [
         { 
             title: "Section 1", 
             section: [
                { 
                    title: "Subsection 1A", 
                    entry: [
                        { type: "MedicationDispense", reference: "MedicationDispense/blah-blah-blah" },
                        { type: "MedicationAdministration", reference: "MedicationAdministration/blah-blah-blah" },
                    ], 
                }, 
                { 
                    title: "Subsection 1B", 
                    entry: [{ type: "QuestionnaireResponse", reference: "QuestionnaireResponse/blah-blah-blah" }], 
                },
             ],
          },
          {
             title: "Section 2", 
             section: [
                { 
                    title: "Subsection 2A", 
                    entry: [{ type: "Observation", reference: "Observation/blah-blah-blah" }], 
                },
             ],
          },
      ],
   }

I place a search call, attempting to retrieve the Composition and all associated entry resources.
curl -X 'GET' 'http://localhost:3001/fhir-server/api/v4/Composition?encounter=18950d5c0c9-1806ad9f-e7da-422c-be68-a08b3f5a6241&_include=Composition:entry&_include:iterate=AdverseEvent:substance&_include:iterate=MedicationAdministration:medication&_include:iterate=MedicationDispense:medication&_include:iterate=Medication:ingredient' -H 'accept: application/fhir+json'

The response is a Bundle with total: 1 containing only the Composition.

Environment
Which version of LinuxForHealth FHIR Server?
v4

To Reproduce
Create a Composition resource with nested sections and entry fields, attempt to retrieve all referenced entry resources using Composition search with an _include Composition:entry parameter.

Expected behavior
I expected all resources referenced in Composition.section.section.entry to be included in the search bundle.

@CHelfgott CHelfgott added the bug Something isn't working label Jul 14, 2023
@CHelfgott
Copy link
Author

CHelfgott commented Jul 14, 2023

I additionally tried filtering on the types of resources to be returned by e.g. Composition:entry:MedicationAdministration. No dice.
My suspicion, just from poking around the repo, is that the issue comes from
https://github.com/LinuxForHealth/FHIR/blob/main/conformance/fhir-core-r4/src/main/resources/hl7/fhir/core/401/package/SearchParameter-Composition-entry.json
where it defines

  "expression": "Composition.section.entry",
  "xpath": "f:Composition/f:section/f:entry",

My guess is that means the search parameter is only capturing the top-level sections of the Composition; given that Composition.section is explicitly recursive, this is probably not conformant.

Incidentally, I suspect this is an issue with other resources/search params with a recursive structure, such as Questionnaire:definition.

@CHelfgott
Copy link
Author

According to the current normative version of FHIRPath, the correct way of doing this is "expression": "Composition.repeat(section).entry".
Likewise with Questionnaire items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant