Uploaded image for project: 'CQL Issue Tracker'
  1. CQL Issue Tracker
  2. CQLIT-412

Calculation Issue with MedicationRequest

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • CQL-ELM Translator
    • None

      A calculation issue occurs when a filter is used for a MedicationRequest profile retrieval in QI-Core. The MedicationRequest resource cannot be found even though the test case JSON contains the MedicationRequest resource, relevant meta.profile and uses the medication element either as a CodeableConcept or referenced Medication resource. For example, when provided the following CQL and correct test case JSON, the case passes: 

      CQL

       

      exists ( 
        [MedicationRequest] ACEIOrARBOrARNIOrdered
          where (
            ( ACEIOrARBOrARNIOrdered.medication as Concept ) in "ACE Inhibitor or ARB or ARNI"
              or ( ACEIOrARBOrARNIOrdered.medication as Reference ).reference.getId() in ( [Medication: "ACE Inhibitor or ARB or ARNI"] ACEIOrARBOrARNI return ACEIOrARBOrARNI.id )
               )
            and ACEIOrARBOrARNIOrdered.isOrderedDuringHeartFailureOutpatientEncounter()
                 )

       

       

      However, when the CQL is updated to use the primary code path for the MedicationRequest, the test case that was passing now fails:

       

      updated CQL

       

      exists ( 
        [MedicationRequest: "ACE Inhibitor or ARB or ARNI"] ACEIOrARBOrARNIOrdered
          where ACEIOrARBOrARNIOrdered.isOrderedDuringHeartFailureOutpatientEncounter()
               ) 

       

      Based on a brief review of the QI-Core 4.1.1 Model Info file, I'm speculating that the issue is stemming from it. The primary code path for MedicationRequest is provided as 'medication', but medication is a choice type: 

      <typeInfo xsi:type="ClassInfo" baseType="QICore.DomainResource" namespace="QICore" name="MedicationRequest" identifier="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" label="MedicationRequest" retrievable="true" primaryCodePath="medication">
      .....
        <element name="medication" target="FHIRHelpers.ToValue(%value)" description="..." mustSupport="true">
           <elementTypeSpecifier xsi:type="ChoiceTypeSpecifier">
              <choice namespace="System" name="Concept" xsi:type="NamedTypeSpecifier"/>
              <choice namespace="QICore" name="Reference" xsi:type="NamedTypeSpecifier"/>
           </elementTypeSpecifier>
           <binding description="Prescribable medications" strength="Extensible"/>
        </element> 

       

       

       

       

       

       

       

        1. NUMERPass_NumerTest.json
          11 kB
          Stan Rankins
        2. image-2023-10-26-15-36-24-409.png
          28 kB
          Stan Rankins
        3. image-2023-10-26-15-26-18-120.png
          10 kB
          Stan Rankins
        4. image-2023-03-26-22-37-50-045.png
          138 kB
          Stan Rankins
        5. image-2023-03-26-22-16-46-048.png
          78 kB
          Stan Rankins
        6. image-2023-03-26-22-13-11-543.png
          83 kB
          Stan Rankins
        7. image-2023-03-26-22-11-47-513.png
          80 kB
          Stan Rankins

            bryn_rhodes Bryn Rhodes
            SRankins Stan Rankins
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: