Skip to content

Filter versioned references from _include or _revinclude bundles #2529

Open
@nickmcsimpson

Description

@nickmcsimpson

Question

  • How can outdated references be filtered from the result set of reference inclusion searches?
  • Is there a way to make include or revinclude version aware

Description

In our API implementation we building a bundle to include all the documents we need. This includes a primary document and a secondary reverse included Diagnostic Report document that contains the reference to the primary document (Service Request) in the based-on field. This reference (ex: ServiceRequest/123) works perfectly fine. However, since our dataset makes it difficult to reliably link existing Diagnostic Reports, if we need to update data we are creating a new DR and deprecating any old ones. This led us to updating this reference to include the last relevant 'version' to the end of the reference (ex: ServiceRequest/123/5 or ServiceRequest/123/_history/5).

The issue with 'deprecating' these documents like this is that the reference is still valid in the _revinclude search. We can work around this by filtering out the old references in our custom logic, but it seems like there could be a better way to approach this from the search or implementation standpoint. If the version is known, then the above or below attributes can be used to filter out older references; this does not work in our case, since our search doesn't know the version until after the bundle is returned.

We may need to approach this in a different way, or this may just not be supported. It would be nice to see a way to exclude these outdated references from the outset.

References
https://www.hl7.org/fhir/search.html#versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions