Skip to main content

A converter between D-SI and SI Reference Point unit formats

Project description

SIRP-D-SI Converter Service

This software ensures the reliability of the D-SI Syntax by testing its internal syntax consistencies and by providing metadata within the SI Reference Point (SIRP), which relates to prefixes, units, and exponents.

The software accepts Base or Compound Units in D-SI unit syntax and provides several pieces of information about the input:

  • Its consistency according to the D-SI Syntax.

  • Its transformation into Prefixes, Units and Exponents SIRP Syntax.

  • Its representation as a Permanent Identifier according to SIRP.

  • Its representation as an RDF structure according to SIRP.

  • Its Metadata from the SIRP framework.

Code Files

Several D-SI Compound Units are being shown as examples to demonstrate the functionality of the software.

transformation.py:

This file handles the validation and transformation logic.

app.py:

This file serves as the flask interface.

test.py:

This file serves as an example of how the classes from the transformation.py can be used inside any other software

Classes

There are four main classes that can be accessed externally:

  • class verboseDsiCompoundUnitValidation

The function messageResponse(compoundunit) within the class provides detailed information regarding the validation of the D-SI Compound Unit. If the input Compound Unit is valid, the information detailed above. If it is invalid, the class returns different messages depending on whether the Compound Unit is a valid D-SI unit or not. Additionally, it offers suggestions for correcting the input Compound Unit.

  • class jsonDsiCompoundUnitValidation

The function messageResponse([string]) within the class provides detailed information regarding the validation of the D-SI Compound Unit. If the input Compound Unit is valid, the information detailed above. If it is invalid, the class returns different messages depending on whether the Compound Unit is a valid D-SI unit or not. Additionally, it offers suggestions for correcting the input Compound Unit.

  • class compoundUnitValidation

The funtion validation([string]) within the class performs the validation and stores the results in variables that can be accessed externally.

  • class dsiValidator

This is used to interact from the power shell.

Example Usage

Prerequisites for everything except the web server:

This is an example of how to list things you need to use the software and how to install them.

  • python
    pip install rdflib
    pip install re
    pip install sys
    pip install pprint
    

dsiValidator

  • python
python trasformation.py -h
#shows the help
  • python
python trasformation.py -json \metre
#inputs the DSI unit after the '-json' and returns information about the unit in json format
  • python
python trasformation.py -v \metre
#inputs the DSI unit after the '-v' and returns information about the unit in a verbose way

test.py

#input:
info=compoundUnitValidation('\\metre')
info.validation()
#variables that can be accessed:
print(f"The {info.input_compound_unit} validation is: {info.valid_dsi_unit}")
print(f"The unit has an SIRP correspondance: {info.output_sirp_correspondance}")
print(f"The system has a message: {info.output_human_message}")
print(f"The SIRP PID Unit is: {info.output_pid}")
print(f"The SIRP Unit is: {info.output_compound_unit}")

Terminology

  • D-SI Prefix: (e.g. \milli, \kilo, etc.)

  • D-SI Unit: (e.g. \gram, \candela, \metre, etc.)

  • D-SI Exponent: (e.g. \tothe{5}, etc.)

  • SIRP Prefix: (e.g. milli, kilo, etc.)

  • SIRP Unit: (e.g. gram, candela, metre, etc.)

  • SIRP Symbol: (e.g. m, s, kg)

  • SIRP Exponent: (e.g. -1, 2, 5, etc.)

  • SIRP Compound Unit Symbol: (e.g. m-1, m·s-2, kg)

  • SIRP Compound Unit PID: (e.g. https://si-digital-framework.org/SI/units/millisecond-1)

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

sirp_dsi_converter-1.1.2b0.tar.gz (440.8 kB view details)

Uploaded Source

Built Distribution

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

sirp_dsi_converter-1.1.2b0-py3-none-any.whl (448.8 kB view details)

Uploaded Python 3

File details

Details for the file sirp_dsi_converter-1.1.2b0.tar.gz.

File metadata

  • Download URL: sirp_dsi_converter-1.1.2b0.tar.gz
  • Upload date:
  • Size: 440.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for sirp_dsi_converter-1.1.2b0.tar.gz
Algorithm Hash digest
SHA256 3a1fd0cda8d7cdc337260bdc6393772eeaef68d07c7b011ba9f83c081966abed
MD5 7fa794c8ff0505d5fcba1b22d4d16f68
BLAKE2b-256 7ff92543d58f70fd6316856c44b17728b0062f8b544787fbe3757b7d377b7d62

See more details on using hashes here.

File details

Details for the file sirp_dsi_converter-1.1.2b0-py3-none-any.whl.

File metadata

File hashes

Hashes for sirp_dsi_converter-1.1.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 0767a90e45c308caa98f9f0b733e76babea08d00c692b3d69cf7119ae11b78d7
MD5 53ea38eeea19294c72cb6034105e60f4
BLAKE2b-256 e36a89fb909b3806be3f41de09ac799c2d98e1be8b532414a9664bc3dfd3d929

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