Callbacks Module

Callbacks for GS1 GPC processing.

This module provides callback classes for GS1 GPC data processing events.

class gs1_gpc.callbacks.GPCProcessedCallback[source]

Bases: object

Callback interface for GPC XML processing events.

This class defines the interface for callbacks that can be triggered during GPC XML processing. Subclass this to implement custom behavior when GPC data is processed.

on_segment_processed(segment_code, segment_desc, is_new)[source]

Called when a segment is processed.

Parameters:
  • segment_code (str) – Segment code

  • segment_desc (str) – Segment description

  • is_new (bool) – True if this is a new segment, False if it already existed

on_family_processed(family_code, family_desc, segment_code, is_new)[source]

Called when a family is processed.

Parameters:
  • family_code (str) – Family code

  • family_desc (str) – Family description

  • segment_code (str) – Parent segment code

  • is_new (bool) – True if this is a new family, False if it already existed

on_class_processed(class_code, class_desc, family_code, is_new)[source]

Called when a class is processed.

Parameters:
  • class_code (str) – Class code

  • class_desc (str) – Class description

  • family_code (str) – Parent family code

  • is_new (bool) – True if this is a new class, False if it already existed

on_brick_processed(brick_code, brick_desc, class_code, is_new)[source]

Called when a brick is processed.

Parameters:
  • brick_code (str) – Brick code

  • brick_desc (str) – Brick description

  • class_code (str) – Parent class code

  • is_new (bool) – True if this is a new brick, False if it already existed

on_attribute_type_processed(att_type_code, att_type_text, brick_code, is_new)[source]

Called when an attribute type is processed.

Parameters:
  • att_type_code (str) – Attribute type code

  • att_type_text (str) – Attribute type description

  • brick_code (str) – Parent brick code

  • is_new (bool) – True if this is a new attribute type, False if it already existed

on_attribute_value_processed(att_value_code, att_value_text, att_type_code, is_new)[source]

Called when an attribute value is processed.

Parameters:
  • att_value_code (str) – Attribute value code

  • att_value_text (str) – Attribute value description

  • att_type_code (str) – Parent attribute type code

  • is_new (bool) – True if this is a new attribute value, False if it already existed

on_processing_complete(counters)[source]

Called when processing is complete.

Parameters:

counters (dict) – Dictionary with processing statistics