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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sirp_dsi_converter-1.1.0b0.tar.gz.
File metadata
- Download URL: sirp_dsi_converter-1.1.0b0.tar.gz
- Upload date:
- Size: 440.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d68191c926eec8931b55d53c5e8d973a3a47f10d4b83827602329e4ef400c3
|
|
| MD5 |
01e8f527fedc72ecd924ac8be5fd12f5
|
|
| BLAKE2b-256 |
87c90d64d7427246ab34cd9e960aff1b090f73d2ce0074199aa33555026c9857
|
File details
Details for the file sirp_dsi_converter-1.1.0b0-py3-none-any.whl.
File metadata
- Download URL: sirp_dsi_converter-1.1.0b0-py3-none-any.whl
- Upload date:
- Size: 448.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a9b39ba99d0f58c63cc246c56620c7dcd654e81cd45e830a204200aaeb8218
|
|
| MD5 |
2b085478390b23d50648439a9fb07336
|
|
| BLAKE2b-256 |
0a6988984dee0b356729452728ac7cd95b602001d45584a360b8fb0884065cfa
|