Skip to main content

Example Codes

These examples show what a pharmacist should expect after a scanner writes a raw string into Excel and the workbook runs ParseEncodedString.

The strings below are synthetic documentation examples. They are shaped like scanner output, but they are not real pack serials.

<GS> means a visible placeholder for the GS1 group separator. Real Excel input may contain ASCII 29, visible GS as shown in SEVeM scanner validation examples, another replacement such as <GS>, {GS}, ', or |, or no visible separator character.

Raw scanner stringPCSNLOTECADSTATUSCONFIDENCEHAS_GS
010847000654766321ANT7T3KA31<GS>17260331102318538470006547663ANT7T3KA312318532603OK100TRUE
010843523234741821AWF6VCKB8F2S10AD801172811008435232347418AWF6VCKB8F2SAD8012811OK100FALSE
010847000700681721SYNTH17VALUE1728110010AD8018470007006817SYNTH17VALUEAD8012811OK100FALSE
010847000654766321ANT7T3KA318470006547663ANT7T3KA31(blank)(blank)PARTIAL40FALSE
010847000700681721AAAA171728110010LOT8470007006817(blank)(blank)(blank)AMBIGUOUS55FALSE
third-party-scanner-text-not-supported(blank)(blank)(blank)(blank)UNPARSED0FALSE

How To Read The Table

OK means the parser found all four target fields: PC, SN, LOTE, and CAD.

PARTIAL means the string contains some usable fields, but not enough for a complete row.

AMBIGUOUS means the flattened scanner string has more than one plausible interpretation. In that case, disputed fields are left blank so the row is reviewed instead of silently choosing a risky answer.

UNPARSED means the scan could not be decoded into the supported Data Matrix fields. It does not prove that the medicine code itself is invalid.

Same Examples As Formulas

If the raw string is in A2, the table columns come from formulas like:

=ParseEncodedString(A2,"PC")
=ParseEncodedString(A2,"SN")
=ParseEncodedString(A2,"LOTE")
=ParseEncodedString(A2,"CAD")
=ParseEncodedString(A2,"STATUS")
=ParseEncodedString(A2,"CONFIDENCE")
=ParseEncodedString(A2,"HAS_GS")

If Excel rejects those formulas, use semicolons instead of commas:

=ParseEncodedString(A2;"PC")

Generate Safe Test Codes

Do not publish real medicine-pack serials in issues, screenshots, or test fixtures. For demos and regression tests, generate synthetic scanner strings from the repository root:

python3 tools/generate_synthetic_codes.py --count 20 > synthetic-codes.csv

The generated CSV includes the raw CODE, the expected parsed fields, and the expected parser status. It deliberately includes clean, flattened, partial, ambiguous, and unparsed examples.

To generate only ambiguous examples:

python3 tools/generate_synthetic_codes.py --status ambiguous --count 20 > ambiguous-codes.csv

To generate rows containing a real ASCII 29 GS1 group separator instead of visible <GS> text:

python3 tools/generate_synthetic_codes.py --count 20 --separator ascii29 > synthetic-codes.csv