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.0.0b0.tar.gz (15.6 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.0.0b0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sirp_dsi_converter-1.0.0b0.tar.gz
  • Upload date:
  • Size: 15.6 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.0.0b0.tar.gz
Algorithm Hash digest
SHA256 4c957c09a544d06d28b4c8ea48f83e6a7d1d2a2cb4574aaa9cc42126bbe67e4f
MD5 379aa42218d61a549abc03d29d4d33d4
BLAKE2b-256 f7e640123e9b298a6160e519e02da5a039fe6b662f93ca370e44eb87d74860fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sirp_dsi_converter-1.0.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 e10143dee454d3194bd29883dde277b542f1232b787443acc49bafa9416726c4
MD5 6db1c2689485561cc00b4447794d2843
BLAKE2b-256 861b5c02e7fc0fd42ca68d88565aaef94402fe29ed00f4febddb8e60664acee9

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