Skip to content

multicontext values for cli tool#652

Closed
Capt-Mac wants to merge 1 commit into
masterfrom
cql-cli-multi-context-values
Closed

multicontext values for cli tool#652
Capt-Mac wants to merge 1 commit into
masterfrom
cql-cli-multi-context-values

Conversation

@Capt-Mac

@Capt-Mac Capt-Mac commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

enhancement to CLI tool to allow multiple context values to be specified for expression evaluation

@Capt-Mac Capt-Mac requested a review from JPercival April 8, 2025 20:20
@Capt-Mac Capt-Mac self-assigned this Apr 8, 2025
@github-actions

github-actions Bot commented Apr 8, 2025

Copy link
Copy Markdown

Formatting check succeeded!

@sonarqubecloud

sonarqubecloud Bot commented Apr 8, 2025

Copy link
Copy Markdown

@codecov

codecov Bot commented Apr 8, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.95%. Comparing base (71a2c08) to head (086d9b3).
⚠️ Report is 96 commits behind head on master.

Files with missing lines Patch % Lines
...rg/opencds/cqf/fhir/cr/cli/command/CqlCommand.java 75.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #652      +/-   ##
============================================
- Coverage     70.95%   70.95%   -0.01%     
- Complexity      153      154       +1     
============================================
  Files           473      473              
  Lines         22189    22193       +4     
  Branches       2898     2899       +1     
============================================
+ Hits          15744    15746       +2     
- Misses         4990     4992       +2     
  Partials       1455     1455              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


@ArgGroup(multiplicity = "0..1", exclusive = false)
@ArgGroup(exclusive = false)
public ContextParameter context;

@brynrhodes brynrhodes Apr 8, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't the multiplicity change going to affect the cardinality of the context field? So this should be public List<ContextParameter> contexts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It currently reuses the singular context for each provided context-value. Wouldn't the cql file only have a single context?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If that's how the command option parameters work, then okay, it just seems like if the multiplicity is on the "context" element, then that's the thing that would end up needing to be able to be list-valued? Maybe I just don't understand how the command option parameters are working.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2025-04-09 at 9 04 19 AM

This should allow for behavior like this:
--context Patient --context-value id1 --context-value id2 --context-value id3

I confirmed this behavior with the unit test. You cannot add multiple contextName values

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we could add a second test where two contextNames are added which should cause a failure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, Bryn's right here. A given CQL library could have more than one context (some CQL in Encounter context, some in Patient) each of which would need to be set. We don't have a way to correlate across multiple contexts, so the name=value pairs are with respect to each Library evaluation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IOW, the CLI is currently set up to so that you parameterize one evaluation:

  • the library
  • the expressions
  • the parameters
  • the context parameters

It's not set up for multiple evaluations of a single library with different parameters.

I think this is a desirable behavior for this command. I think we need a new, different command with different semantics.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Either that or reorganize the arguments so that you specify the library/expression independently of the rest of the parameters.

@JPercival JPercival closed this Oct 7, 2025
@JPercival JPercival deleted the cql-cli-multi-context-values branch October 7, 2025 20:29
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