sdmx-twg / sdmx-json

This repository is used for maintaining the SDMX-JSON message specifications.
54 stars 20 forks source link

SDMX 3.0: implement "feature 001 Improve the exchange of reference metadata" for SDMX-JSON messages #89

Closed dosse closed 2 years ago

dosse commented 3 years ago

https://metadatatechnology.com/sdmx3/designs/001/baseline/001%20Reference%20Metadata%20V3.0.2%20-%20with%20comments%20log.docx

dosse commented 3 years ago

In order to support the new requirement, it is proposed to:

structure message changes:

Reference Metadata against Structure Metadata

Reference Metadata against Datasets

--> Implemented as translation from xml structure schemas by J

data message changes:

Reference Metadata against Structure Metadata

"metadataSets": [ { "action": "Information", "id": "ALB", "providerID": "ALB", "version": "1.0.0", "metadataProvisionRef": "urn:sdmx:org.sdmx.infomodel.metadataProvision=OECD:ALB_DQAF(1.0.0)", "name": "Metadata set", "names": { "en": "Metadata set", "fr": "Set de métadonnées" }, "target": "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=OECD:GDP(1.0.0)", "attributes": [{ "id": "ATTRIBUTE_1_1", "value": "CODED_TEXT", "attributes": [{ "id": "ATTRIBUTE_1_2", "structuredText": "

An XHTML text

", "structuredTexts": { "en": "

An XHTML text

" }, "text": "A text", "texts": { "en": "A text" } }] }] }]

- The current [GenericMetadata message](https://github.com/sdmx-twg/sdmx-json/tree/develop/metadata-message) is updated for SDMX3.0.

#### Reference Metadata against Datasets
- Values of **MSD Metadata Attributes** referenced by DSD are allowed to be transmitted with or without the data (and so allow including only relevant dimensions)
- **For data messages we extend this possibility to transmit any attribute values with or without the data (thus separately).** 
```json
"attributes": {
    "group": [          # a new property for attributes attached at partial keys (in addition to dataset, series and observation)
        {
            "id": "GROUP_ATTR",
            "name": "Group attribute",
            "names": { "en": "Group attribute"},
            "values": [ # values to be used if attribute is enumerated
                {
                    "id": "AAA",   
                    "name": "Aaa",
                    "names": {"en": "Aaa", "fr": "Aaa"}
                }
            ]
        }
    ]
}

"dataSets": [
    {
        "action": "Information",
        "groupAttributes": {
            ":0::": [0] # a subset of dimensions is sufficient for the new `groupAttributes` object containing the attributes attached at partial keys, however separators ':' are required between all dimensions included in the message, indexes are used when attributes are enumerated.
        }
    }
]

"dataSets": [ { "action": "Information", "groupAttributes": { ":0::": [{"en": "

Lorem Ipsum

", "fr": "

Lorem Ipsum

"}] # Values are written when attributes are not enumerated. This applies to all attributes including those presented at dataset, series or observation level. } } ]


- Any attribute type also supports multiple values (from "feature 003 Microdata exchange").
```json
"attributes": {
    "group": [
        {
            "id": "MULTI_VALUED_ATTR",
            "name": "Attribute with multiple values",
            "names": { "en": "Attribute with multiple values"},
            "format": { # to be used for any format specifications
                "textFormat": "string", # textFormat to be used when not enumerations
                "isMultilingual": false,
                "maxOccurrences": 2  
            }       # values to be used if enumerated
        }
    ]
}

"dataSets": [
    {
        "action": "Information",
        "groupAttributes": {
            ":0::": [["text value 1", "text value 2"]]  # Attribute values are written directly into the dataSets when not enumerated. Multi-valued attributes are presented as an array.
        }
    }
]
"attributes": {
    "group": [
        {
            "id": "MULTI_VALUED_ATTR",
            "name": "Attribute with multiple multi-lingual values",
            "names": { "en": "Attribute with multiple multi-lingual values"},
            "format": { # to be used for any format specifications
                "textFormat": "string", # textFormat to be used when not enumerations
                "isMultilingual": true,
                "maxOccurrences": 2  
            }       # values to be used if enumerated
        }
    ]
}

"dataSets": [
    {
        "action": "Information",
        "groupAttributes": {
            ":0::": [[{"en": "Value1", "fr": "Valeur1"}, {"en": "Value2", "fr": "Valeur2"}]]    # Multi-valued attributes are presented as an array. Inside each array field (value) is an object allowing for multi-lingual value versions.
        }
    }
]
dosse commented 2 years ago

Released