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.2.0b0.tar.gz (440.9 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.2.0b0-py3-none-any.whl (448.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sirp_dsi_converter-1.2.0b0.tar.gz
  • Upload date:
  • Size: 440.9 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.2.0b0.tar.gz
Algorithm Hash digest
SHA256 e88451f474dae9bb972e2db56fbe25f78d7ea97297c6f17997a9109d8850c870
MD5 aee9deedea7bf0daca5981fa954f1a0d
BLAKE2b-256 46c9aa21b07b862bc4176df7a88cc55dd88d719446c147b0940dc4ede8f4ecf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sirp_dsi_converter-1.2.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 db3244ad5df5151291127ac406236759e05f3b540eae1570b43a6ec30e38d16f
MD5 b2bbea5d4c668d36ef000fac8006c033
BLAKE2b-256 c0fb165ca1677b9482b5db3d2a913074f61fb69715222e2b43ecf3441350eb97

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