GS1.CompanyPrefix (gs1_barcode v0.1.2)

View Source

Provides range-based lookup of GS1 Company Prefix allocations in order to associate a barcode prefix with the GS1 Member Organization (MO) that administers the corresponding prefix range.

This association may be used as an informational hint about the country in which the GS1 Company Prefix was issued, but it is not a structural property of the barcode and must not be interpreted as the country of origin of the product.

The dataset is based on the public information from: GS1 List of Assigned Country Codes, GS1 Company Prefix, and other public sources.

Summary

Types

Single country's meta tuple: {Country Name, ISO Alpha-2, ISO Alpha-3, ISO Numeric}

List of MO countries (usually one elem) associated with a prefix, or nil if the prefix is unassigned.

Special purpose range types

Functions

Lookups GS1 Country (MO) by int prefix.

Lookups GS1-8 range by int prefix. Used for GTIN-8 codes. GTIN-8 has different allocation ranges GTIN-13.

Lookups GS1 range by int prefix. Used for non-GTIN-8 codes.

Types

country_info()

@type country_info() :: {String.t(), String.t(), String.t(), String.t()}

Single country's meta tuple: {Country Name, ISO Alpha-2, ISO Alpha-3, ISO Numeric}

country_mo()

@type country_mo() :: [country_info()] | nil

List of MO countries (usually one elem) associated with a prefix, or nil if the prefix is unassigned.

range_type()

@type range_type() ::
  :rcn | :demo | :issn | :isbn | :refund_receipt | :coupon | :coupon_local | nil

Special purpose range types:

  • :rcn - Restricted Circulation Numbers (internal use)
  • :issn - International Standard Serial Number (periodicals)
  • :isbn - International Standard Book Number
  • :coupon, :coupon_local - coupons
  • :refund_receipt - refund receipt
  • :demo - used for demonstrations

Functions

country(p)

@spec country(pos_integer()) :: country_mo()

Lookups GS1 Country (MO) by int prefix.

Examples

iex> GS1.CompanyPrefix.country(590)
[{"Poland", "PL", "POL", "616"}]

range8(p)

@spec range8(non_neg_integer()) :: nil | :rcn | :demo

Lookups GS1-8 range by int prefix. Used for GTIN-8 codes. GTIN-8 has different allocation ranges GTIN-13.

Examples

iex> GS1.CompanyPrefix.range8(001)
:rcn

range(p)

@spec range(non_neg_integer()) :: range_type()

Lookups GS1 range by int prefix. Used for non-GTIN-8 codes.

Examples

iex> GS1.CompanyPrefix.range(200)
:rcn