Skip to main content

Standardized hub for unit of measure conversions across systems and dimensions.

Project description

Syngenta Digital Units of Measure

Centralized source of canonical unit of measures for lookup and conversion

Definitions

  • Unit of measure code (“UoM Code”): A small string/token that forms part of a controlled vocabulary (e.g., ADAPT, UN Rec 20, UCUM, QUDT) and represents a unit of measure (e.g., “meter”)
  • Input Code Vocabulary (“UoM Voc”): A small string/token that represents the controlled vocabulary that a unit of measure code belongs to (e.g., “ADAPT”, “UCUM”).
  • Dimension: a label for a family of units of measure that represent the same phenomenon. For example, “DISTANCE” represents a phenomenon represented by “meter”, “mile”, “inch”, “millimeter”, etc. We have a controlled vocabulary of these dimensions.
  • Unit of measure System: A family of units of measure (cutting across all dimensions) that have a common cultural origin or organizing principles (e.g., “METRIC”, “IMPERIAL”).

Features

Retrieve the dimension of a given unit of measure

from syngenta_digital_uoms.common.vocabulary import Vocabulary

def retrieve_dimension_from_uom():
    vocabulary = Vocabulary()
    return vocabulary.get_dimension('min') # Returns 'TIME'

Retrieve list of unique dimensions from respective vocabulary

from syngenta_digital_uoms.common.vocabulary import Vocabulary

def retrieve_dimensions():
    vocabulary = Vocabulary(vocab_type='adapt') # 'adapt' is the default vocabulary type
    return vocabulary.list_dimensions()

Retrieve list of all units of measure from a given dimension

from syngenta_digital_uoms.common.vocabulary import Vocabulary

def retrieve_uoms_from_dimension():
    vocabulary = Vocabulary()
    return vocabulary.list_dimension_uoms('DISTANCE')

Retrieve canonical unit of measure from given dimension

from syngenta_digital_uoms.common.vocabulary import Vocabulary

def retrieve_uoms_from_dimension():
    vocabulary = Vocabulary()
    return vocabulary.get_canonical_uom('DISTANCE') # Returns 'm', as meter is the canonical unit of the DISTANCE dimension.

Retrieve the canonical unit of measure from a given unit's dimension

from syngenta_digital_uoms.util.converter import Converter

def convert_uom_to_canonical():
    converter = Converter()
    return converter.convert_uom('ft') # Returns 'm', as meter is the canonical unit of the DISTANCE dimension.

Convert a given value across units of measure

from syngenta_digital_uoms.util.converter import Converter

def convert_value_across_uoms():
    converter = Converter()
    return converter.convert_value(input_uom_code='ft',
                                   input_value=100,
                                   output_uom_code='km') # Returns 0.03048, as 100 feet is equivalent to 0.03048 kilometers.

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

syngenta_digital_uoms-0.0.8.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syngenta_digital_uoms-0.0.8-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file syngenta_digital_uoms-0.0.8.tar.gz.

File metadata

  • Download URL: syngenta_digital_uoms-0.0.8.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.6

File hashes

Hashes for syngenta_digital_uoms-0.0.8.tar.gz
Algorithm Hash digest
SHA256 51cdba95019a3317c258831364268a5a6017a6ce6fce884eca0d0f477e14a3f1
MD5 4f23830992a3ee28220dd9ac3c1f9d40
BLAKE2b-256 6139d4a79bbbd3a23f21afe2e9c1c389d0297bde5bc78bab2507fd6897b417eb

See more details on using hashes here.

File details

Details for the file syngenta_digital_uoms-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for syngenta_digital_uoms-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2b3060db53bbc223ababc8baa6b9c54250ca67ef81504ba64ecafa493ac10843
MD5 63170274ff342784852dd0e86e61ad0b
BLAKE2b-256 e6f1be26f1f2b691538d3d4684991b73f24144a4531f7cfcc706587436b2c2f5

See more details on using hashes here.

Supported by

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