GS1.AIRegistry (gs1_barcode v0.1.2)
View SourceGS1 Application Identifier Registry.
Provides lookup and validation mechanisms to determine the properties
of specific AIs, such as whether they expect fixed-length data, require check
digit validation, or represent dates (YYMMDD).
Summary
Functions
Returns a list of AIs whose data field must end with a standard GS1 check digit.
Returns a list of AIs whose data field is a date in YYMMDD format.
Determines if a given string is a valid GS1 Application Identifier.
Lookups the numeric range for 3 and 4 digit AIs.
Returns {min, max} tuple if the prefix corresponds to a valid GS1 range,
otherwise nil.
Checks if an AI has a fixed length.
Generated at compile-time from @fixed_len_ais to ensure performance.
Returns a map of Application Identifiers that have a fixed data length.
Determines the length of AI by its "base AI" representation. Note: This function is more for internal use.
Functions
@spec ai_check_digit() :: [String.t()]
Returns a list of AIs whose data field must end with a standard GS1 check digit.
@spec ai_date_yymmdd() :: [String.t()]
Returns a list of AIs whose data field is a date in YYMMDD format.
Determines if a given string is a valid GS1 Application Identifier.
This checks if the string exists in the standard registry or falls within valid numeric ranges for 3 and 4 digit AIs.
Examples
iex> GS1.AIRegistry.compliant?("01")
true
iex> GS1.AIRegistry.compliant?("05")
false
@spec extended_ai_range_lookup(binary()) :: {pos_integer(), pos_integer()} | nil
Lookups the numeric range for 3 and 4 digit AIs.
Returns {min, max} tuple if the prefix corresponds to a valid GS1 range,
otherwise nil.
Checks if an AI has a fixed length.
Generated at compile-time from @fixed_len_ais to ensure performance.
Examples
iex> GS1.AIRegistry.fixed_len_ai?("00")
true
iex> GS1.AIRegistry.fixed_len_ai?("10") # Batch/Lot is variable
false
@spec fixed_len_ais() :: %{required(String.t()) => pos_integer()}
Returns a map of Application Identifiers that have a fixed data length.
The keys are the AI strings (e.g., "01"), and the values are the total length of the field (AI + Data).
@spec length_by_base_ai(any()) :: nil | 2 | 3 | 4
Determines the length of AI by its "base AI" representation. Note: This function is more for internal use.