This release is a pre-release and may not be stable for production use.
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)
Metadata
Release files for sirp-dsi-converter 1.2.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sirp_dsi_converter-1.2.0b0.tar.gz | 440.9 kB | Without provenance | Details for sirp_dsi_converter-1.2.0b0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sirp_dsi_converter-1.2.0b0-py3-none-any.whl | Python 3 | none | any | Details for sirp_dsi_converter-1.2.0b0-py3-none-any.whl |
Total release size: 889.7 kB
Release files / sirp_dsi_converter-1.2.0b0.tar.gz
| Download URL | sirp_dsi_converter-1.2.0b0.tar.gz |
|---|---|
| Size | 440.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e88451f474dae9bb972e2db56fbe25f78d7ea97297c6f17997a9109d8850c870
|
|
BLAKE2b-256 checksum How to use checksums |
46c9aa21b07b862bc4176df7a88cc55dd88d719446c147b0940dc4ede8f4ecf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / sirp_dsi_converter-1.2.0b0-py3-none-any.whl
| Download URL | sirp_dsi_converter-1.2.0b0-py3-none-any.whl |
|---|---|
| Size | 448.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db3244ad5df5151291127ac406236759e05f3b540eae1570b43a6ec30e38d16f
|
|
BLAKE2b-256 checksum How to use checksums |
c0fb165ca1677b9482b5db3d2a913074f61fb69715222e2b43ecf3441350eb97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for sirp-dsi-converter 1.2.0b0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.