Skip to main content

mapping utility tool for sdmx based partial mappings

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mappings_utility-0.2.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

mappings_utility-0.2.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file mappings_utility-0.2.2.tar.gz.

File metadata

  • Download URL: mappings_utility-0.2.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.11 Windows/10

File hashes

Hashes for mappings_utility-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8a1c624a36ef6a997805043c922d5839851952c1c6908f277c65b5d34dcdec1d
MD5 4c437c7b653078a0c00b239273ca14d1
BLAKE2b-256 feac93a6374dc16f68bb307f5b33443c3127bf29afa3ba288d3d4c91124d99a0

See more details on using hashes here.

File details

Details for the file mappings_utility-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mappings_utility-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 74254b279fc39052495d47d4a9874eee7d89cb7c774785f700c976d5611a8c95
MD5 b49fff540c00744e01c7f84c6d122c30
BLAKE2b-256 59493dfef5c5c2fcbbd9b4998fd5ec7ab819d7bae89c31b9e410f34ee28d88c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page