Skip to content

Join function expectation conflicts with FHIRPath tests #292

@johngrimes

Description

@johngrimes

We have two tests that have an expectation that an empty collection input to the join function results in an empty string:

https://github.com/FHIR/sql-on-fhir-v2/blob/master/tests/fhirpath.json#L335

    {
      "title": "string join",
      "tags": ["shareable"],
      "view": {
        "resource": "Patient",
        "status": "active",
        "select": [
          {
            "column": [
              {
                "name": "id",
                "path": "id",
                "type": "id"
              },
              {
                "name": "given",
                "path": "name.given.join(', ' )",
                "type": "string"
              }
            ]
          }
        ]
      },
      "expect": [
        {
          "id": "pt1",
          "given": "g1.1.1, g1.1.2, g1.2.1"
        },
        {
          "id": "pt2",
          "given": ""
        },
        {
          "id": "pt3",
          "given": ""
        }
      ]
    },
    {
      "title": "string join: default separator",
      "tags": ["shareable"],
      "view": {
        "resource": "Patient",
        "status": "active",
        "select": [
          {
            "column": [
              {
                "name": "id",
                "path": "id",
                "type": "id"
              },
              {
                "name": "given",
                "path": "name.given.join()",
                "type": "string"
              }
            ]
          }
        ]
      },
      "expect": [
        {
          "id": "pt1",
          "given": "g1.1.1g1.1.2g1.2.1"
        },
        {
          "id": "pt2",
          "given": ""
        },
        {
          "id": "pt3",
          "given": ""
        }
      ]
    }

This conflicts with the FHIRPath.js test suite, which expects that the join function will return an empty collection if given one as input:

https://github.com/HL7/fhirpath.js/blob/master/test/cases/5.6_string_manipulation.yaml#L370

  - desc: '** join on empty input collection'
    expression: Functions.str.empty.join(',')
    result: []

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions