Conversation
…of a named parameter in a library. To be used by client projects that current use low-level CQL APIs to accomplish the same objective.
|
Formatting check succeeded! |
JPercival
approved these changes
Feb 10, 2026
| initializeEvalTime(evaluationDateTime) | ||
| state.init(library) | ||
| state.beginEvaluation() | ||
| try { |
Contributor
There was a problem hiding this comment.
nitpick:
return try {
....
whatever
}
catch
{
....
null
}
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1674 +/- ##
============================================
+ Coverage 65.89% 65.91% +0.01%
Complexity 1645 1645
============================================
Files 478 478
Lines 27641 27664 +23
Branches 5497 5499 +2
============================================
+ Hits 18215 18235 +20
- Misses 7098 7104 +6
+ Partials 2328 2325 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
This MR adds a new public API method
CqlEngine.resolveParameterDefault()that allows callers to resolve the CQL-defined default value of a named parameter without manipulating engine internals.CqlEngine.resolveParameterDefault(VersionedIdentifier, String, ZonedDateTime?): Any?method that resolves a library, finds the namedParameterDef, and evaluates itsdefaultexpression using the standard engine lifecycle (init/beginEvaluation/endEvaluation/exitLibrary), with proper error handling viaprocessException(). Returnsnullif the parameter has no default.State.kt-- the implementation reuses existing state lifecycle methods rather than introducing new low-level stack manipulation methods, consistent with the architecture established in commits23f71e39(evaluate API refactor) and2803f628(class name simplification).ResolveParameterDefaultTest(8 tests) exercising the measurement-period interval scenario, parameters without defaults, integer defaults,Now()evaluation with customevaluationDateTime, error cases, and state isolation betweenresolveParameterDefault()andevaluate()calls.Code Review Suggestions
state.init(library)(which assertsstack.isEmpty()) is safe in all realistic call sequences from clinical-reasoning. If clinical-reasoning ever callsresolveParameterDefaultwhile the engine state is not clean (e.g., mid-evaluation), the assertion will fail. Confirm the upstream caller (MeasureProcessorTimeUtils) always calls this before anyevaluate().environment.resolveLibrary(libraryIdentifier)which bypasses the multi-libraryloadAndValidate()path and its structured error collection. Confirm this is acceptable -- the assumption is the library is already compiled/loaded by the time a caller wants to inspect parameter defaults.evaluationVisitorproperty is@Deprecated. This method encapsulates its usage, but confirm no linting or Sonar rules will flag the internal usage (the clinical-reasoning side will drop its@SuppressWarningsonce migrated).state.endEvaluation()in thefinallyblock can throw ifbeginEvaluation()was not reached (e.g., ifstate.init(library)throws due to a failed assertion). If so, the cleanup infinallycould mask the original exception.