GS1Grader for UDI Vision Inspection
GS1Grader is a Python library for grading Data Matrix codes using GS1 quality metrics with modulation and symbol contrast implementation essential for UDI (Unique Device Identification) compliance in medical devices.
Prerequisites
Before installing GS1Grader, you need to install some system dependencies:
Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y \
libdmtx0b \
ffmpeg \
libsm6 \
libxext6
Mac OS
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install the required dependencies
brew install libdmtx
brew install ffmpeg
brew install uv
brew install poetry
These system dependencies are required for proper functioning of OpenCV and pylibdmtx.
Installation with uv
create a virtual environment using uv and a suitable Python version (3.11 or higher):
uv venv .venv --python 3.11
source .venv/bin/activate
You can now install GS1Grader using pip:
uv pip install gs1grader
Or if you want to install from source:
# Clone the repo
git clone https://github.com/Ceyeborg/GS1Grader.git
cd GS1Grader
poetry install
Usage
Here's a simple example of how to use GS1Grader:
from gs1grader.grader_api import DataMatrixGradeAPI
# Create a grading API instance
grader_api = DataMatrixGradeAPI()
# Grade an image using the modulation grader
grade, explanation = grader_api.grade_datamatrix(
image_path="path/to/your/datamatrix.png",
grade_type="modulation",
explanation_path="."
)
# Print the results
print(f"Grade: {grade}")
if explanation:
print(f"Explanation: {explanation}")
Available Grading Methods
The library currently supports the following grading methods:
modulation: Evaluates the modulation quality of the Data Matrixsymbol_contrast: Evaluates the symbol contrast quality
API Reference
DataMatrixGradeAPI
The main class for grading Data Matrix codes.
Methods:
grade_datamatrix(image_path: str, grade_type: str, explain: bool = False):image_path: Path to the Data Matrix image filegrade_type: Type of grading to perform ("modulation" or "symbol_contrast")explanation_path: Provide a path to save png of the detailed explanation of the grade (optional)- Returns: A tuple of (grade, explanation)
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
The AGPL-3.0 is a copyleft license that requires anyone who distributes your code or a derivative work to make the source available under the same terms, and also requires you to provide the source code to users who interact with your software as a service.
Metadata
Release files for gs1grader 1.0.1
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 |
|---|---|---|---|---|
| gs1grader-1.0.1.tar.gz | 23.7 kB | With provenance | Details for gs1grader-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gs1grader-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for gs1grader-1.0.1-py3-none-any.whl |
Total release size: 51.8 kB
Release files / gs1grader-1.0.1.tar.gz
| Download URL | gs1grader-1.0.1.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de67733e5061f5e1c3d39df485da5fc8b9c66966ea152dbb3ed4162aa3d1e5e3
|
|
BLAKE2b-256 checksum How to use checksums |
eb353b3da0997cff445ceef8e1fdebbff982b67a4e4745a18439c5cced230399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2025.
Transparency logRelease files / gs1grader-1.0.1-py3-none-any.whl
| Download URL | gs1grader-1.0.1-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6c5373171308e7cd6b1cbb7a2ac1bc1f4877626d7a4d4729818d60c0e77a42c
|
|
BLAKE2b-256 checksum How to use checksums |
92b0df95b5a78bb0ddda0b576832d1dd5c78f6948fd221eef838616c75894ebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2025.
Transparency logSecurity for gs1grader 1.0.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gs1grader-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2025.
Transparency logA 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.