Conversation
…teger`, `Long`, `Decimal`, `String`, and `List` classes) (#1751) * Sealed class hierarchy for CQL types * Sealed Value interface for CQL values * Cleanup
|
Formatting check succeeded! |
Initial implementation of FHIR model resolver in JS. JS-export CQL value classes, CQL type classes. Type hints for expression results.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1755 +/- ##
============================================
+ Coverage 68.55% 68.74% +0.19%
+ Complexity 1761 1699 -62
============================================
Files 532 536 +4
Lines 30836 30568 -268
Branches 6954 6990 +36
============================================
- Hits 21139 21015 -124
+ Misses 7213 6997 -216
- Partials 2484 2556 +72 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # Src/java/elm-fhir/src/main/kotlin/org/cqframework/cql/elm/requirements/fhir/utilities/constants/CqfConstants.kt # Src/java/elm-fhir/src/test/kotlin/org/cqframework/cql/elm/requirements/fhir/DataRequirementsProcessorTest.kt # Src/java/engine/src/commonMain/kotlin/org/opencds/cqf/cql/engine/elm/executing/FlattenEvaluator.kt # Src/java/engine/src/commonMain/kotlin/org/opencds/cqf/cql/engine/elm/executing/QueryEvaluator.kt # Src/java/engine/src/jvmTest/kotlin/org/opencds/cqf/cql/engine/execution/ListOperatorsTest.kt
|
# Conflicts: # Src/java/engine/src/commonMain/kotlin/org/opencds/cqf/cql/engine/elm/executing/DurationBetweenEvaluator.kt
…#1787) v5 migration guide
Related IssuesThe following open issues may be related to this PR:
|
# Conflicts: # Src/java/engine/src/commonMain/kotlin/org/opencds/cqf/cql/engine/execution/EvaluationVisitor.kt # Src/java/engine/src/commonMain/kotlin/org/opencds/cqf/cql/engine/execution/State.kt
c-schuler
left a comment
There was a problem hiding this comment.
Really nice work! I really only have some small nits. I noted one of them in the EquivalentEvaluator and another is below.
The EqualEvaluator, EquivalentEvaluator, the four comparison evaluators (Greater/Less/…), and the binary-arithmetic evaluators each repeat a long when/is ladder over the same set of Value subtypes, differing only in the operation. Adding a new Value type requires editing ~10+ files. The new sealed hierarchy is exactly the structure that would let this move to polymorphic methods on Value (e.g. compareTo, equalTo). Not a blocker, but the refactor stopped one level short of the payoff it sets up.
|
Hi @c-schuler thank you! At this stage, I think it's OK to keep the |


This PR includes multiple changes set to be released in v5. The changes are further documented in the v4 to v5 migration guide included in the PR.
Changes to CQL value classes (#1775, ADR 005)
Valueinterface.Boolean,Integer,Long,Decimal,String, andListfrom theorg.opencds.cqf.cql.engine.runtimepackage are used intead ofkotlin.Boolean,kotlin.Int,kotlin.Long,BigDecimal,kotlin.String, andkotlin.collections.Iterable<kotlin.Any?>.Value.toString()returns the CVL representation of the CQL value (seeValue.toString()returns the CVL representation of the CQL value #1782).FhirTypeConverter, and related tests are updated accordingly to useValue?instead ofkotlin.Any?.New
ClassInstanceclass for CQL class instances, changes toModelResolver, Java platform independenceFHIR.Patient,FHIR.string, etc.) are now represented in the engine asClassInstances (and not as e.g., HAPI FHIR structures). Informally, aClassInstanceis a structured value (Tuple) with aQNametype tag like{http://hl7.org/fhir}Patient. As a result:resolvePath(),as(),setValue(),objectEqual(),resolveType()are no longer needed in theModelResolverinterface.Class<T>references are replaced with type specifiers and type QNames (both multiplatform) in the engine. As a result:packageName(s)is no longer needed inModelResolverandis(value: Any?, type: Class<*>?): Boolean?changed tois(valueType: String, type: QName): Boolean?,Interval[1,2] is Interval<Integer>returns true andInterval[1,2] is Interval<Time>returns false,Additional changes, fixes, improvements
FhirModelResolver : ModelResolver, theis(valueType: String, type: QName): Boolean?method now returnstrueonly if{http://hl7.org/fhir}_valueType_extendstypeor is the same astype. As a result, expressions likeFHIR.integer { ... } is FHIR.positiveIntandFHIR.Quantity { ... } is FHIR.Agereturn false becauseFHIR.integeris a supertype ofFHIR.positiveIntandFHIR.Quantityis a supertype ofFHIR.Age.Valueobject is renamed toConstants. TheCqlListclass is replaced with theSortHelper.compare()method.DescendentsEvaluatorlogic is fixed along the way.Enhancements for the engine JS target and CQL playground
createInstance()andis()methods.