Skip to content

Collapse a list of Intervals returns an array instead of a list #1744

@bryantaustin13

Description

@bryantaustin13

To duplicate in cql-tests-runner run:

<?xml version="1.0" encoding="utf-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hl7.org/fhirpath/tests" xsi:schemaLocation="http://hl7.org/fhirpath/tests ../../testSchema/testSchema.xsd"
	   name="CqlIntervalOperatorsTest">
	<group name="SingleTest" version="1.0">
		<test name="IntegerIntervalCollapse" version="1.0">
			<capability code="interval-operators"/>
			<expression>collapse { Interval[1,5], Interval[3,7], Interval[12,19], Interval[7,10] }</expression>
			<output>{Interval[1, 10], Interval[12, 19]}</output>
		</test>
	</group>
</tests>

The engine is returning:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "return",
      "valueRange": {
        "low": {
          "value": 1,
          "unit": "g",
          "system": "http://unitsofmeasure.org",
          "code": "g"
        },
        "high": {
          "value": 10,
          "unit": "g",
          "system": "http://unitsofmeasure.org",
          "code": "g"
        }
      }
    },
    {
      "name": "return",
      "valueRange": {
        "low": {
          "value": 12,
          "unit": "g",
          "system": "http://unitsofmeasure.org",
          "code": "g"
        },
        "high": {
          "value": 19,
          "unit": "g",
          "system": "http://unitsofmeasure.org",
          "code": "g"
        }
      }
    }
  ]
}

And it should be something like:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "return",
      "part": [
        {
          "name": "item",
          "valueRange": {
            "low": {
              "value": 1.0,
              "unit": "g",
              "system": "http://unitsofmeasure.org",
              "code": "g"
            },
            "high": {
              "value": 10.0,
              "unit": "g",
              "system": "http://unitsofmeasure.org",
              "code": "g"
            }
          },
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/cqf-cqlType",
              "valueString": "Interval<System.Quantity>"
            }
          ]
        },
        {
          "name": "item",
          "valueRange": {
            "low": {
              "value": 12.0,
              "unit": "g",
              "system": "http://unitsofmeasure.org",
              "code": "g"
            },
            "high": {
              "value": 19.0,
              "unit": "g",
              "system": "http://unitsofmeasure.org",
              "code": "g"
            }
          },
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/cqf-cqlType",
              "valueString": "Interval<System.Quantity>"
            }
          ]
        }
      ]
    }
  ]
}

This error occurs in several tests including:
IntegerIntervalCollapse2
IntegerIntervalCollapse3
DecimalIntervalCollapse
DecimalIntervalCollapse2
TimeCollapse (other issues as well)
TimeCollapse2
ExpandPerDay (other issues as well)
ExpandPer2Days

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions