Skip to content

API PxFileBuild

damiancosmoschapman edited this page May 16, 2024 · 118 revisions

Home / API / PxFileBuild

Create

Create- Details

Create a PX-file

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.Create

Parameters: [Object]

Name Type Default Description
MtrCode String The Matrix Code
MtrOfficialFlag String The Matrix Official Flag Code
FrqCode String The Frequency
CprCode String The Copyright Code
FrmType String The Format Type required, e.g. PX, JSON-stat
FrmVersion String The Format Version
Dimension Dimension Dimension object array (see below)

Dimension: [Object]

Name Type Default Description
LngIsoCode String Language ISO Code
MtrTitle String Matrix Title
MtrNote String Notes
Classification Classification Object array Classification objects (see below)
Statistic Statistic Object array Statistic Objects (see below)
Frequency Frequency Object Frequency Object(see below)
StatisticLabel String Label for statistics

Classification: [Object]

Name Type Default Description
ClsCode String Classification Code
ClsValue String Classification Value
ClsGeoUrl String Classification Geo url
Variable Object array Variables (see below)

Variable: [Object]

Name Type Default Description
VrbCode String Variable Code
VrbValue String Variable Value

Statistic: [Object]

Name Type Default Description
SttCode String Statistic Code
SttValue String Statistic Name
SttUnit String Unit of measurement for the data point e.g number, percent, kg
SttDecimal Integer Number of decimal places in the data point

Frequency: [Object]

Name Type Default Description
FrqValue String Statistic Code
Period Object Array List of Period objects (see below)

Period: [Object]

Name Type Default Description
PrdCode String Period Code
PrdValue String Period Name

Example Parameters:

Example Parameters - Details

{
    "jsonrpc": "2.0",
    "method": "PxStat.Build.Build_API.Create",
    "params": {
        "MtrCode": "TEST",
        "MtrOfficialFlag": true,
        "FrqCode": "TLIST(A1)",
        "CprCode": "CSO",
        "Dimension": [
            {
                "LngIsoCode": "en",
                "MtrTitle": "test title",
                "MtrNote": "My note",
                "Classification": [
                    {
                        "ClsCode": "C02196V04140",
                        "ClsValue": "Region",
                        "ClsGeoUrl": "https://cdn.cso.ie/client/2.0.0/map/en/ie_nuts2.json",
                        "Variable": [
                            {
                                "VrbCode": "IE04",
                                "VrbValue": "Northern and Western"
                            },
                            {
                                "VrbCode": "IE05",
                                "VrbValue": "Southern"
                            },
                            {
                                "VrbCode": "IE06",
                                "VrbValue": "Eastern and Midland"
                            }
                        ]
                    }
                ],
                "Statistic": [
                    {
                        "SttCode": "001",
                        "SttValue": "My stat",
                        "SttUnit": "%",
                        "SttDecimal": "0"
                    }
                ],
                "Frequency": {
                    "FrqValue": "FVAL",
                    "Period": [
                        {
                            "PrdCode": "2018",
                            "PrdValue": "2018"
                        },
                        {
                            "PrdCode": "2019",
                            "PrdValue": "2019"
                        }
                    ]
                },
                "StatisticLabel": "Statistic"
            }
        ]
    },
    "id": "2"
}

Example creating a PX file with two languages:

{
	"jsonrpc": "2.0",
	"method": "PxStat.Build.Build_API.Create",
	"params": {
  "MtrCode": "TESTTABLE",
  "MtrOfficialFlag": true,
  "FrqCode": "TLIST(A1)",
  "CprCode": "CSO",
  "FrmType": "PX",
  "FrmVersion": "2013",
  "Dimension": [
    {
      "LngIsoCode": "en",
      "MtrTitle": "asdf",
      "FrqCode": null,
      "MtrNote": "",
      "Classification": [
        {
          "ClsCode": "c01",
          "ClsValue": "cls one",
          "ClsGeoUrl": "https://cdn.cso.ie/static/map/en/Dublin_Rest_of_Leinster,_Munster_Connacht_and_Ulster_(part_of).json",
          "Variable": [
            {
              "VrbCode": "v01",
              "VrbValue": "vrb one"
            },
            {
              "VrbCode": "v02",
              "VrbValue": "vrb two"
            }
          ]
        },
        {
          "ClsCode": "c02",
          "ClsValue": "cls two",
          "ClsGeoUrl": "https://cdn.cso.ie/static/map/en/Dublin_Rest_of_Leinster,_Munster_Connacht_and_Ulster_(part_of).json",
          "Variable": [
            {
              "VrbCode": "v01",
              "VrbValue": "vrb one"
            },
            {
              "VrbCode": "v02",
              "VrbValue": "vrb two"
            }
          ]
        }
      ],
      "Statistic": [
        {
          "SttCode": "s01",
          "SttValue": "stat1",
          "SttUnit": "number",
          "SttDecimal": "2"
        },
        {
          "SttCode": "s02",
          "SttValue": "stat2",
          "SttUnit": "number",
          "SttDecimal": "2"
        }
      ],
      "Frequency": {
        "FrqValue": "Annual",
        "Period": [
          {
            "PrdCode": "2016",
            "PrdValue": "2016"
          },
          {
            "PrdCode": "2017",
            "PrdValue": "2017"
          }
          
        ]
      },
      "StatisticLabel": "statistic"
    },
    {
      "LngIsoCode": "ga",
      "MtrTitle": "Teidal",
      "FrqCode": null,
      "MtrNote": "",
      "Classification": [
        {
          "ClsCode": "c01",
          "ClsValue": "cls1",
          "ClsGeoUrl": "https://cdn.cso.ie/static/map/en/Dublin_Rest_of_Leinster,_Munster_Connacht_and_Ulster_(part_of).json",
          "Variable": [
            {
              "VrbCode": "v01",
              "VrbValue": "vrb one"
            },
            {
              "VrbCode": "v02",
              "VrbValue": "vrb two"
            }
          ]
        },
        {
          "ClsCode": "c02",
          "ClsValue": "cls two",
          "ClsGeoUrl": "https://cdn.cso.ie/static/map/en/Dublin_Rest_of_Leinster,_Munster_Connacht_and_Ulster_(part_of).json",
          "Variable": [
            {
              "VrbCode": "v01",
              "VrbValue": "vrb one"
            },
            {
              "VrbCode": "v02",
              "VrbValue": "vrb two"
            }
          ]
        }
        
      ],
      "Statistic": [
        {
          "SttCode": "s01",
          "SttValue": "stat1",
          "SttUnit": "uimhir",
          "SttDecimal": "2"
        },
        {
          "SttCode": "s02",
          "SttValue": "stat2",
          "SttUnit": "uimhir",
          "SttDecimal": "2"
        }
      ],
      "Frequency": {
        "FrqValue": "bliantúil",
        "Period": [
          {
            "PrdCode": "2016",
            "PrdValue": "2016"
          },
          {
            "PrdCode": "2017",
            "PrdValue": "2017"
          }
        ]
      },
      "StatisticLabel": "statistic"
    }
  ]
}
}

Return: Px File

Validation Rules If multiple languages are used in the build then the following must hold true:

  • All dimensions are in the same order for each language
  • Classification codes are the same for each classification in each language
  • Within each classification, variable codes are the same for each language and are in the same order in each language
  • Individual statistics in the statistic dimension have the same statistic code and are in the same order in each language
  • Individual periods within the time dimension have the same period code and are in the same order in each language
  • Any language may only be represented once in the request
  • The default language of the system must be represented in the request
  • Any chosen language must have already been setup in the system
  • A format must be supplied and the chosen format and version must be represented in the system.
  • The number of data cells required by these dimensions does not exceed the configured maximum

Within each language parameter set:

  • Statistic label must not be the same as the Frequency Value
  • Any statistic code must be unique
  • Any statistic value must be unique
  • Any statistic value must not be same as the statistic label
  • There must be at least one statistic
  • Any classification code must be unique
  • Any classification value must be unique
  • You must have at least one classification
  • A geo-code in a classification must be a valid url
  • Any variables in the classification must be unique
  • There must be at least one period
  • Any dimension codes must not equal "value" or "unit"

Update

Update- Details

Update a px file. New data for a period(s) may be added or data for existing periods may be updated. Other properties may be updated as outlined below.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.Update

Parameters: [Object]

Name Type Default Description
MtrInput String Px file as a string (Base64 Encoded)
format String "px" or "json"
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
MtrOfficialFlag boolean Indicates if this is an Official Statistic
CprCode String Copyright code (where it needs to be amended)
MtrCode String Matrix code (where it needs to be amended)
Dimension Array [Object] There will be one dimension per language in the px file
Signature String The output from the validation process - see PxStat.Build.Build_API.Validate

