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
Built Distribution
Close
Hashes for syngenta_digital_uoms-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f3ee1ade3ea07eae402159a0a91f9201d5e9a99ca925ba5d8f38252eb77eebc |
|
MD5 | 8c4bba6c96158f0c9461ea4771eca898 |
|
BLAKE2b-256 | 0b2acc17455f68873072af4418fdf286b9154e32b5b630ded17bb8a15c8bac5b |
Close
Hashes for syngenta_digital_uoms-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e726d7edc696aa848d49fc8c9e605c3470e51d6db60478fe919b58e1fecb8293 |
|
MD5 | fb605da3bdab95b13899aac68cfe7f97 |
|
BLAKE2b-256 | 993a384e64bf49eaa588b69a1c9c3cc268a8820ff9dfcb2863b71fba3125e245 |