Category schemes

Note

Additional information about how category schemes can be used to drive processes like creating a filesystem layout to archive data is available in the following tutorial:

Model for SDMX Categories.

An example of a category scheme is one which categorises data, sometimes known as a subject matter domain scheme or a data category scheme.

class pysdmx.model.category.Category(id: str, uri: str | None = None, urn: str | None = None, name: str | None = None, description: str | None = None, categories: Sequence[Category] = (), dataflows: Sequence[Dataflow | DataflowRef] = (), *, annotations: Sequence[Annotation] = ())

A category, ie a way to organize and group things.

Categories are used to organize and group other artefacts in SDMX. A typical example would be to organize dataflows by topics (e.g. derivatives, exchange rates, etc.)

Categories can be nested, up to any level of depth and, therefore, a category is iterable.

id

The category ID (e.g. TOPIC_001)

name

The category name (e.g. “Locational banking statistics”)

description

Additionale descriptive information about the category (e.g. “These statistics cover the balance sheets of internationally active banks.”)

categories

The sub-categories, i.e. the categories belonging to the category.

dataflows

The list of dataflows attached to the category.

class pysdmx.model.category.CategoryScheme(id: str, uri: str | None = None, urn: str | None = None, name: str | None = None, description: str | None = None, version: str = '1.0', valid_from: datetime | None = None, valid_to: datetime | None = None, is_final: bool = False, is_external_reference: bool = False, service_url: str | None = None, structure_url: str | None = None, agency: str | Agency = '', items: Sequence[Category] = (), is_partial: bool = False, *, annotations: Sequence[Annotation] = ())

An immutable collection of categories, likes a list of topics.

A category scheme is maintained by its agency, typically, an organisation like the BIS, the ECB, the IMF, SDMX, etc.

A category scheme has an identifier and a name. It may also have a description and version.

A category scheme is iterable.

While every category contains the list of dataflows attached to it, the dataflows property of the CategoryScheme can be used to retrieve (as a set) the list of dataflows attached to any of the categories in the scheme.

id

The identifier for the scheme (e.g. STAT_SUBJECT_MATTER).

name

The scheme name (e.g. “SDMX Statistical Subject-Matter Domains”).

agency

The maintainer of the scheme (e.g. SDMX).

description

Additional descriptive information about the scheme (e.g. “The SDMX Content Guidelines for Statistical Subject-Matter Domains”).

version

The scheme version (e.g. 1.0)

property categories: Sequence[Category]

The list of top level categories in the scheme.

property dataflows: Sequence[DataflowRef] | Sequence[Dataflow]

Return the dataflows attached to any category in the scheme.

class pysdmx.model.category.DataflowRef(agency: str, id: str, version: str = '1.0', name: str | None = None)

A unique reference to a dataflow.

id

The dataflow identifier (e.g. BIS_MACRO).

agency

The organisation (or unit) responsible for the dataflow.

version

The version of the dataflow (e.g. 1.0).

name

The name of the dataflow. This is optional as, typically, a dataflow reference wouldn’t have this information, but it has been added as it can be useful in a data discovery scenario, for example, in category scheme queries.