Dimension: [Object]

Name Type Default Description
LngIsoCode String Language ISO Code
MtrTitle String Matrix Title
MtrNote String Notes
Classification Classification Object array Classification objects (see below)
Frequency Frequency Object Frequency Object(see below)
StatisticLabel String Label for statistics

Frequency: [Object]

Name Type Default Description
FrqValue String Statistic Code
Period Object Array List of Period objects (see below)

Period: [Object] . If any of the Data pertains to new periods, then those periods must be described below.

Name Type Default Description
PrdCode String Period Code
PrdValue String Period Name

Classification: [Object]

Name Type Default Description
ClsCode String Classification Code
ClsGeoUrl String Classification Geo url

Data: [Object array] Note - Each item represents an individual data point that is being added/amended. Each data point will have one statistic and one time period and one or more classifications. The number of items in the object will therefore depend on the number of classifications in the matrix.

Name Type Default Description
Statistic Code String The value corresponding to Statistic Code
Frequency Code String The value corresponding to Frequency Code
Classification Code String The variable value corresponding to Classification Code for this data point
Signature String The output from the validation process - see PxStat.Build.Build_API.Validate

The Classification Code entry will be repeated for each Classification in the Matrix

Example Parameters:

Example Parameters - Details

 {
        "MtrInput": "data:text/x-pcaxis;base64,Q0hBUlNFVD0iQU5TSSI7DQpBWElTLVZFUlNJT049IjIwMTMiOw0KTEFOR1VBR0U9ImVuIjsNCkNSRUFUSU9OLURBVEU9ILjEgMy4zIDQuNCA1LjUgNi42IDcuNyA3LjggNzcuOTs=",
        "format": "px",
        "FrqValueTimeval": "Quarter",
        "FrqCodeTimeval": "TLIST(Q1)",
        "MtrOfficialFlag": true,
        "CprCode":"CSO",
        "MtrCode":"SPQ23x",
        "Dimension": [
            {
                "LngIsoCode": "en",
                "MtrTitle": "This is the amended title",
                "MtrNote": "This is a new test note",
                "StatisticLabel": "StatisticXXX",
                "Frequency": {
                    "FrqValue": "3month",
                    "Period": [
                        {
                            "PrdCode": "2013Q3",
                            "PrdValue": "2013Q3en"
                        }
                    ]
                },
                "Classification": [
                    {
                        "ClsCode": "SPSPORT",
                        "ClsGeoUrl": "https://cdn.cso.ie/client/2.0.0/map/en/ie_nuts2.json"
                    },
                    {
                        "ClsCode": "CNJOBS",
                        "ClsGeoUrl": null
                    }
                ]
            }
        ],
        "Data": [
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "1.1"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "3.3"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "4.4"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "5.5"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "6.6"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "7.7"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "7.8"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "11.1"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "77.9"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q2",
                "SPSPORT": "02",
                "VALUE": "11.3"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q2",
                "SPSPORT": "04",
                "VALUE": "77.3"
            }
        ]
    }

Return: String with value of success

Validation Rules

  • Period codes must not be duplicated
  • Languages must be unique in each dimension parameter
  • Requested format must be a valid format configured in the system
  • Any dimension codes must not equal "value" or "unit"
  • The signature field must correspond to the signature returned for a validation of the same px file

Validations for Data array:

  • Each data object must contain a value
  • Each data object must contain a statistic
  • Each data object must contain a period
  • Each data object must contain a variable for each classification

Note - These validations will not result in the request being refused. Invalid items in the data array will be ignored and the response report will show them as not updated.


UpdateByRelease

UpdateByRelease- Details

Update a px file by release code. New data for a period(s) may be added or data for existing periods may be updated. Other properties may be updated as outlined below.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.UpdateByRelease

Parameters: [Object]

Name Type Default Description
RlsCode Integer Release code
format String "px" or "json"
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
MtrOfficialFlag boolean Indicates if this is an Official Statistic
CprCode String Copyright code (where it needs to be amended)
Dimension Array [Object] There will be one dimension per language in the px file

Dimension: [Object]

Name Type Default Description
LngIsoCode String Language ISO Code
MtrTitle String Matrix Title
MtrNote String Notes
Classification Classification Object array Classification objects (see below)
Frequency Frequency Object Frequency Object(see below)
StatisticLabel String Label for statistics

Frequency: [Object]

Name Type Default Description
FrqValue String Statistic Code
Period Object Array List of Period objects (see below)

Period: [Object] . If any of the Data pertains to new periods, then those periods must be described below.

Name Type Default Description
PrdCode String Period Code
PrdValue String Period Name

Classification: [Object]

Name Type Default Description
ClsCode String Classification Code
ClsGeoUrl String Classification Geo url

Data: [Object array] Note - Each item represents an individual data point that is being added/amended. Each data point will have one statistic and one time period and one or more classifications. The number of items in the object will therefore depend on the number of classifications in the matrix.

Name Type Default Description
Statistic Code String The value corresponding to Statistic Code
Frequency Code String The value corresponding to Frequency Code
Classification Code String The variable value corresponding to Classification Code for this data point

The Classification Code entry will be repeated for each Classification in the Matrix

Example Parameters:

Example Parameters - Details

 {
        "RlsCode": 83,
        "format": "px",
        "FrqValueTimeval": "Quarter",
        "FrqCodeTimeval": "TLIST(Q1)",
        "MtrOfficialFlag": true,
        "CprCode":"CSO",
        "Dimension": [
            {
                "LngIsoCode": "en",
                "MtrTitle": "This is the amended title",
                "MtrNote": "This is a new test note",
                "StatisticLabel": "StatisticXXX",
                "Frequency": {
                    "FrqValue": "3month",
                    "Period": [
                        {
                            "PrdCode": "2013Q3",
                            "PrdValue": "2013Q3en"
                        }
                    ]
                },
                "Classification": [
                    {
                        "ClsCode": "SPSPORT",
                        "ClsGeoUrl": "https://cdn.cso.ie/client/2.0.0/map/en/ie_nuts2.json"
                    },
                    {
                        "ClsCode": "CNJOBS",
                        "ClsGeoUrl": null
                    }
                ]
            }
        ],
        "Data": [
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "1.1"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "3.3"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "4.4"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "5.5"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "03",
                "VALUE": "6.6"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "7.7"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "2",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "7.8"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "02",
                "VALUE": "11.1"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q3",
                "SPSPORT": "04",
                "VALUE": "77.9"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "1",
                "TLIST(Q1)": "2013Q2",
                "SPSPORT": "02",
                "VALUE": "11.3"
            },
            {
                "STATISTIC": "29797791",
                "CNJOBS": "3",
                "TLIST(Q1)": "2013Q2",
                "SPSPORT": "04",
                "VALUE": "77.3"
            }
        ]
    }

Return: String with value of success

Validation Rules

  • Period codes must not be duplicated
  • Languages must be unique in each dimension parameter
  • Requested format must be a valid format configured in the system
  • Any dimension codes must not equal "value" or "unit"
  • The signature field must correspond to the signature returned for a validation of the same px file

Validations for Data array:

  • Each data object must contain a value
  • Each data object must contain a statistic
  • Each data object must contain a period
  • Each data object must contain a variable for each classification

Note - These validations will not result in the request being refused. Invalid items in the data array will be ignored and the response report will show them as not updated.


ReadTemplate

Reads a CSV template to allow the front end to create an array of Data objects (see Update)

Validate Period for Matrix Properties

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.ReadTemplate

Parameters:

Name Type Default Description
MtrInput String Px file as a string (Base64 Encoded)
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
Signature String The output from the validation process - see PxStat.Build.Build_API.Validate

Example Parameters:

Example Parameters - Details

{
    	"MtrInput": "data:text/x-pcaxis;base64,Q0hBUlNFVD0iQU5TSSI7DQpBWElTLVZFUlNJT049IjIwMTMiOw0KTEFOR1VBR0U9ImVuIjsNCkNSRUFUSU9OLURBVEU9IjIwMTkxMDA5IDE1OjQ1IjsNCk9GRklDSUFMLVNUQVRJU1RJQ1M9Ik5PIjsNCkRFQ0lNQUxTPTE7DQpNQVRSSVg9IlNQUTIzIjsNClNVQkpFQ1QtQVJFQT0ibi9hIjsNClNVQkpFQ1QtQ09ERT0iTkEiOw0KREVTQ1JJUFRJT049IlRoaXMgaXMgdGhlIGFtZW5kZWQgdGl0bGUiOw0KVElUTEU9IlBlcnNvbnMgYWdlZCAxNSB5ZWFycyBhbmQgb3ZlciB3aG8gcGFydGljaXBhdGUgaW4gc3BvcnQgYW5kL29yIHBoeXNpY2FsIGFjdGl2aXR5ICglKSAoVHlwZSBvZiBTcG9ydCxQcmluY2lwYWwgRWNvbm9taWMgU3RhdHVzKSI7DQpDT05URU5UUz0iUGVyc29ucyBhZ2VkIDE1IHllYXJzIGFuZCBvdmVyIHdobyBwYXJ0aWNpcGF0ZSBpbiBzcG9ydCBhbmQvb3IgcGh5c2ljYWwgYWN0aXZpdHkgKCUpIjsNClVOSVRTPSIlIjsNClNUVUI9IlF1YXJ0ZXIiOw0KSEVBRElORz0iVHlwZSBvZiBTcG9ydCIsIlByaW5jaXBhbCBFY29ub21pYyBTdGF0dXMiOw0KVkFMVUVTKCJRdWFydGVyIik9IjIwMTNRMiIsIjIwMTNRM2VuIjsNClZBTFVFUygiVHlwZSBvZiBTcG9ydCIpPSJTd2ltbWluZyIsIkN5Y2xpbmciLCJBdGhsZXRpY3MiOw0KVkFMVUVTKCJQcmluY2lwYWwgRWNvbm9taWMgU3RhdHVzIik9IkF0IHdvcmsiLCJVbmVtcGxveWVkIiwiU3R1ZGVudCI7DQpUSU1FVkFMKCJRdWFydGVyIik9VExJU1QoUTEpLCIyMDEzUTIiLCIyMDEzUTMiOw0KQ09ERVMoIlR5cGUgb2YgU3BvcnQiKT0iMDIiLCIwMyIsIjA0IjsNCkNPREVTKCJQcmluY2lwYWwgRWNvbm9taWMgU3RhdHVzIik9IjEiLCIyIiwiMyI7DQpET01BSU4oIlR5cGUgb2YgU3BvcnQiKT0iU1BTUE9SVCI7DQpET01BSU4oIlByaW5jaXBhbCBFY29ub21pYyBTdGF0dXMiKT0iQ05KT0JTIjsNCk1BUCgiVHlwZSBvZiBTcG9ydCIpPSJodHRwczovL2Nkbi5jc28uaWUvY2xpZW50LzIuMC4wL21hcC9lbi9pZV9udXRzMi5qc29uIjsNClNPVVJDRT0iQ2VudHJhbCBTdGF0aXN0aWNzIE9mZmljZSwgSXJlbGFuZCI7DQpOT1RFWD0iVGhpcyBpcyBhIG5ldyB0ZXN0IG5vdGUiOw0KREFUQT0NCjExLjMgMTIuNyA5LjUgMTUuMiAxNS45IDcuMiAxMi4yIDYuMSA3Ny4zIA0KMTEuMSAxLjEgMy4zIDQuNCA1LjUgNi42IDcuNyA3LjggNzcuOTs=",
        "FrqValueTimeval": "Quarter",
        "FrqCodeTimeval": "TLIST(Q1)"
    }

Return: CSV Template object


ReadTemplateByRelease

Reads a CSV template, by release code, to allow the front end to create an array of Data objects (see Update)

Validate Period for Matrix Properties

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.ReadTemplateByRelease

Parameters:

Name Type Default Description
RlsCode Integer Release code
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf

Example Parameters:

Example Parameters - Details

{
   "RlsCode": 83,
   "FrqValueTimeval": "Quarter",
   "FrqCodeTimeval": "TLIST(Q1)"
}

Return: CSV Template object


Read

Reads a px file as an array of json-stat objects. There will be one json-stat object for each language in the px file.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.Read

Parameters:

Name Type Default Description
MtrInput String Px file as a string (Base64 Encoded)
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
Signature String The output from the validation process - see PxStat.Build.Build_API.Validate

Example Parameters:

Example Parameters - Details

{
    	"MtrInput": "data:text/x-pcaxis;base64,Q0hBUlNFVD0iQU5TSSI7DQpBWElTLVZFUlNJT049IjIwMTMiOw0KTEFOR1VBR0U9ImVuIjsNCkNSRUFUSU9OLURBVEU9IjIwMTkxMDA5IDE1OjQ1IjsNCk9GRklDSUFMLVNUQVRJU1RJQ1M9Ik5PIjsNCkRFQ0lNQUxTPTE7DQpNQVRSSVg9IlNQUTIzIjsNClNVQkpFQ1QtQVJFQT0ibi9hIjsNClNVQkpFQ1QtQ09ERT0iTkEiOw0KREVTQ1JJUFRJT049IlRoaXMgaXMgdGhlIGFtZW5kZWQgdGl0bGUiOw0KVElUTEU9IlBlcnNvbnMgYWdlZCAxNSB5ZWFycyBhbmQgb3ZlciB3aG8gcGFydGlj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hIG5ldyB0ZXN0IG5vdGUiOw0KREFUQT0NCjExLjMgMTIuNyA5LjUgMTUuMiAxNS45IDcuMiAxMi4yIDYuMSA3Ny4zIA0KMTEuMSAxLjEgMy4zIDQuNCA1LjUgNi42IDcuNyA3LjggNzcuOTs=",
        "FrqValueTimeval": "Quarter",
        "FrqCodeTimeval": "TLIST(Q1)"
    }

Return: json-stat array corresponding to the px file

Validate

Validates a px file and returns a signature to be used as a validation token for other operations. If the time dimension is not specified in the px file (i.e. in a TIMEVAL), a list of candidate dimension names is returned and the user will choose which of them is to represent the time dimension.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.Validate

Parameters:

Name Type Default Description
MtrInput String Px file as a string (Base64 Encoded)
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf

Returns:

Name Type Default Description
Signature String Token to indicate that validation was successful
FrqValueCandidate String[] List of candidate dimensions that could serve as a time dimension. The user will choose from this list in the next step

Example Parameters:

Example Parameters - Details

{
    	"MtrInput": "data:text/x-pcaxis;base64,Q0hBUlNFVD0iQU5TSSI7DQpBWElTLVZFUlNJT049IjIwMTMiOw0KTEFOR1VBR0U9ImVuIjsNCkNSRUFUSU9OLURBVEU9IjIwMTkxMDA5IDE1OjQ1IjsNCk9GRklDSUFMLVNUQVRJU1RJQ1M9Ik5PIjsNCkRFQ0lNQUxTPTE7DQpNQVRSSVg9IlNQUTIzIjsNClNVQkpFQ1QtQVJFQT0ibi9hIjsNClNVQkpFQ1QtQ09ERT0iTkEiOw0KREVTQ1JJUFRJT049IlRoaXMgaXMgdGhlIGFtZW5kZWQgdGl0bGUiOw0KVElUTEU9IlBlcnNvbnMgYWdlZCAxNSB5ZWFycyBhbmQgb3ZlciB3aG8gcGFydGljaXBhdGUgaW4gc3BvcnQ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GUiOw0KREFUQT0NCjExLjMgMTIuNyA5LjUgMTUuMiAxNS45IDcuMiAxMi4yIDYuMSA3Ny4zIA0KMTEuMSAxLjEgMy4zIDQuNCA1LjUgNi42IDcuNyA3LjggNzcuOTs=",
        "FrqValueTimeval": "Quarter",
        "FrqCodeTimeval": "TLIST(Q1)"
    }

ReadDataset

Reads a CSV template to allow the front end to create an array of Data objects (see Update). This template will include all of the dimensions required for the existing periods (with their values) and new periods (with empty data). This enables users to fill in the template with the required values prior to update.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.ReadDataset

Parameters:

Name Type Default Description
MtrInput String Px file as a string (Base64 Encoded)
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
Labels Boolean Indicates whether or not we want to see column headers on the returned csv file
Signature String The output from the validation process - see PxStat.Build.Build_API.Validate
Dimension Array [Object] There will be one dimension per language in the px file

Dimension: [Object]

Name Type Default Description
LngIsoCode String Language ISO Code
Frequency Frequency Object Frequency Object(see below)

Period: [Object] . If the data is to be limited to certain periods then these periods must be listed below.

Name Type Default Description
PrdCode String Period Code
PrdValue String Period Name

