Stream: cql
Topic: Using between, period, and onset/abatement datetime for i...
Adam Rodriguez (Jun 04 2019 at 06:15):
Hi @Bryn Rhodes , @Chris Moesel et al.
Thank you again for all your (continued) help and guidance with my other recent posts. This new topic covers a third area in my cql exploration that I think will set me up to start drafting some experimental measures.
As mentioned in my other post about validating a code in a medicationRequest resource, my context is accessing FHIR data. I've also been referencing existing eCQMs based on the QDM for inspiration and am now attempting to write a FHIR equivalent retrieve for a case that has a temporal relationship between resources. (I'll also be looking at the other resources that I realized you sent me on the other topic while I was drafting this new post).
Here's a generic relational retrieve in QDM:
Define “Patient Encounter”:
[Encounter, Performed: “encounterValueSet”] patientEncounter
Define “Encounter with Diagnosis”:
“Patient Encounter” patientEncounter
with [Diagnosis: “diagnosisValueSet”] patientDiagnosis
such that patientDiagnosis.prevalencePeriod overlaps patientEncounter.relevantPeriod
Using (http://hl7.org/fhir/us/qicore/2018Jan/qdm-to-qicore.html), it looks like:
Diagnosis: Prevalence Period
maps to Condition.onset[x]
and Condition.abatement[x]
and
Encounter, Performed: Relevant Period
maps to Encounter.period
and
Encounter, Performed: Code
maps to Encounter.class
Since the prevalence period for Diagnosis seems to be broken up into two data “pieces” in FHIR, and it is to be compared to a period with implied start/end datetimes, I’d like to know if the following retrieve could be considered the FHIR equivalent to the generic QDM example:
Define “Patient Encounter”:
[Encounter] patientEncounter
where patientEncounter.class in “encounterValueSet”
Define “Patient Diagnosis”:
[Condition] patientCondition
where patientCondition.code in “conditionValueSet”
Define “Encounter with Diagnosis”
“Patient Encounter” patientEncounter
with “patientCondition” patientCondition
such that patientEncounter.period overlaps between patientCondition.onsetDateTime and patientCondition.abatementDateTime
In my attempt to write the FHIR equivalent relational retrieve, I thought maybe the between
comparison operator seemed appropriate. I also assumed it was better for me to define the "Patient Diagnosis"
retrieve here since I wasn't sure how this part would be written in the "Encounter with Diagnosis"
the same way it was done in the QDM example.
Hoping you all can help confirm if these assumptions are correct or if there is a better method to use when two discrete datetimes are to be compared to a period (or even when two discrete datetimes are compared against two other discrete datetimes when an overlap or other interval comparison is needed).
As always, many many thanks!
Last updated: Apr 12 2022 at 19:14 UTC