Difference between revisions of "Representation Map"

From FMR Knowledge Base
Jump to navigation Jump to search
(Overview)
(Mapped Values)
Line 14: Line 14:
 
== Mapped Values ==
 
== Mapped Values ==
 
A Representation Map essentially defines a list of mappings, source to target.  Except each mapping map contains multiple sources and multiple targets, and each source may contain rules such as substring matches, or validity periods.
 
A Representation Map essentially defines a list of mappings, source to target.  Except each mapping map contains multiple sources and multiple targets, and each source may contain rules such as substring matches, or validity periods.
 +
 +
{| class="wikitable"
 +
|-
 +
! Source Value !! Sub-String Start !! Sub-String End !! Is RegEx !! Target Value
 +
|-
 +
| GB || - || - || No
 +
| rowspan="3" | MY_NEW_CODE_ID
 +
|-
 +
| A || - || 1 || No
 +
|-
 +
| [xyz] || 2 || 4 || Yes
 +
|}

Revision as of 01:43, 29 January 2021

Overview

SDMX Version 3.0 Representation Maps are used to define a mapping rules between a source value (or combination of values) and a target value (or combination of targets). When a souce value is matched, the target value is output. Representation Maps can be used to map from one classification to another (for example from ISO2 to ISO3 character country codes), or can be used to map from non coded to coded values ($ maps to USD), or more complex mapping which require a combination of source values to generate target values. A Representation Map is more than a simple lookup table, as more complex rules can be introduced such as regular expression matches which can include capture groups to transfer patterns from source to target, substring matches, as well as rules which are only applicable to certain periods of time.

Representation Maps can be used by Structure Maps when defining relationships between two Data Structure Definitions (DSDs). The Structure Maps describe the relationships between the Components of the two DSDs, whilst Relationship Maps are used to describe how the values reported for each component map. For example, a Structure Map may say the COUNTRY Dimension in the source DSD maps to the REF_AREA Dimension in the target DSD - it is then the Relationship Map which describes that the value GB maps to GBR.

Representation Map - Model

Source and Target

A Representation Map can describe the allowable inputs by linking to source Codelists, or Valuelists, if the input is free text then the source is simply defined as Free Text. a Representation Map is not restricted to one source, it can define multiple, of mixed types. A combination of source values is a typical use case when a Representation Map is used by a Structure Map which is mapping more than one source component. For example, a Structure Map may state that the combination of REF_AREA and CURRENCY are used to derive an output value. The corresponding Representation Map would then have to include 2 sources, one for REF_AREA and the other for CURRENCY. A rule may state that the UK in combination with USD maps to a certain output value, whilst the UK in combination with GBP maps to another value.

A Representation Map has the same options for the targets, in that a target can link to a Codelist, Valuelist, or simply describe itself as a free text target (any textual content is valid).

An example Representation Map which maps from ISO2 to ISO3 Country Codes may define a single source Codelist of CL_ISO2_COUNTRIES and a target of CL_ISO3_COUNTRIES. Mapped source values will be code Ids in the ISO2 Codelist and the corresponding target will be codes in the ISO3 Codelist. It is perfectly valid to create the same mapping rules between ISO2 codes and ISO3 codes without linking the Representation Map to any source codelist or target codelist (just define both source and target as free text). The mapped values are the same, GB maps to GBR for example. The reason to link to the Country Codelist tells the user of the map, the intent of the mapping (to map between country codelists). It is also helpful to discover mappings for codelists (to ask the question which mappings exist for ISO2 Countries), and to ensure referential integrity (a Code can not be deleted from the Codelist if it is used in a Mapping Rule).

Mapped Values

A Representation Map essentially defines a list of mappings, source to target. Except each mapping map contains multiple sources and multiple targets, and each source may contain rules such as substring matches, or validity periods.

Source Value Sub-String Start Sub-String End Is RegEx Target Value
GB - - No MY_NEW_CODE_ID
A - 1 No
[xyz] 2 4 Yes