Parser for strings obtained from GS1 DataMatrix 2D barcodes, often called matriz de datos in Spain, on medicine boxes.
datamatrix2codes helps pharmacists turn raw scanner strings from Spanish medicine packages into Excel columns such as PC, SN, LOTE, and CAD.
A scanner or app may read the GS1 DataMatrix image and send Excel the raw decoded string. That string is not four separate values; it is a GS1 payload made of Application Identifiers such as 01, 17, 10, and 21. The hard part is interpreting that payload, especially when variable-length fields such as lot (10) or serial (21) are followed by more fields. The same digit sequences can appear inside real values, so some strings cannot be split with certainty. This tool recovers what it can and marks uncertain rows for review.
- Documentation: https://mrueda.github.io/datamatrix2codes/
- Excel Quick Start: https://mrueda.github.io/datamatrix2codes/docs/usage/excel-quickstart
- macOS Excel Install: https://mrueda.github.io/datamatrix2codes/docs/installation/macos
- Windows Excel Install: https://mrueda.github.io/datamatrix2codes/docs/installation/windows
- Download the Excel macro: https://raw.githubusercontent.com/mrueda/datamatrix2codes/master/macro/ParseEncodedString.bas
python3 -m pip install -e .
python3 -m unittest discover -s tests -v
python3 -m py_compile src/datamatrix2codes/*.py tests/*.py
python3 -m datamatrix2codes data/codes.csv output.csvThe repository includes a synthetic-code generator so demos and tests can use realistic scanner strings without publishing real medicine-pack serials:
python3 tools/generate_synthetic_codes.py --count 20 > synthetic-codes.csv
python3 tools/generate_synthetic_codes.py --status ambiguous --count 20 > ambiguous-codes.csvDocs checks:
cd docs-site
npm install
npm run typecheck
npm run buildI originally wrote this to help my sister, who is a pharmacist.
MIT. See LICENSE.