[MADIE-421] Expected Value Calculation Discrepency Created: 02/02/18  Updated: 05/08/18  Resolved: 02/20/18

Status: Closed
Project: MADiE Issue Tracker
Component/s: Test Case Builder
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Moderate
Reporter: Angela Flanagan Assignee: Unassigned
Resolution: Answered Votes: 0
Labels: CQL
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Microsoft Word Safe Use of Opioids Bonnie Values.docx     Zip Archive SafeUseofOpioidsConcurrent_v5_4.zip     Zip Archive SafeUseofOpioidsConcurrent_v5_4_Artifacts (1).zip    
Measure/Library Title: Safe Use of Opioids
CBE Number: 506
Test Case Name(s): NUMERPass, MultipleEncMedAtDisch

 Description   

Hello,
Unable to determine why this test case does not calculate the Expected Value as expected. Testing logic separately, measure seems to work correctly but adding multiple encounters results are unexpected. Please assist in determining the discrepancy.
Thank you,
Angela



 Comments   
Comment by Lizzie Charbonneau [ 02/20/18 ]

Hi Angela,

I'm going to go ahead and close this as it appears to be logic related and like the MAT team is handling it. Please let me know if you'd like me to re-open.

Best,
Lizzie

Comment by Angela Flanagan [ 02/14/18 ]

The MAT team is reviewing. Thanks.
2018-02-13 11:56:37 CST - Dawn Grey Additional comments
Angela,

This does not seem to be one of the usual suspects. I have forwarded the issue on to our development team to troubleshoot it. I will let you know more just as soon as I do.

Thanks,
Dawn Grey
Ref:MSG0888824

Comment by Lizzie Charbonneau [ 02/14/18 ]

Hi Angela,

We'll take a look at this. What are your thoughts on us transferring this ticket to CQLIT as it now seems to be about logic specification?

Thanks,
Lizzie

Comment by Angela Flanagan [ 02/12/18 ]

Hello Lizzie,
Entered the logic above and although no errors are reflected in the definitions, it will not package due to this message: Populations or Measure Observations within a measure grouping must contain valid definition or function. Message sent to MAT support but if you (Team) think of something that may resolve the issue please reach out.
Thank you,
Angela

Comment by Angela Flanagan [ 02/08/18 ]

Okay, loaded the version that triggers a failed test case today. The one loaded yesterday has no failed test cases.
Thank you

Comment by Lizzie Charbonneau [ 02/08/18 ]

Hi Angela,

One of the Bonnie developers, Chris Hossenlopp, wrote up the following, which seems to work. It uses a subquery returning a tuple. Included is the subquery, and then using the subquery in a sample IPP and NUMER definition.

define "Encounters With Opiates and Benzodiazepines":
  "Hospital Based Encounter with Age Greater than or Equal to 18" Encounter
  return Tuple {
    encounter: Encounter,
    opioidsAtDischarge: (["Medication, Discharge": "Schedule II and Schedule III Opioids"] OpioidsDischarge 
      where OpioidsDischarge.authorDatetime during Encounter.relevantPeriod),
    benzodiazepineAtDischarge: (["Medication, Discharge": "Benzodiazepines"] BenzodiazepineDischarge
      where BenzodiazepineDischarge.authorDatetime during Encounter.relevantPeriod),
    opioidsActive: (["Medication, Active": "Schedule II and Schedule III Opioids"] OpioidsActive
      where OpioidsActive.relevantPeriod starts before start Encounter.relevantPeriod
        and OpioidsActive.relevantPeriod overlaps after Encounter.relevantPeriod),
    benzodiazepineActive: (["Medication, Active": "Benzodiazepines"] BenzodiazepineActive
      where BenzodiazepineActive.relevantPeriod starts before start Encounter.relevantPeriod
        and BenzodiazepineActive.relevantPeriod overlaps after Encounter.relevantPeriod)
  }

define "Initial Population":
  "Encounters With Opiates and Benzodiazepines" EncounterWithMeds
    where exists (EncounterWithMeds.opioidsAtDischarge)
      or exists (EncounterWithMeds.benzodiazepineAtDischarge)
      or exists (EncounterWithMeds.opioidsActive)
      or exists (EncounterWithMeds.benzodiazepineActive)
    return EncounterWithMeds.encounter

define "Numerator":
  "Encounters With Opiates and Benzodiazepines" EncounterWithMeds
    where (Count (EncounterWithMeds.opioidsAtDischarge union EncounterWithMeds.opioidsActive) >= 2)
      or (exists (EncounterWithMeds.opioidsAtDischarge union EncounterWithMeds.opioidsActive) 
        and exists (EncounterWithMeds.benzodiazepineAtDischarge union EncounterWithMeds.benzodiazepineActive))
    return EncounterWithMeds.encounter

He believes there is likely a simpler way to represent this, and we'll post that once he's gotten a chance to draft it.

This example may be a good starting point to bring to ESAC, however, who would be better equipped to help out with these logic changes.

Thank you,
Lizzie

Comment by Lizzie Charbonneau [ 02/08/18 ]

Hi Angela,

Can you upload the version of the measure you had your original question with? That will help us with doing an comparison between the two.

Thank you,
Lizzie

Comment by Angela Flanagan [ 02/08/18 ]

Examples will be great. Thanks Lizzie.

I reloaded the previous version. All the test cases pass, maybe it would be best to revert back to that one? The reason for the last change was to condense the multiple numerator define statements. Can you double check the one that is loaded now to see if it is indeed calculating per encounter? I will also load the package. Thanks!

Comment by Lizzie Charbonneau [ 02/07/18 ]

Hi Angela,

The supporting logic for the numerator on this measure does not count opiates and benzodiazepines for each encounter individually. It is doing an overall count of the medications that were during the any of the encounters. Therefore it isn’t filtering out the episodes with insufficient counts.

There are a handful of ways this specific counting could be done in CQL. Most of these solutions would require a subquery or function.

A subquery could be used to retrieve specific medications during encounters for immediate counting or for later use.

A function could be written that takes the encounter as a parameter and queries the medications for ones during the provided encounter.

We are working on developing CQL examples, but it is probably worth getting ESAC involved as the CQL looks like it will be complicated and tricky.

Best,
Bonnie team

Comment by Angela Flanagan [ 02/07/18 ]

Hi Lizzie,
Is there any information that you can provide so that I can begin correcting the issue?
Thank you,

Comment by Lizzie Charbonneau [ 02/05/18 ]

Hi Angela,

This appears to be an issue with the measure logic. We are working on a more complete write-up to explain the issue in detail.

Best,
Lizzie

Comment by Chris Tohline (Inactive) [ 02/02/18 ]

Angela,

We will investigate this issue on Monday. Have a nice weekend.

Thanks,
--Chris

Generated at Sun Aug 31 08:15:29 UTC 2025 using Jira 10.3.8#10030008-sha1:cdaed80cecc964184c5b19b002388d56f96e274e.