pain001.migration package#

Migration helpers for ISO 20022 version upgrades.

Submodules#

pain001.migration.version_mapper module#

ISO 20022 payment data version migration utilities.

class pain001.migration.version_mapper.VersionMapper[source]#

Bases: object

Migrate payment rows from older pain.001 variants to newer ones.

classmethod default_output_path(source_path: str, to_version: str) → str[source]#

Build the default migrated CSV path next to the source file.

load_mapping(from_version: str, to_version: str) → dict[str, Any][source]#

Load YAML mapping or fall back to generic legacy-to-modern mapping.

migrate_file(source_path: str, from_version: str, to_version: str) → list[dict[str, Any]][source]#

Load, migrate, and return payment rows from a source file.

migrate_rows(rows: list[dict[str, Any]], from_version: str, to_version: str) → list[dict[str, Any]][source]#

Migrate loaded payment rows to the target version shape.

static normalize_version(version: str) → str[source]#

Normalize short or full version labels to vNN form.

validate_migrated_rows(rows: list[dict[str, Any]], to_version: str) → bool[source]#

Validate migrated rows by generating target-version XML.

write_csv(rows: list[dict[str, Any]], output_path: str) → str[source]#

Persist migrated rows as CSV.

pain001.migration.version_mapper.cast_list_mapping(value: object) → dict[str, list[str]][source]#

Cast a YAML mapping whose values are field-name lists.

pain001.migration.version_mapper.cast_mapping(value: object) → dict[str, Any][source]#

Cast a mapping loaded from YAML into a typed dictionary.