# API Reference


Public API of tidysdmx -- fetch SDMX schemas from FMR, infer schemas from tidy DataFrames, build structure maps from Excel templates, map data to dissemination schemas, validate datasets, and emit SDMX-ML artefacts ready for FMR upload.


## FMR & Schemas


Fetch and parse SDMX schemas from a Fusion Metadata Registry.


[fetch_schema()](fetch_schema.md#tidysdmx.fetch_schema)  
Fetch the schema of a specified artefact from an SDMX registry.

[fetch_dsd_schema()](fetch_dsd_schema.md#tidysdmx.fetch_dsd_schema)  
Fetch a DSD schema from a Fusion Metadata Registry (FMR).

[parse_artefact_id()](parse_artefact_id.md#tidysdmx.parse_artefact_id)  
Parse an artefact identifier into its components: agency, id and version.

[parse_dsd_id()](parse_dsd_id.md#tidysdmx.parse_dsd_id)  
Parse a DSD identifier into its components.

[create_schema_from_table()](create_schema_from_table.md#tidysdmx.create_schema_from_table)  
Create a DSD, ConceptScheme, and Codelists from a DataFrame.


## Structure Maps


Build, parse, validate, and write SDMX structure maps.


[parse_mapping_template_wb()](parse_mapping_template_wb.md#tidysdmx.parse_mapping_template_wb)  
Read an Excel mapping template and return all sheets as DataFrames.

[build_structure_map_from_template_wb()](build_structure_map_from_template_wb.md#tidysdmx.build_structure_map_from_template_wb)  
Build a complete StructureMap object by parsing a WB-format Excel template.

[build_fixed_map()](build_fixed_map.md#tidysdmx.build_fixed_map)  
Build a pysdmx FixedValueMap for setting a component to a fixed value.

[build_implicit_component_map()](build_implicit_component_map.md#tidysdmx.build_implicit_component_map)  
Build a pysdmx ImplicitComponentMap for implicit mapping rules.

[build_date_pattern_map()](build_date_pattern_map.md#tidysdmx.build_date_pattern_map)  
Build a DatePatternMap object for mapping date patterns between SDMX components.

[build_value_map()](build_value_map.md#tidysdmx.build_value_map)  
Create a pysdmx ValueMap object mapping a source value to a target value.

[build_value_map_list()](build_value_map_list.md#tidysdmx.build_value_map_list)  
Build a list of ValueMap objects from a DataFrame, with optional validity.

[build_multi_value_map_list()](build_multi_value_map_list.md#tidysdmx.build_multi_value_map_list)  
Build a list of MultiValueMap objects from a pandas DataFrame.

[build_representation_map()](build_representation_map.md#tidysdmx.build_representation_map)  
Build a RepresentationMap from a DataFrame via build_value_map_list.

[build_multi_representation_map()](build_multi_representation_map.md#tidysdmx.build_multi_representation_map)  
Build a MultiRepresentationMap object from a pandas DataFrame.

[build_single_component_map()](build_single_component_map.md#tidysdmx.build_single_component_map)  
Build a ComponentMap from a DataFrame, mapping one source to one target.

[collect_structure_map_artifacts()](collect_structure_map_artifacts.md#tidysdmx.collect_structure_map_artifacts)  
Collect the StructureMap and all its dependent RepresentationMaps.

[validate_structure_map_references()](validate_structure_map_references.md#tidysdmx.validate_structure_map_references)  
Validate that all RepresentationMap references are resolved.

[prepare_structure_map_for_upload()](prepare_structure_map_for_upload.md#tidysdmx.prepare_structure_map_for_upload)  
Prepare a StructureMap for upload by collecting all dependencies.


## Mapping


Apply structure maps to tidy DataFrames.


[map_structures()](map_structures.md#tidysdmx.map_structures)  
Apply all mapping components from a StructureMap to a DataFrame.

[apply_fixed_value_maps()](apply_fixed_value_maps.md#tidysdmx.apply_fixed_value_maps)  
Apply FixedValueMap rules to a DataFrame.

[apply_implicit_component_maps()](apply_implicit_component_maps.md#tidysdmx.apply_implicit_component_maps)  
Apply ImplicitComponentMap rules to a DataFrame.

[apply_multi_component_map()](apply_multi_component_map.md#tidysdmx.apply_multi_component_map)  
Apply a single MultiComponentMap with regex and catch-all support.

[map_to_sdmx()](map_to_sdmx.md#tidysdmx.map_to_sdmx)  
Map DataFrame columns to SDMX values using a lookup mapping.

[transform_source_to_target()](transform_source_to_target.md#tidysdmx.transform_source_to_target)  
Transform a raw DataFrame into the format defined by a components map.


## Standardisation


Prepare a mapped DataFrame for SDMX upload.


[standardize_output()](standardize_output.md#tidysdmx.standardize_output)  
Standardize the output DataFrame by adding SDMX reference columns.

[standardize_sdmx()](standardize_sdmx.md#tidysdmx.standardize_sdmx)  
Standardize a DataFrame by applying column and value transformations.

[standardize_data_for_upload()](standardize_data_for_upload.md#tidysdmx.standardize_data_for_upload)  
Standardize a DataFrame for SDMX upload.

[standardize_indicator_id()](standardize_indicator_id.md#tidysdmx.standardize_indicator_id)  
Fix the INDICATOR column to be uppercase and prefixed with dataset ID.

[sanitize_variable()](sanitize_variable.md#tidysdmx.sanitize_variable)  
Sanitize a raw string value into a valid SDMX code ID.

[add_sdmx_reference_cols()](add_sdmx_reference_cols.md#tidysdmx.add_sdmx_reference_cols)  
Add SDMX reference columns to a DataFrame.


## Validation


Validate datasets against schemas and codelists.


[validate_dataset_local()](validate_dataset_local.md#tidysdmx.validate_dataset_local)  
Validate that a DataFrame is SDMX compliant and return a DataFrame of errors.

[validate_columns()](validate_columns.md#tidysdmx.validate_columns)  
Validate that all DataFrame columns are valid components or SDMX references.

[validate_mandatory_columns()](validate_mandatory_columns.md#tidysdmx.validate_mandatory_columns)  
Validate that all mandatory columns are present in the DataFrame.

[validate_codelist_ids()](validate_codelist_ids.md#tidysdmx.validate_codelist_ids)  
Validate that all values in coded columns are within the allowed codelist IDs.

[validate_duplicates()](validate_duplicates.md#tidysdmx.validate_duplicates)  
Validate that there are no duplicate rows for a given set of key columns.

[validate_no_missing_values()](validate_no_missing_values.md#tidysdmx.validate_no_missing_values)  
Validate that there are no missing values in mandatory columns.


## Tidy Raw


Filter and shape raw inputs.


[filter_tidy_raw()](filter_tidy_raw.md#tidysdmx.filter_tidy_raw)  
Filter an SDMX DataFrame by removing rows that violate codelist constraints.

[filter_rows()](filter_rows.md#tidysdmx.filter_rows)  
Filter out rows where values are not in the allowed codelist.


## Utilities


Helpers for codelists, components, Excel templates, and XML.


[extract_validation_info()](extract_validation_info.md#tidysdmx.extract_validation_info)  
Extract validation information from a given schema.

[get_codelist_ids()](get_codelist_ids.md#tidysdmx.get_codelist_ids)  
Retrieve all codelist IDs for given coded components.

[extract_component_ids()](extract_component_ids.md#tidysdmx.extract_component_ids)  
Retrieve all component IDs from a given pysdmx Schema.

[create_mapping_rules()](create_mapping_rules.md#tidysdmx.create_mapping_rules)  
Create Excel hyperlink formulas for components with representation maps.

[build_excel_workbook()](build_excel_workbook.md#tidysdmx.build_excel_workbook)  
Build a Workbook with component mapping and representation map sheets.

[write_excel_mapping_template()](write_excel_mapping_template.md#tidysdmx.write_excel_mapping_template)  
Generate an Excel mapping template with component and representation tabs.

[read_mapping()](read_mapping.md#tidysdmx.read_mapping)  
Read a JSON mapping file and parse its content into DataFrames.

[fix_sdmx_xml_datatype_tags()](fix_sdmx_xml_datatype_tags.md#tidysdmx.fix_sdmx_xml_datatype_tags)  
Fix incorrect SourceCodelist/TargetCodelist tags in SDMX-ML.

[gen_urn()](gen_urn.md#tidysdmx.gen_urn)  
Generate a full SDMX URN for any maintainable artefact.


## QA


Quality-assurance helpers.


[qa_coerce_numeric()](qa_coerce_numeric.md#tidysdmx.qa_coerce_numeric)  
Coerce specified columns to numeric, removing rows with invalid values.

[qa_remove_duplicates()](qa_remove_duplicates.md#tidysdmx.qa_remove_duplicates)  
Remove duplicate rows from a DataFrame.


## Kedro Integration


Kedro pipeline node wrappers.


[kd_read_mappings()](kd_read_mappings.md#tidysdmx.kd_read_mappings)  
Fetch multiple mappings from different files.

[kd_standardize_sdmx()](kd_standardize_sdmx.md#tidysdmx.kd_standardize_sdmx)  
Standardize a partitioned dataset into SDMX format.

[kd_validate_dataset_local()](kd_validate_dataset_local.md#tidysdmx.kd_validate_dataset_local)  
Validate a single DataFrame for SDMX compliance.

[kd_validate_datasets_local()](kd_validate_datasets_local.md#tidysdmx.kd_validate_datasets_local)  
Validate multiple datasets for SDMX compliance.


## Lookups


Vectorised lookup helpers.


[vectorized_lookup_ordered_v1()](vectorized_lookup_ordered_v1.md#tidysdmx.vectorized_lookup_ordered_v1)  
Apply ordered regex matching to a Pandas Series.

[vectorized_lookup_ordered_v2()](vectorized_lookup_ordered_v2.md#tidysdmx.vectorized_lookup_ordered_v2)  
Apply ordered matching (regex or exact) to a Pandas Series.
