• Icon: Bug/Issue Bug/Issue
    • Resolution: Won't Fix
    • Icon: Moderate Moderate
    • None
    • None
    • BONNIE

      The following ticket that has been going between the Cypress and CQM tracker. https://oncprojectracking.healthit.gov/support/browse/CYPRESS-1924

      This was brought to our attention by a vendor who noticed a calculation discrepancy with one of the Cypress test patients. The calculation discrepancy occurs at this logic expression in CMS145v8

      "Qualifying CAD Encounter" EncounterWithCADProxy
      	with ["Diagnosis": "Myocardial Infarction"] MyocardialInfarction
      		such that MyocardialInfarction.prevalencePeriod ends 3 years or less before day of start of EncounterWithCADProxy.relevantPeriod

      The test patient had a myocardial infarction that ended 08/20/2019 @11:41 and an encounter that began on 08/20/2019 @11:05.

      The vendor noticed that the diagnosis did not end the day before the encounter, but actually ended after the encounter began.

      Yesterday, we were able to track down the root cause of this discrepancy to the cql-execution library used by both the Cypress and Bonnie applications. The root cause is how cql-execution performs the CQL ‘Contains’ operation when dealing with an open interval (an open interval means that the boundary is not included when performing comparison). The logic above gets translated into the following:

      Is day of 08/20/2019 @11:41 in the Interval [08/20/2016 @11:05 - 08/20/2019 @11:05)?

      When performing the Contains operation, cql-execution transforms all intervals into closed intervals to simplify calculation. However, transformation does not take precision into account, so the Interval above is transformed into the following (note that the ending time has been moved forward a minute):

      [08/20/2016 @11:05 - 08/20/2019 @11:04]

      Since a ‘day’ precision is specified, the Contains operation evaluates the following:

      Is 08/20/2019 in the Interval [08/20/2016 - 08/20/2019]

      Which is incorrectly calculating to true.

      To fix this bug, the cql-execution code will need to be updated to evaluate open intervals as-is, instead of performing the transformation of into a closed interval.

            nicole_hunter Nicole Hunter
            dczulada David Czulada
            0 Vote for this issue
            4 Start watching this issue