prepare_structure_map_for_upload()

Prepare a StructureMap for upload by collecting all dependencies.

Usage

Source

prepare_structure_map_for_upload(
    structure_map,
    validate=True,
)

This is a convenience function that combines validation (optional) and artifact collection.

Parameters

structure_map: StructureMap

The StructureMap to prepare.

validate: bool = True
If True, validates that all references are resolved. Defaults to True.

Returns

list[MaintainableArtefact]
A list of all artifacts ready to write/upload.

Raises

ValueError
If validate=True and unresolved references are found.

Examples

    >>> from pysdmx.api.fmr.maintenance import (
    ...     RegistryMaintenanceClient, StructureAction,
    ... )
    >>> from tidysdmx.structure_map_writer import prepare_structure_map_for_upload
    >>>
    >>> # Prepare artifacts
    >>> artifacts = prepare_structure_map_for_upload(my_structure_map)
    >>>
    >>> # Upload to FMR
    >>> client = RegistryMaintenanceClient(
    ...     api_endpoint="https://your-fmr/sdmx/v2/",
    ...     user="username",
    ...     password="password"
    ... )
    >>> client.put_structures(artifacts, action=StructureAction.Replace)