Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify equivalent logic for conditional statements #1305

Open
brynrhodes opened this issue Dec 13, 2023 · 0 comments
Open

Verify equivalent logic for conditional statements #1305

brynrhodes opened this issue Dec 13, 2023 · 0 comments
Labels

Comments

@brynrhodes
Copy link
Member

The following rewrite of a function in QICoreCommon:

define function ToPrevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
else if (end of ToAbatementInterval(condition) is null) 
   then Interval[start of ToInterval(condition.onset), null)
   else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] 

resulted in different behavior than the equivalent formulation with a let:

define function ToPrevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
else
  (end of ToAbatementInterval(condition)) abatementDate
    return if abatementDate is null then
      Interval[start of ToInterval(condition.onset), abatementDate)
    else
      Interval[start of ToInterval(condition.onset), abatementDate]

This is related to the following CQLIT ticket: https://oncprojectracking.healthit.gov/support/browse/CQLIT-426

In theory, the above functions should behave exactly the same. Create a unit test to verify this for all the edges involved:

Condition.clinicalStatus as active and inactive
Condition.onset as a dateTime (null and non-null
Condition.onset as an Interval (null and non-null start and end dates)
Condition.abatement as a dateTime (null and non-null)
Condition.abatement as an Interval (null and non-null start and end dates)

@JPercival JPercival added the bug label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants