QueryBuilder

SDMX API v1

class sdmxthon.webservices.query_builder.SdmxWs1

Bases: SdmxWebservice

Generic Sdmx Ws 1 implementation for queries that do not change

CONSTRAINTS_MODE_OPTIONS = ['exact', 'available']
REFERENCES_OPTIONS = ['none', 'parents', 'parentsandsiblings', 'children', 'descendants', 'all']
STRUCTURE_DETAIL_OPTIONS = ['allstubs', 'referencestubs', 'referencepartial', 'allcompletestubs', 'referencecompletestubs', 'full']
get_constraints(flow, key=None, provider=None, component_id=None, mode=None, references=None, start_period=None, end_period=None, updated_after=None)

Returns URL and params to get the constraints

Parameters:
  • flow – The id of the dataflow

  • key – The key is constructed as a dot (‘.’) separated list of dimension filtered values.

  • provider – The provider of the dataflow

  • component_id – The component id of the dataflow

  • mode – The mode parameter (exact, available)

  • references – The references parameter (all, children, descendants, parents, parentsandsiblings)

  • start_period – The start period of the dataflow

  • end_period – The end period of the dataflow

  • updated_after – Data filtered by the last update date

Returns:

The URL and params formatted

get_data(flow, key=None, provider=None, start_period=None, end_period=None, updated_after=None, first_n_observations=None, last_n_observations=None, dimension_at_observation=None, detail=None, include_history=None) str

Returns URL and params to get data

Parameters:
  • flow – The id of the dataflow

  • key – The key is constructed as a dot (‘.’) separated list of dimension filtered values.

  • provider – The provider of the dataflow

  • start_period – Start period of the dataflow

  • end_period – End period of the dataflow

  • updated_after – Data filtered by the last update date

  • first_n_observations – Number of first observations to be returned per key (int)

  • last_n_observations – Number of last observations to be returned per key (int)

  • dimension_at_observation – The dimension at observation

  • detail – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)

  • include_history – Value to include history (true, false)

Returns:

The URL and params formatted

get_data_flows(agency_id=None, resources=None, version=None, references=None, detail=None) str

Returns URL and params to get dataflows

Parameters:
  • agency_id – The agency id of the dataflows

  • resources – The resources to query

  • version – The version of the dataflows

  • references – The references parameter (all, children, descendants, parents, parentsandsiblings)

  • detail – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)

Returns:

The URL and params formatted

get_dsds(resources=None, agency_id=None, version=None, references=None, detail=None)

Returns URL and params to get the Data Structure Definitions

Parameters:
  • resources – The resources to query

  • agency_id – The agency id of the dataflows

  • version – The version of the dataflows

  • references – The references parameter (all, children, descendants, parents, parentsandsiblings)

  • detail – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)

Returns:

The URL and params formatted

SDMX API v2

class sdmxthon.webservices.query_builder.SdmxWs2p0

Bases: SdmxWebservice

SDMX Web Service 2.0 specification

Parameters:
  • REFERENCES_OPTIONS (list[str]) – The allowed values for the references parameter (none, parents, parentsandsiblings, children, descendants, all)

  • STRUCTURE_DETAIL_OPTIONS (list[str]) – The allowed values for the detail parameter (allstubs, referencestubs, referencepartial, allcompletestubs, referencecompletestubs, full)

  • DATA_DETAIL_OPTIONS (list[str]) – The allowed values for the detail parameter

REFERENCES_OPTIONS = ['none', 'parents', 'parentsandsiblings', 'children', 'descendants', 'all']
STRUCTURE_DETAIL_OPTIONS = ['allstubs', 'referencestubs', 'referencepartial', 'allcompletestubs', 'referencecompletestubs', 'full']
get_constraints(flow, key=None, provider=None, component_id=None, mode=None, references=None, start_period=None, end_period=None, updated_after=None)

Returns URL and params to get the constraints

Parameters:
  • flow (str) – The id of the dataflow

  • key (str) – The key is constructed as a dot (‘.’) separated list of dimension filtered values.

  • provider (str) – The provider of the dataflow

  • component_id (str) – The component id of the dataflow

  • mode (str) – The mode parameter (exact, available)

  • references (str) – The references parameter (all, children, descendants)

  • start_period (str) – The start period of the dataflow

  • end_period (str) – The end period of the dataflow

  • updated_after (str) – Data filtered by the last update date

get_data(dataflow_id, provider=None, version=None, key=None, start_period=None, end_period=None, updated_after=None, first_n_observations=None, last_n_observations=None, dimension_at_observation=None, detail=None, include_history=None)

Returns URL and params to get data

Parameters:
  • dataflow_id – The id of the dataflow

  • provider – The provider of the dataflow

  • version – The version of the dataflow

  • key – The key is constructed as a dot (‘.’) separated list of dimension filtered values.

  • start_period – Start period of the dataflow

  • end_period – End period of the dataflow

  • updated_after – Data filtered by the last update date

  • first_n_observations – Number of first observations to be returned per key

  • last_n_observations – Number of last observations to be returned per key

  • dimension_at_observation – The dimension at observation

  • detail – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)

  • include_history – Value to include history (true, false)

Returns:

The URL and params formatted

get_data_flows(agency_id, resources=None, version=None, references=None, detail=None) str

Returns URL and params to get dataflows

Parameters:
  • agency_id – The agency id of the dataflows

  • resources – The resources to query

  • version – The version of the dataflows

  • references – The references parameter (all, children, descendants)

  • detail – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)

Returns:

The URL and params formatted

get_dsds(resources, agency_id, version, references=None, detail=None)

Returns URL and params to get the Data Structure Definitions

Parameters:
  • resources (str) – The resources to query

  • agency_id (str) – The agency id of the dataflows

  • version (str) – The version of the dataflows

  • references (str) – The references parameter (all, children, descendants)

  • detail (str) – The detail parameter (full, referencestubs, referencepartial, allstubs, allcompletestubs, referencecompletestubs)