create_schema_from_table()

Create a DSD, ConceptScheme, and Codelists from a DataFrame.

Usage

Source

create_schema_from_table(
    dataframe,
    dimensions,
    measure,
    time_dimension,
    attributes=None,
    agency_id="WB.DP",
    schema_id="DP_SCHEMA",
    version="1.0",
    uppercase_code_ids=True
)

Parameters

dataframe: pd.DataFrame

The source DataFrame.

dimensions: list[str]

Column names to use as SDMX dimensions.

measure: str

Column name to use as the SDMX measure.

time_dimension: str

Column name to use as the SDMX time dimension.

attributes: list[str] | None = None

Optional column names to use as SDMX attributes.

agency_id: str = "WB.DP"

Agency identifier for the generated artefacts.

schema_id: str = "DP_SCHEMA"

Base identifier for the generated DSD and concept scheme.

version: str = "1.0"

Version string for the generated artefacts.

uppercase_code_ids: bool = True
If True (default), codelist code IDs are uppercased. Set to False to preserve the original casing of code values.

Returns

SchemaComponents: SchemaComponents
A named tuple with dsd, concept_scheme, and codelists fields.

Raises

ValueError
If any of the specified column names are missing from the DataFrame.