FHIR Chat · Dates in prefetch URLs · cds hooks

Stream: cds hooks

Topic: Dates in prefetch URLs


view this post on Zulip Jorge de la Garza (Jun 10 2021 at 16:01):

Hi, I have a CDS Hooks server that allows authors of services to specify relative dates in the FHIR queries utilized by that service. For example, "Get all instances of a certain lab that the patient has had in the last 6 months..." or "Get all inpatient encounters the patient has had in the last 30 days". When a client invokes a service and doesn't prefetch resources, my server can substitute these relative date expressions with an actual date. The issue is that in the discovery response, I'm not aware of any way to specify a relative date in the prefetch URLs, and if I replace the relative date expressions with actual dates at the time discovery response is generated, then if the client caches the services in the discovery response, those prefetch URLs will grow "stale" over time.

Any idea how to handle this? Should servers avoid using date parameters in prefetch URLs? Should clients always hit the discovery endpoint before invoking a service to make sure prefetch URLs are fresh? Perhaps there could be a supported syntax to specify a relative date in prefetch URLs?

view this post on Zulip Josh Mandel (Jun 10 2021 at 19:28):

This is a great use case; agreed it could be done through an enhancement to the prefetch syntax. (http://hl7.org/fhirpath/#subtraction-2 provides a standard and a syntax that we could embed if we wanted this.)

view this post on Zulip Jorge de la Garza (Jun 11 2021 at 14:32):

Thanks @Josh Mandel. Should I enter this issue in Github or Jira or what is the process for this?

view this post on Zulip Josh Mandel (Jun 11 2021 at 14:34):

Starting with discussion here to judge interest seems like the right first step.

view this post on Zulip Brian Postlethwaite (Jun 12 2021 at 21:09):

Doesn't fhirpath have something similar for fhirpath query?
Where you can use {{today() - 6 month}}

view this post on Zulip Josh Mandel (Jun 13 2021 at 03:54):

Indeed! (This is what I linked to in my post above.)

view this post on Zulip Aziz Boxwala (Jun 28 2021 at 22:47):

We have a similar need for specifying relative date expressions in our prefetch template. +1 for this request @Jorge de la Garza and the proposed approach.

view this post on Zulip Isaac Vetter (Sep 22 2021 at 17:19):

Why wouldn't this be a change to the FHIR search parameters, instead of just CDS Hooks?

view this post on Zulip Lloyd McKenzie (Sep 22 2021 at 19:27):

You could take a look at the x-fhir-query specification currently defined in the SDC IG. We could possibly migrate this into R5 if there was a desire to use it outside SDC.

view this post on Zulip Isaac Vetter (Sep 22 2021 at 19:56):

That's neat. We'd need to either change the current prefetch tokens to be valid FHIRpath, or change our {{ }} delimiters.


Last updated: Apr 12 2022 at 19:14 UTC