FHIR Chat · Run CQL Rule Retroactively · cql

Stream: cql

Topic: Run CQL Rule Retroactively


view this post on Zulip Rich Boyce (Feb 22 2021 at 16:35):

We are currently developing a process to rule a CQL rule over a date range in the past to determine which cards (if any) are returned on each individual day. We have figured out how to create prefetch data for a specific patient on a date in the past utilizing the "effective" and "authoredon" query parameters in the FHIR endpoint but we are wondering how we can essentially ignore a patient's medication history stored on a FHIR server when running the CQL rule. Do you know of any way of doing this in the CQF Ruler or in a CDS hook?

view this post on Zulip Bryn Rhodes (Feb 22 2021 at 18:09):

There is an "asOf" parameter to the engine that determines what the engine will return from the Now() and Today() functions. It hasn't been exposed though, so that would need to be something that's exposed through the layers in order to get that to run correctly.

view this post on Zulip Bryn Rhodes (Feb 22 2021 at 18:09):

The second part, of getting the data access layer to respect that, if you run the engine such that it only access the data provided as part of the prefetch, and you manage the data passed to the prefetch with parameters, that should work as expected.

view this post on Zulip Rich Boyce (Feb 22 2021 at 19:22):

Thank you for the quick response. I see how asOf() and Now() are implemented in the engine but where would I feasibly be able to modify the engine so that only the prefetch provided is the only data that is accessed?

view this post on Zulip JP (Feb 22 2021 at 19:38):

Hi Rich,

Considering only prefetch is not yet implemented in the ruler but conceptually you supply the cql-engine with a data provider that has only the prefetch data available. For example, you might create a Bundle with only the prefetch data and create a data provider that accesses only that. Under the covers that's how the Atom plugin works. It Bundles the appropriate resources in the testsdirectory and then uses this class:

https://github.com/DBCG/cql-evaluator/blob/master/evaluator.engine/src/main/java/org/opencds/cqf/cql/evaluator/engine/retrieve/BundleRetrieveProvider.java#L37


Last updated: Apr 12 2022 at 19:14 UTC