Stream: cql
Topic: Exclusion of Patients Based on Existence of Conditions
Michael Riley (Mar 23 2021 at 15:44):
What's the proper cql framwork for doing exclusionary relationships? For example, let's say I'm in a patient context, and I have a condition A, but I want to check for exclusionary symptoms B for at least 30 days before the condition. I was thinking of using the exists clause, but I'm not sure how to extend this into a population context easily.
Something like this
context Patient
define "exclusionexists":
[Condition: Code in "ConditionCodesA"] conditionA
with [Condition: Code in "ConditionCodesB"] conditionB
such that not conditionA.onset.start after 30 days conditionB.onset
return exists(conditionA)
Chris Moesel (Mar 23 2021 at 16:13):
I'm not sure if I'm understanding your question right, but it seems to me that you're probably close. Perhaps you're just looking to wrap the exists around the whole thing rather in a return
statement? E.g.,
context Patient
define "exclusionexists":
exists(
[Condition: "ConditionCodesA"] conditionA
without [Condition: "ConditionCodesB"] conditionB
such that
(conditionB.onset.value as DateTime) occurs 30 days or more before (conditionA.onset.value as DateTime)
)
Again, I don't know if this is what you're looking for, but maybe it helps point you in the right direction. It returns true only if there exists ConditionA without ConditionB onsetting 30 days or more before ConditionA. Note that, for simplicity, it assumes the onset is available as a DateTime -- so you'd need to do further modification to handle other onset types (like Period).
Michael Riley (Mar 23 2021 at 16:46):
Hey Chris, yes you got the right idea. So this seems like the right nugget, but the thing I'm stuggling with is turning this into a population context, I only want to find the Patients that do not match this exclusion. Maybe another definition like this
context Patient
define "exclusionexists":
exists(
[Condition: "ConditionCodesA"] conditionA
without [Condition: "ConditionCodesB"] conditionB
such that
(conditionB.onset.value as DateTime) occurs 30 days or more before (conditionA.onset.value as DateTime)
)
define "PatientResourceMaybe":
if exclusionexists
then
return null
else
return [Patient]
````
Now moving this into a population context seems tricky.
Bryn Rhodes (Mar 23 2021 at 16:50):
For quality measures specifically, the Quality Measure IG (and HQMF that it's based on, really) define a set of population criteria to standardize the expression of quality measures and facilitate evaluation. For each type of measure calculation, the IG provides the population level expression in CQL: http://build.fhir.org/ig/HL7/cqf-measures/measure-conformance.html#342-measure-population-semantics
Michael Riley (Mar 23 2021 at 17:04):
Ty Bryn so I think I got it. So I have a target condition, and a set of target exclusion conditions. In a population context, I could collect the exclusionary conditions if they exist, otherwise they would not exist.
If the exclusionary condition exists, return that one. Otherwise return the original condition. Then I could get metrics by checking the number of original conditions, vs the number of exclusionary conditions. So I would know what percentage of the population had an exclusion, and which exclusions were most prevalent.
Alexander Kiel (Mar 24 2021 at 13:35):
@Michael Riley Do you use a server that supports $evaluate-measure? If so you can stay in the Patient context and the server will return a MeasureReport containing the counts of the populations Bryn described.
Michael Riley (Mar 25 2021 at 16:01):
@Alexander Kiel No unfortunately, it's going to be a standalone cql-engine-fhir instance to talk to FHIR servers that just support clinical resources like Conditions and Procedures. There won't be any measure support in the EHR. But yeah that's a great solution.
Alexander Kiel (Mar 25 2021 at 16:06):
@Michael Riley I'm the lead developer of the open source FHIR Server Blaze which implements $evalueate-measure. Because I like to compile a list of other CQL engines, do you have a link to the solution you use?
Michael Riley (Apr 06 2021 at 20:43):
@Alexander Kiel sorry for the late response, we use a modified DBCG web service to run fhir based cql. https://github.com/DBCG/cql_execution_service
Last updated: Apr 12 2022 at 19:14 UTC