openreferral / specification

The Human Services Data Specification - a data exchange format developed by the Open Referral Initiative
https://openreferral.org
Other
117 stars 49 forks source link

datapackage.json inconsistencies with regard to the official Data Package spec #144

Closed xrysanthos closed 7 years ago

xrysanthos commented 7 years ago

As I'm currently working with a set of HSDS validation tools, I've come across the following issue.

The official specification for the Data Package schema from Frictionless data, includes a spec for a Table Schema which is being used by their official validator libs.

The validation libraries are using a JSON schema that enforces both primaryKey, foreignKeys.fields and foreignKeys.reference.fields attributes to have values of type array. According to the latest Table Schema spec values can be either of type string or array, but it is also stated that from this version if there is only one value, it should be set as a single element array.

See PR #143 for details.

timgdavies commented 7 years ago

Thanks to @spilio there is now an updated pull request at #145 which aligns the Open Referral datapackage.json with the latest version of the Frictionless Data Table Schema.

This mainly changes the primary and foreign key mentions from strings to arrays, so that where, in datapackage.json, we had:

"primaryKey": "id",
"foreignKeys": [
    {
        "fields": "organization_id",
        "reference": {
            "resource": "organization",
            "fields": "id"
        }
    }
]

we would now have:


"primaryKey": [
  "id"
],
"foreignKeys": [
  {
    "fields": [
      "organization_id"
    ],
    "reference": {
      "resource": "organization",
      "fields": [
        "id"
      ]
    }
  }
]

This has no implications for the structure of HSDS data tables themselves. It is only a change to the underlying schema to make sure Frictionless Data datapackage tools can validate and work with HSDS data.

I'm proposing that this can be merged into '1.1-dev' and then applied as a minor release to the HSDS spec (giving us version 1.1.1).

However, this could affect implementers in two ways:

Given the Table Schema spec allows that the target of primaryKey and foreignKeys[].fields could be strings or arrays, and tooling based off the frictionless data specs should in theory already support arrays.

However, if there are implementers who feel they would be affected by this change because their tools rely on the structure of incoming datapackage.json files, and don't support arrays, then we could look at making this a decimal or integer release.

@kinlane @greggish (+all) I'd welcome your feedback on whether this has any impact on the API work, and views on whether we can make this a quick bug-fix or not.

timgdavies commented 7 years ago

This has been merged.