FHIR / sql-on-fhir-v2

This project provides the source for the SQL on FHIR v2.0 Implementation Guide

Home Page:https://build.fhir.org/ig/FHIR/sql-on-fhir-v2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Columns in wrong order

johngrimes opened this issue · comments

In the following tests, the columns in the expectation are in the wrong order:

  • foreach > nested forEach
  • foreach > nested forEach: select & column

In both cases, the order should be:

  1. id
  2. contact_type
  3. name

@johngrimes Do you mean the test should be

{
  "expect": [
    {
      "id": "pt1"
      "contact_type": "phone",
      "name": "N1",
    }
  ]
}

instead of

{
  "expect": [
    {
      "contact_type": "phone",
      "name": "N1",
      "id": "pt1"
    }
  ]
}

?

If the order of the field is important, maybe we should change the format of "expect" to something like:

{
  "expect": [
    [ {"name": "id", "value": "pt1"}
      {"name": "contact_type", "value": "phone"}
      ...
    ]
    [ {"name": "id", "value": "pt2"}
      {"name": "contact_type", "value": "phone"}
      ...
    ]
  ]
}

Yes, I think you are right - we might have to change the structure of the expectations. I don't think that objects in JSON are ordered, and the keys could be reordered by parsers.

The order of the columns is important, but the order of the rows should be disregarded.

I think this issue will be resolved by merging #208, #209 and adding some tests with expectColumns to verify compliance with the column ordering requirements in the spec.

Resolved by #228.