From bdee98f19d7089e095743a6fca8ff1e2033c74b0 Mon Sep 17 00:00:00 2001 From: dcslagel Date: Mon, 14 Dec 2020 13:07:54 -0700 Subject: [PATCH] Rebase da1660d: 'missing value per field pattern' Original information: Author: Stephen-Gates Date: Sat Apr 7 20:40:44 2018 +1000 WIP missing value per field pattern as per https://discuss.okfn.org/t/missing-values-per-field-pattern/6571 --- patterns/README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/patterns/README.md b/patterns/README.md index aa0736ae..a5e81d4f 100644 --- a/patterns/README.md +++ b/patterns/README.md @@ -965,3 +965,62 @@ re-packaged using these formats. To keep the implementation and testing testing: only one recursive level is possible. A `resource` can list `resources` inside (like in the example). But the inner resources cannot contain resources again. + +## Missing values per field + +### Overview + +Characters representing missing values in a table can be defined for all fields in a [Tabular Data Resource](http://frictionlessdata.io/specs/tabular-data-resource/) using the [`missingValues`](http://frictionlessdata.io/specs/table-schema/#missing-values) property in a Table Schema. Values that match the `missingValues` are treated as `null`. + +The Missing values per field pattern allows different missing values to be specified for each field in a Table Schema. If not specified, each field inherits from values assigned to `missingValues` at the Tabular Data Resource level. + +For example, this data... + +item | description | price +---- | ----------- | ----- +1 | Apple | 0.99 +tba | Banana | -1 +3 | n/a | 1.20 + +...using this Table Schema... + +```javascript +"schema":{ + "fields": [ + { + "name": "item", + "title": "An inventory item number", + "type": "integer" + }, + { + "name": "description", + "title": "item description", + "type": "string", + "missingValues": [ "n/a"] + }, + { + "name": "price", + "title": "cost price", + "type": "number", + "missingValues": [ "-1"] + } + ], + "missingValues": [ "tba", "" ] +} +``` + +...would be interpreted as... + +item | description | price +------ | ----------- | ------ +1 | Apple | 0.99 +`null` | Banana | `null` +3 | `null` | 1.20 + +### Specification + +A field MAY have a `missingValues` property that MUST be an `array` where each entry is a `string`. If not specified, each field inherits from the values assigned to [`missingValues`](http://frictionlessdata.io/specs/table-schema/#missing-values) at the Tabular Data Resource level. + +### Implementations + +None known.