Skip to main content

An SDMX mapping utility to generate partial key maps for referential metadata. Although not designed to do that, data mappings are also possible. The package is structured in such a way that it can be used as a package without the FASTAPI overhead.

Three methods are available:

  • map_withFile GET method (receiving the mapping source and mapping rules both as file references)
  • map_withURN GET method (receiving the mapping source as file and the mapping rules as SDMX registry endpoint + mapping ID)
  • map_json_withURN POST method (receiving the mapping source as the body of the request in json - pandas dataframe dictionary style - and mapping rules as SDMX registry endpoint + mapping ID) (added in version 0.1.1)

A typical usage example in package mode:

    from mappings_utility.sdmx_mapping_utility import SDMXMappingUtility 
    
    mf = Path('to-mapping-artefacts.xml')
    sf = Path('to-file-to-be-mapped.csv')
    mu = SDMXMappingUtility.initialise_with_file(mf, sf, sid_based=False)
    df = mu.generate_mappings_partial_keys(
        includeSourceColumns=False,
        includeAttributesMeasures=False,
        nulledFixedTargets=True,
        writeTargetStructInfo=False,
        dropInvalid=False,
        sid_based=False
        )
    df.to_csv(Path('mapped-file.csv'), index=False)

The parameters fine-tune the output file:

  • includeSourceColumns: True/False; when set to True the resulting file would include the fields of the source csv file
  • includeAttributesMeasures: True/False; when True it will include the attribute columns and obs_value, otherwise it will suppress those from the output (this is needed for referential metadata partial key mappings)
  • nulledFixedTargets: True/False, when True fixed values in the target mapping will be set to Null, also a partial-key mapping motivated feature
  • writeTargetStructInfo: True/False, when True it adds or maps columns necessary for the output to be SDMX-CSV compliant
  • dropInvalid: True/False, when set to True the output only contains valid mappings (although validity checks are lazy), invalid rows are ommitted; with False the returned dataframe will contain cells with a special string highlighting the positions where the target value could not be determined
  • sid_based: True/False, when set to True the resulting file will contain a Series ID (SID) field with the dimensions of the target data model dot-concatenated

Changelog:

  • Version 0.2.3 Introduced validation for implicit maps (target codes are checked whether they are in the referenced codelist - constraints are not yet taken into account)
  • Version 0.2.4 Bug-fix for regex substitution (previously substitutions with more than one substitution failed)
  • Version 0.2.5
    • Attributes scaffolding for future features (validates coded attributes)
    • Bug-fix for optional attributes missing when all values are null

Metadata

Release files for mappings_utility 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mappings_utility 0.2.7
File Size Uploaded Provenance Actions
mappings_utility-0.2.7.tar.gz 10.1 kB Without provenance Details for mappings_utility-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mappings_utility 0.2.7
File Interpreter ABI Platform Actions
mappings_utility-0.2.7-py3-none-any.whl Python 3 none any Details for mappings_utility-0.2.7-py3-none-any.whl

Total release size: 22.0 kB

Release files / mappings_utility-0.2.7.tar.gz

Download URL mappings_utility-0.2.7.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
14d3e255d675761931939c01fe862dc31d3aa889f768a6022daa3c9971103835
BLAKE2b-256 checksum
How to use checksums
40b5af2acbfc0946998b052932ee0bfbf3d6e796d84104ffba797756f8463490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.7 Windows/11

Release files / mappings_utility-0.2.7-py3-none-any.whl

Download URL mappings_utility-0.2.7-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a51fb34816753cc84a68bfffca89463bf8ef0c37e6e4cad36cd04131d40a6556
BLAKE2b-256 checksum
How to use checksums
14c9f14a0ba24d6b0505c33e09a7f34537d1bfec08f3dec68c2e52f34a7fcfe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.7 Windows/11

Security for mappings_utility 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page