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

Fix handling of function without library for Equal #322

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

lmd59
Copy link
Contributor

@lmd59 lmd59 commented Dec 6, 2024

Summary

CMS334 https://github.com/cqframework/ecqm-content-qicore-2024/tree/main/bundles/measure/CesareanBirthFHIR has an ELMFunctionRef without a libraryName that gets hit by interpretEqual. This makes interpretFunctionRef return an undefined which makes isOfTypeGracefulError choke.

I would prefer to fix this by making interpretFunctionRef return definitive types, but it looks like everywhere else (and now in interpretEqual) we do a check for undefined via a lovely == null check after it's called. So that's what we're doing here for now, but it would be nice to clean some of this up further in the future... should we add a ticket?
This PR also makes isOfTypeGracefulError a bit more robust.

New behavior

No longer breaks on CMS334.

Code changes

  • See summary

Testing guidance

  • npm run check
  • npm run cli -- dataRequirements -m {path2CMS334-VS.json} (I added valuesets to the measure locally, but you can also use the command line option to fetch valuesets during calculation)

Copy link

github-actions bot commented Dec 6, 2024

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
85.57% (-0.05% 🔻)
2456/2870
🟡 Branches
73.39% (-0.02% 🔻)
2311/3149
🟢 Functions 87.95% 438/498
🟢 Lines
85.85% (-0.06% 🔻)
2372/2763
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / GracefulError.ts
100%
80% (-20% 🔻)
100% 100%
🟢
... / QueryFilterParser.ts
86.42% (-0.33% 🔻)
80.77% (-0.21% 🔻)
97.62%
86.19% (-0.33% 🔻)

Test suite run success

459 tests passing in 31 suites.

Report generated by 🧪jest coverage report action from 1fc6393

@elsaperelli elsaperelli self-requested a review December 9, 2024 14:21
@elsaperelli elsaperelli self-assigned this Dec 9, 2024
Copy link
Contributor

@elsaperelli elsaperelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes make sense for now in order to successfully run CMS334. I think making a ticket to clean up the any return type and the propRef == null statements is a good idea.

Looks like it just needs a rebase!

Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a partial fix. The actual issue that causes the crash is in the interpretFunctionRef function. It could use an else part to handle the situation when it is a reference to a function in the same library. It should be returning a GracefulError like it does when the libraryName does exist and can't be determined what it does

@lmd59
Copy link
Contributor Author

lmd59 commented Dec 10, 2024

This is a partial fix. The actual issue that causes the crash is in the interpretFunctionRef function. It could use an else part to handle the situation when it is a reference to a function in the same library. It should be returning a GracefulError like it does when the libraryName does exist and can't be determined what it does

Yeah- that was what I was trying to say about interpretFunctionRef in the summary above. But this == null check is the way that we handle it for every other interpret* function. I think we should be consistent for now but make a ticket to overhaul interpretFunctionRef and the interpret* functions that call it so they're all handling it correctly (Note: this will probably involve a fair bit of unit test updates as well)

@hossenlopp hossenlopp merged commit 076086a into master Dec 10, 2024
6 checks passed
@hossenlopp hossenlopp deleted the graceful-funfail branch December 10, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants