tag-data-translation
GS1 EPC Tag Data Translation for Python and RAIN (UHF) RFID. Encode and decode SGTIN, SSCC, SGLN, GRAI, and all EPC schemes defined in TDT 2.2 and TDS 2.3.
Requirements
- Python 3.9+
- .NET 8.0+ runtime (download)
Installation
pip install tag-data-translation
Usage
from tag_data_translation import TDTEngine
engine = TDTEngine()
# encode GTIN to EPC hex
binary = engine.translate(
"gtin=00037000302414;serial=10419703",
"filter=1;gs1companyprefixlength=7;tagLength=96",
"BINARY"
)
hex_value = engine.binary_to_hex(binary)
print(hex_value) # 30340242201d8840009efdf7
# decode EPC hex to all fields
binary = engine.hex_to_binary("30340242201d8840009efdf7")
result = engine.translate_details(binary, "", "TAG_ENCODING")
print(result.output) # urn:epc:tag:sgtin-96:1.0037000.030241.10419703
print(result.fields) # {'filter': '1', 'gs1companyprefix': '0037000', ...}
Error handling
translate() raises TranslationError on invalid input. Use try_translate() for a non-throwing alternative:
from tag_data_translation import TDTEngine, TranslationError
engine = TDTEngine()
# raises on error
try:
result = engine.translate(epc, params, "BINARY")
except TranslationError as e:
print(f"Translation failed: {e}")
# returns None on error
result = engine.try_translate(epc, params, "BINARY")
if result is not None:
print(result)
Performance
The underlying .NET engine translates a typical SGTIN-96 in ~8 us. The pythonnet bridge adds minimal overhead on top of the native .NET performance.
| Operation | .NET native |
|---|---|
| SGTIN-96 encode | 7.8 us |
| SGTIN-96 decode | 7.7 us |
| HexToBinary (96-bit) | 99 ns |
| BinaryToHex (96-bit) | 54 ns |
License
BSL 1.1 — see LICENSING.md
Metadata
Release files for tag-data-translation 4.0.0
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 | |
|---|---|---|---|---|
| tag_data_translation-4.0.0.tar.gz | 663.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tag_data_translation-4.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.4 MB
Release files / tag_data_translation-4.0.0.tar.gz
| Download URL | tag_data_translation-4.0.0.tar.gz |
|---|---|
| Size | 663.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5270f19b06e4837fe0d08ceb9fa5b9d36d1f283e09c5925e95288a6a0e07cd93
|
|
BLAKE2b-256 checksum How to use checksums |
f1768a225fae5d583111e3c5143d9e8ca68a34a6ca2332e7aa337d931f1c3b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tag_data_translation-4.0.0-py3-none-any.whl
| Download URL | tag_data_translation-4.0.0-py3-none-any.whl |
|---|---|
| Size | 764.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
988c6437f44bf568bc3075c10b83cee3da2e2be3539e5a350d92d9122ddf1abe
|
|
BLAKE2b-256 checksum How to use checksums |
54def17f25d01e0dbb1b872910362285e6e83a6a81599431daf9cb04cdcd4a22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for tag-data-translation 4.0.0
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.