Example Parameters:

Example Parameters - Details

{
	"jsonrpc": "2.0",
	"method": "PxStat.Build.Build_API.ReadDataset",
	"params": {
  "MtrInput": "data:application/octet-stream;base64,Q0hBUlNFVD0iQU5TSSI7DQpBWElTLVZFUlNJT049IjIwMDYiOw0KTEFOR1VBR0U9ImVuIjsNCkNSRUFUSU9OLURBVEU9IjIwMjAwOTA0IDEwOjQyIjsNCkRFQ0lNQUxTPTA7DQpTSE9XREVDSU1BTFM9MDsNCk1BVFJJWD0iTVVNMDIiOw0KU1VCSkVDVC1BUkVBPSJDZW5zdXMgb2YgUG9wdWxhdGlvbiI7DQpTVUJKRUNULUNPREU9IkEw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CAxOTE2MjMuMCAzOTEwNzAuMCAzNDM2NDIuMCAyNzgwNDEuMCAyMDcyNzYuMCAxNC42IDMwLjYgMjcuMyAyMi40IDE2LjUgMTQ1Mjk3LjAgMzExMzY1LjAgMjY5Mjc2LjAgMjE0ODI5LjAgDQoxNTg5ODYuMCAxMi41IDI3LjIgMjMuOCAxOS4xIDE0LjEgNDg3MDMuMCA3NDcxMC4wIDc4MzE2LjAgNzM5OTguMCA1NDI1My4wIDM2LjggNjAuMSA2NC40IDYyLjQgNDQuOCAxODcyNTUuMCAyODkxODcuMCAyNzg5NTMuMCAyNTMzNzEuMCAxNzk2NTkuMCAxNi44IDI2LjcgMjYuMiAyNC4xIDE2LjkgMTM4NTUyLjAgMjE0NDc3LjAgMjAwNjM3LjAgMTc5MzczLjAgMTI1NDA2LjAgMTQuMSAyMi40IDIxLjMgMTkuMiAxMy4zOw0K",

"Signature": "787a29a5d4399bf49091d04f2b0051a1",
 "FrqCodeTimeval": null,
  "FrqValueTimeval": null,
  "Labels" : true,
  "Dimension": [
    {
      "LngIsoCode": "en",

      "Frequency": {
        "FrqValue": "Year",
        "Period": [
          {
            "PrdCode": "2020M06",
            "PrdValue": "2020M06"
          },
          {
            "PrdCode": "2020M07",
            "PrdValue": "2020M07"
          }
        ]
      }
    }
  ]
}
}

Return: CSV Template object


ReadDatasetByRelease

Reads a CSV template, by release code, to allow the front end to create an array of Data objects (see Update). This template will include all of the dimensions required for the existing periods (with their values) and new periods (with empty data). This enables users to fill in the template with the required values prior to update.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Build.Build_API.ReadDatasetByRelease

Parameters:

Name Type Default Description
RlsCode Integer Release code
FrqValueTimeval String Where there is no TIMEVAL in the px file, this indicates which dimension is for time
FrqCodeTimeval String Where there is no TIMEVAL in the px file, this indicates the Frequency Code. Must conform to TIMEVAL in https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
Labels Boolean Indicates whether or not we want to see column headers on the returned csv file
Dimension Array [Object] There will be one dimension per language in the px file

Dimension: [Object]

Name Type Default Description
LngIsoCode String Language ISO Code
Frequency Frequency Object Frequency Object(see below)

Period: [Object] . If the data is to be limited to certain periods then these periods must be listed below.

Name Type Default Description
PrdCode String Period Code
PrdValue String Period Name

Example Parameters:

Example Parameters - Details

{
  "jsonrpc": "2.0",
  "method": "PxStat.Build.Build_API.ReadDataset",
  "params": {
  "RlsCode": 83,
  "FrqCodeTimeval": null,
  "FrqValueTimeval": null,
  "Labels" : true,
  "Dimension": [
    {
      "LngIsoCode": "en",

      "Frequency": {
        "FrqValue": "Year",
        "Period": [
          {
            "PrdCode": "2020M06",
            "PrdValue": "2020M06"
          },
          {
            "PrdCode": "2020M07",
            "PrdValue": "2020M07"
          }
        ]
      }
    }
  ]
}
}

Return: CSV Template object

Clone this wiki locally