build_date_pattern_map()

Build a DatePatternMap object for mapping date patterns between SDMX components.

Usage

Source

build_date_pattern_map(
    source,
    target,
    pattern,
    frequency,
    id=None,
    locale="en",
    pattern_type="fixed",
    resolve_period=None
)

Parameters

source: str

The ID of the source component.

target: str

The ID of the target component.

pattern: str

The SDMX date pattern describing the source date (e.g., “MMM yy”).

frequency: str

The frequency code or reference (e.g., “M” for monthly).

id: str | None = None

Optional map ID as defined in the registry.

locale: str = "en"

Locale for parsing the input date pattern. Defaults to “en”.

pattern_type: Literal["fixed", "variable"] = "fixed"
Type of date pattern. Defaults to “fixed”.
  • “fixed”: frequency is a fixed value (e.g., “A” for annual).
  • “variable”: frequency references a dimension or attribute (e.g., “FREQ”).
resolve_period: Literal["startOfPeriod", "endOfPeriod", "midPeriod"] | None = None
Point in time to resolve when mapping from low to high frequency periods.

Returns

DatePatternMap
A fully constructed DatePatternMap instance.

Raises

ValueError

If any required argument is empty or invalid.

TypeError
If argument types do not match expected types.

Examples

>>> dpm = build_date_pattern_map(
...     source="DATE",
...     target="TIME_PERIOD",
...     pattern="MMM yy",
...     frequency="M"
... )
>>> print(dpm)
source: DATE, target: TIME_PERIOD, pattern: MMM yy, frequency: M