Skip to content

CQL v5#1755

Draft
antvaset wants to merge 32 commits into
mainfrom
v5
Draft

CQL v5#1755
antvaset wants to merge 32 commits into
mainfrom
v5

Conversation

@antvaset
Copy link
Copy Markdown
Contributor

@antvaset antvaset commented May 1, 2026

  • All non-null CQL values are represented as instances (implementors) of the sealed Value interface. Boolean, Integer, Long, Decimal, String, and List from the org.opencds.cqf.cql.engine.runtime package are used intead of kotlin.Boolean, kotlin.Int, kotlin.Long, BigDecimal, kotlin.String, and kotlin.collections.Iterable<T>.
  • The evaluation visitor, all evaluators, engine API, FhirTypeConverter, and related tests are updated accordingly to use Value instead of Any.
  • JUnit and Hamcrest are replaced with kotlin.test in the majority of tests along the way.
  • The original Value object is renamed to Constants. The CqlList class is replaced with the SortHelper.compare() method.
  • Non-system structured types (e.g. instances of FHIR.Patient, FHIR.string, etc.) are now represented in the engine as ClassInstances. A ClassInstance is a structured value (like a Tuple) with a QName type tag like {http://hl7.org/fhir}Patient. As a result:
    • the engine only operates on a fixed set of Kotlin types, and HAPI FHIR structures and other custom types do not bleed into the runtime,
    • resolvePath(), as(), setValue(), objectEqual(), objectEquivalent(), resolveType() are no longer needed in the ModelResolver interface.
  • Java 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 in ModelResolver and is(value: Any?, type: Class<*>?): Boolean? changed to is(valueType: String, type: QName): Boolean?,
    • type testing is improved so e.g. Interval[1,2] is Interval<Integer> returns true and Interval[1,2] is Interval<Time> returns false,
    • function resolution is more robust when function refs are compiled without signatures.
  • In FhirModelResolver : ModelResolver, the is(valueType: String, type: QName): Boolean? method now returns true only if {http://hl7.org/fhir}_valueType_ extends type or is the same as type. As a result, expressions like FHIR.integer { ... } is FHIR.positiveInt and FHIR.Quantity { ... } is FHIR.Age return false because FHIR.integer is a supertype of FHIR.positiveInt and FHIR.Quantity is a supertype of FHIR.Age.
  • Fix DescendentsEvaluator.
  • Initial implementation of FHIR model resolver in JS with support for createInstance() and is() methods.
  • JS-export CQL value classes, CQL type classes.
  • Add type hints for expression results in the online playground.
image

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Formatting check succeeded!

@antvaset antvaset mentioned this pull request May 1, 2026
@antvaset antvaset marked this pull request as draft May 1, 2026 08:22
Initial implementation of FHIR model resolver in JS. JS-export CQL value classes, CQL type classes. Type hints for expression results.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

❌ Patch coverage is 48.56620% with 843 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.77%. Comparing base (d13cfbe) to head (399e507).

Files with missing lines Patch % Lines
...pencds/cqf/cql/engine/elm/executing/IsEvaluator.kt 16.17% 51 Missing and 6 partials ⚠️
.../cql/engine/elm/executing/HighBoundaryEvaluator.kt 0.00% 53 Missing ⚠️
...f/cql/engine/elm/executing/LowBoundaryEvaluator.kt 0.00% 52 Missing ⚠️
...f/cql/engine/elm/executing/FunctionRefEvaluator.kt 46.42% 33 Missing and 12 partials ⚠️
.../cqf/cql/engine/elm/executing/InstanceEvaluator.kt 15.21% 27 Missing and 12 partials ⚠️
.../cqf/cql/engine/elm/executing/PropertyEvaluator.kt 41.66% 21 Missing and 14 partials ⚠️
...cds/cqf/cql/engine/elm/executing/EqualEvaluator.kt 45.16% 19 Missing and 15 partials ⚠️
.../cqf/cql/engine/elm/executing/RetrieveEvaluator.kt 0.00% 26 Missing ⚠️
...qf/cql/engine/elm/executing/EquivalentEvaluator.kt 58.62% 12 Missing and 12 partials ⚠️
...cql/engine/fhir/converter/BaseFhirTypeConverter.kt 43.75% 1 Missing and 17 partials ⚠️
... and 119 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1755      +/-   ##
============================================
+ Coverage     68.60%   68.77%   +0.16%     
+ Complexity     1761     1694      -67     
============================================
  Files           529      532       +3     
  Lines         30787    30495     -292     
  Branches       6905     6987      +82     
============================================
- Hits          21121    20972     -149     
+ Misses         7193     6984     -209     
- Partials       2473     2539      +66     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

antvaset added 2 commits May 8, 2026 23:04
# 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
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
63.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

1 participant