/
MTNA

MTNA

Overview

The MTNA JSON is the default format and is designed to provide users with the data that results from their specified query. In addition to the data, this format provides users with metadata about variables and classifications. This can be used to fill out enhance visualizations, tables, or other user facing output. This format provides users with an info section as well, which contains useful information about the query and can be used to enable pagination and optimize how results are displayed to users.

Example

  • In this example we will create a tabulation and retrieve it along with its metadata. We will assume that we have a collection named test and a view named view with a variable named var that has the values 1, 2, and 3. In this example we will run a tabulation that will count the frequencies of each of these values that could be used to create a chart.
  • Running the tabulation would normally look something like this:

    Tabulation
    http://{host}/rds/api/catalog/test/view/tabulate?dims=var&metadata


    Tabulation Output
     {
        "metadata": {
            "variables": {
                "resources": [
                    {
                        "id": "var",
                        "name": "Variable",
                        "index": 5,
                        "storageType": "NUMERIC",
                        "displayType": "NUMERIC",
                        "width": 1
                    },
                    {
                        "id": "count",
                        "name": "count",
                        "storageType": "NUMERIC",
                        "displayType": "NUMERIC"
                    }
                ],
                "info": {
                    "offset": 0,
                    "more": false,
                    "count": 2
                }
            }
        },
        "records": [
            [
                1,
                182
            ],
            [
                2,
                354
            ],
            [
                3,
                126
            ]
        ],
        "info": {
            "colCount": 2,
            "format": "MTNA",
            "includeMetadata": true,
            "limit": 20,
            "offset": 0,
            "moreRows": false
        }
    }


  • If there is a classification for the variable, the classification with its code and categories will also be returned. 

    Tabulation With Classification
     {
        "metadata": {
            "variables": {
                "resources": [
                    {
                        "id": "var",
                        "name": "Variable",
                        "index": 5,
                        "storageType": "NUMERIC",
                        "displayType": "NUMERIC",
                        "width": 1,
                        "classification": "varClassification"
                    },
                    {
                        "id": "count",
                        "name": "count",
                        "storageType": "NUMERIC",
                        "displayType": "NUMERIC"
                    }
                ],
                "info": {
                    "offset": 0,
                    "more": false,
                    "count": 2
                }
            },
            "classifications": {
                "resources": [
                    {
                        "id": "varClassification",
                        "codes": {
                            "resources": [
                                {
                                    "value": "1",
                                    "label": "METROPOLITAN AREA"
                                },
                                {
                                    "value": "2",
                                    "label": "TOWN OR CITY"
                                },
                                {
                                    "value": "3",
                                    "label": "OPEN COUNTRY"
                                }
                            ],
                            "info": {
                                "codeLimit": 100,
                                "codeOffset": 0,
                                "count": 3,
                                "moreCodes": false
                            }
                        }
                    }
                ],
                "info": {
                    "limit": 100,
                    "offset": 0,
                    "codeLimit": 100,
                    "codeOffset": 0,
                    "more": false,
                    "count": 1
                }
            }
        },
        "records": [
            [
                1,
                182
            ],
            [
                2,
                354
            ],
            [
                3,
                126
            ]
        ],
        "info": {
            "colCount": 2,
            "format": "MTNA",
            "includeMetadata": true,
            "limit": 20,
            "offset": 0,
            "moreRows": false
        }
    }