ExpandPer0D1 and ExpandPer0D1IntervalOverload copy the spec example that FHIR-58705 reports as incorrect

Open Beginner friendly
#182 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
xml
Domain
testing

Research direction

Start with CqlIntervalOperatorsTest.xml and inspect the ExpandPer0D1 and ExpandPer0D1IntervalOverload cases. The issue suggests marking them pending FHIR-58705 or removing them, then updating the expected outputs once that ticket is resolved; done means the tests no longer assert the disputed example and cover the Decimal behavior settled by the resolution.

Written by the indexing model from the issue text.

Description

CqlIntervalOperatorsTest.xml:

<test name="ExpandPer0D1" version="1.3">
  <expression>expand { Interval[10, 10] } per 0.1</expression>
  <output>{ Interval[10.0, 10.0], Interval[10.1, 10.1], Interval[10.2, 10.2], Interval[10.3, 10.3], Interval[10.4, 10.4], Interval[10.5, 10.5], Interval[10.6, 10.6], Interval[10.7, 10.7], Interval[10.8, 10.8], Interval[10.9, 10.9] }</output>
</test>
<test name="ExpandPer0D1IntervalOverload" version="1.3">
  <expression>expand Interval[10, 10] per 0.1</expression>
  <output>{ 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9 }</output>
</test>

These outputs come from the example in Expand. FHIR-58705 ("Correct/Add Interval Expand numeric examples", a Change Request raised against 1.5.3, still Submitted) reports that example as incorrect. Every interval after the first ends after the input's upper boundary of 10, which contradicts the definition: "contribute all the intervals of size per that start on or after the lower boundary and end on or before the upper boundary". The example also doesn't fit the signature, expand(argument List<Interval<T>>, per Quantity) List<Interval<T>>, which makes this a list of Interval<Integer>.

Neither engine passes these tests, and neither runs them:

  • The Java engine lists both in its SKIP set (engine-fhir/src/jvmTest/kotlin/org/hl7/fhirpath/CQLOperationsR4Test.kt).
  • The runner's cql-execution config skips both with "Invalid Test: Expected output is incorrect: https://jira.hl7.org/browse/FHIR-58705".

What the engines return (Java 5.6.1 via $cql on HAPI FHIR, cql-execution 4.0.0-beta.1):

Expression Java cql-execution
expand { Interval[10, 10] } per 0.1 { Interval[10, 10] } { }
expand Interval[10, 10] per 0.1 { 10 } { }

They also differ on the Decimal examples that FHIR-58705 proposes adding to the spec:

Expression Java cql-execution
expand { Interval[10.0, 12.5] } per 1.0 { Interval[10.0, 10.9], Interval[11.0, 11.9] } { Interval[10, 10], Interval[11, 11], Interval[12, 12] }
expand { Interval[10.0, 12.5] } per 0.5 { Interval[10.0, 10.4], Interval[10.5, 10.9], …, Interval[12.0, 12.4] } (5) { Interval[10, 10.49999999], Interval[10.5, 10.99999999], … } (5)
expand { Interval[0, 1] } per 0.1 { Interval[0, 0], Interval[1, 1] } 10 intervals, starting Interval[0, 0.09999999]

Suggestion: until FHIR-58705 is resolved, mark these two tests as pending that ticket, or remove them, rather than keeping an output the ticket says is wrong. Once it's resolved, update their outputs, and add tests for the Decimal examples the resolution settles, since the engines currently disagree on all of them.

Dominant language
No language data
Stars
8
Forks
9
Avg merge
4d 2h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cqframework/cql-tests

All issues in cqframework/cql-tests

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.