build_multi_representation_map()

Build a MultiRepresentationMap object from a pandas DataFrame.

Usage

Source

build_multi_representation_map(
    df,
    agency="FAKE_AGENCY",
    id=None,
    name=None,
    source_cls=None,
    target_cls=None,
    version="1.0",
    description=None,
    source_cols=None,
    target_cols=None,
    valid_from_col="valid_from",
    valid_to_col="valid_to"
)

Wraps the creation of individual MultiValueMap objects and bundles them into a MultiRepresentationMap container.

Parameters

df: pd.DataFrame

DataFrame where each row represents a multi-mapping.

agency: str = "FAKE_AGENCY"

Agency maintaining the map. Defaults to “FAKE_AGENCY”.

id: str | None = None

Identifier for the map.

name: str | None = None

Name of the map.

source_cls: list[str] | None = None

URNs/IDs for source codelists/types.

target_cls: list[str] | None = None

URNs/IDs for target codelists/types.

version: str = "1.0"

Version of the map. Defaults to “1.0”.

description: str | None = None

Description of the map.

source_cols: list[str] | None = None

Source columns. Defaults to [“source”].

target_cols: list[str] | None = None

Target columns. Defaults to [“target”].

valid_from_col: str = "valid_from"

Validity start column. Defaults to “valid_from”.

valid_to_col: str = "valid_to"
Validity end column. Defaults to “valid_to”.

Returns

MultiRepresentationMap
The constructed MultiRepresentationMap object.

Raises

ValueError

If DataFrame is empty or columns are missing.

TypeError
If non-string data is found in source/target columns.