Publication Table

From Fusion Registry Wiki
Revision as of 08:17, 28 March 2022 by Mnelson (talk | contribs) (Variables)
Jump to navigation Jump to search

Overview

A Publication Table provides the means to explicitly define the structure and content of a table of data. Publication Tables can make use of variable text placeholders in the table heading, and row and column headings, it can contain variable dimensions in the cells, and include calculated data and time arithmetic. Publication Tables can also display data from multiple SDMX Dataflows in the same table and can even perform calculations across Dataflows.

The following image shows a very simple Publication Table structure, where the table headings contain static text, and each cell describes an observation to show via the series key. Other parts of this table definition describe the table title, subtitle, and what the source Dataflow is.

Publication Table Definition.png
Publication Table.png

Table Cell Syntax

Overview

A Publication Table is made up of two types of cell, a Heading cell (row heading or column heading) and a Table Body cell (in the body of the table). Both Heading cells and body cells can contain free text and variable text. Body cells can refer to data points using the series key syntax, and body cells can also define calculations based on multiple input series.

Variables

Dataflow Variables

Publication Tables define data cells across one or more Dataflows. Each ‘imported’ Dataflow is given an alias, which is used to refer to the Dataflow in the table headings, and table body. It is possible to refer to the Dataflow name, description, and Id using the following variable syntax. The following examples are based on a Dataflow which has been given the alias of 'EXR'

Dataflow Description

$(EXR).desc 

Dataflow Name

$(EXR).name 

Dataflow ID

$(EXR).id 

Text Variables

Table titles, subtitles, heading cell and free text cells can make use of variables for their cell content. These variable types are described in the table below.

Variable Type Description Syntax Example Output
Dataflow Name Displays the name of a Dataflow referenced by the Publication Table in the locale in which the Publication Table is built. When the publication table imports a Dataflow, it gives the Dataflow an alias. The Alias is referenced in the variable. $(EDU) World Bank, Education
Dataflow Description Displays the description of a Dataflow referenced by the Publication Table in the locale in which the Publication Table is built. When the publication table imports a Dataflow, it gives the Dataflow an alias. The Alias is referenced in the variable. $(EDU.desc) World Bank, Education
Dataflow Id Displays the ID of a Dataflow referenced by the Publication Table. $(EDU.id) DF_EDU
A Dimension Name or Value This type of variable exists if one or more of the table body series keys contains a wildcard for the Dimension. For example, if a series key omits a value for the Country Dimension for a given Dataflow, then this Dimension becomes a variable Dimension whose value can be provided at build time. The table headings can then contain a variable placeholder for this dimension which is resolved when the table is built. $(REF_AREA) United Kingdom
Dimension Name or Value This type of variable exists if one or more of the table body series keys contains a wildcard for the Dimension. For example, if a series key omits a value for the Country Dimension for a given Dataflow, then this Dimension becomes a variable Dimension whose value can be provided at build time. The table headings can then contain a variable placeholder for this dimension which is resolved when the table is built. Example Example
Example Example Example Example
Example Example Example Example
Example Example Example Example

Dimension Variables

A Dimension becomes a variable in the Publication Table when one of more Observation Keys has a wildcard placeholder for the Dimension. For example, consider a Dataflow which has 4 Dimensions Frequency, Reference Area, Indictor and Time. An example observation key would look like this:

A:UK:EMP:2008

If we want to wildcard the Indicator Dimension, the value EMP would be omitted from the Observation Key

A:UK::2008

The absence of a value for this Dimension turns the Dimension into a variable whose value can be passed to the API when building an instance of the table, for example ‘build table instance with INDICATOR=EMP’. The table is built, with the observation values resolved against a cell key A:UK:EMP:2008.

This Dimension ‘INDICATOR’ can be referenced as a variable in the table headings, row headings, column headings, and in free text in the table cells or footnotes section.

The syntax for referring to the value used for this dimension is as follows:

$(INDICATOR)

This would resolve to the name of the Indicator value used in the table, for example Employment


Time Variables

When the Publication Table is displaying data for a Time Series Dataflow, the Time Period can be part of the Observation Key. However, time can also be a variable which is resolved at table build time. This variable can also be manipulated by moving forward or backwards ‘n’ number of periods from the ‘base time period’ for which the table is built.

  1. .
  1. A Value for Time Period. When the Publication Table is displaying data for a Time Series Dataflow, the Time Period can be part of the Observation Key. However, time can also be a variable which is resolved at table build time. This variable can also be manipulated by moving forward or backwards ‘n’ number of periods from the ‘base time period’ for which the table is built.
  1. A fixed pointer to a Component Value. This variable references a Component in a DSD or a Component value in a DSD. The variable is resolved to the name of the Component, i.e. ‘reporting Country’ or the a specific value for the Component, i.e. ‘United Kingdom’.
  1. A reference to an imported variable. Codelists and Valuelists which exist in the Fusion Registry can be imported into a Publication Table and given an alias. The table can then reference items in the Codleist/Valuelist which is imported.

Data Cell Syntax

Each data cell in a publication table is defined by a cell key, which resolves to an observation when the table is materialised.

  1. A fully formed cell key consists of Dimension Values for each Dimension including Time Period if the DSD has a Time Dimension.
  2. If there are multiple measures in the DSD the Measure Dimension should also be included.
  3. A cell key can leave out Dimension values, in doing so the Dimension value is treated as a variable, which can be passed in at 'run time' to build the table output
  4. A cell key can leave out Dimension values, in doing so the Dimension value is treated as a variable, which can be passed in at 'run time' to build the table output
  5. A cell key can treat time as a variable, and also provide arithmetic on the Time Dimension to move forwards and backwards in periods, or to change Frequency
  6. A cell key can include calculations

Examples:

|- ! Cell Key !! Description |- | A:UK:EMP:M || Series key without Time |- | A:UK:EMP:M:2008 || Series key with Time |- | A:UK:EMP:M:2008:BIRTHS || Series key with Time and ID of Measure Dimension |- | A:UK:EMP:M:P || Series key with variable Time |- | A::EMP:M:P || Series key with variable dimension and variable Time |- | A:UK:EMP:M:P-1 || Series key with variable Time, which is 1 period before the base period of the table |- | :=A:(UK+FR):EMP:M || A calculated value from 2 series |}


Time Arithmetic Syntax

Syntax Description Example Input Example Output
Example Example Example Example
Example Example Example Example
Example Example Example Example
Example Example Example Example
Example Example Example Example
Example Example Example Example
Example Example Example Example

Variable Syntax