Skip to main content

Change detection and validation

Change Detection and Validation

Hii Retail provides advanced change detection and validation capabilities to ensure data integrity and compliance throughout the product and price lifecycle. The main services in this area are:

  • Change Detection
  • Validation Engine
  • Approval
  • Print Scheduling
  • Distribution

Together, these services enable you to:

  • Identify and output changes on an entity, including previous values
  • Validate changes against customer-specific rules
  • Hold back changes that violate any rules
  • Set aside changes requiring manual intervention before distribution, such as:
    • Printing paper labels or posters
    • Manual approval in a UI
  • Trigger custom actions and warnings
  • Distribute data to downstream services when all validations pass

Change Detection Service

The Change Detection service tracks the current state of any entity (e.g., Item, Price Specification, Item Identifier). When an update for the same id is received, it identifies what has changed and produces change events. These events are stored and can be used by UIs to display all changes for individual stores. They also serve as input for the Validation Engine.

Each change event contains a list of properties that have changed since the entity was last updated.

For more details, see the Changes Query API.

Validation Engine

The Validation Engine listens for all change events and determines if any field changes require validation. If validation is needed, it executes all applicable rules for the changed properties and produces a Validation Result.

The Validation Result is then used by the Distribution service to determine if the content is ready for downstream consumption.

How Validation Works

The Validation Engine requires defined rules to operate. If no rules exist for the changes in the event, or if none are violated, the Validation Result is valid and instructs the Distribution service to allow the change. If rules are violated, the Validation Result will include details for each violated rule.

Validation Rules can be of several types and apply different checks to the changed data. See more about Validation Rules in the API documentation.

Key properties of a Validation Rule include name, entityType, fieldName, ruleType, ruleValue, and severity.

Rule Types

The rule type defines the functional area for the rule. Possible values:

  • LABEL_RELEVANCE: Determines if the change should trigger label printing (relevant for stores using paper labels or posters).
  • VALIDATION: Used for content validation according to custom preferences. Can be coupled with an action to trigger alerts in your system or Hii Retail.
  • MANUAL_APPROVAL: Stops the change from being distributed, regardless of severity. Used to hold changes until manual approval is given. See Approval.
  • ACTION: Triggers actions without restricting the change. Recommended to set severity to ACTION as well.

Rule Values

Rule Values define the logic applied to the change. Available values:

  • MUST_BE_DIFFERENT: Checks that the data is not the same as before. If unchanged, the rule is violated.
  • MUST_HAVE_VALUE: The property must have a value (not empty or null).
  • MUST_BE_INT: The property must be an integer (no decimals or strings).
  • MUST_BE_BOOLEAN: The property must be a boolean (true or false).
  • MUST_BE_NUMERIC: The property must be a valid number (can include decimals).
  • MUST_BE_FLOAT: The property must be a valid float (can include decimals).
  • MUST_BE_ONE_OF: The property must match one of the defined values in the arguments list.
    "arguments": [
    {
    "key": "pnp.validator.isOneOf",
    "value": ["1", "2", "3", "10", "55"]
    }
    ]
  • MUST_BE_GREATER_THAN_PREVIOUS: The property must be numeric and greater than the previous value.
  • MUST_BE_SMALLER_THAN_PREVIOUS: The property must be numeric and smaller than the previous value.
  • MUST_BE_GREATER_THAN_THRESHOLD: The property must be numeric and greater than a defined threshold.
    "arguments": [
    {
    "key": "pnp.validator.isGreaterThanThreshold.threshold",
    "value": "40.5"
    }
    ]
  • MUST_BE_SMALLER_THAN_THRESHOLD: The property must be numeric and smaller than a defined threshold.
    "arguments": [
    {
    "key": "pnp.validator.isSmallerThanThreshold.threshold",
    "value": "1200"
    }
    ]
  • MUST_MATCH_REGEX: The new value must match a regular expression.
    "arguments": [
    {
    "key": "pnp.validator.regEx.expression",
    "value": "/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"
    }
    ]

Approval

The MANUAL_APPROVAL rule type is used to hold back changes that require manual approval before distribution.

A typical use case is price changes for franchise stores, which may require local approval before being applied.

Example:
A large retailer with four brands controls prices at the brand level. One brand consists of many franchise stores that want to control pricing locally. The manual approval process stops all price changes for these stores. Store managers use a Manual Approval UI to review, approve, or deny price changes daily. Approved changes are applied; denied changes are not.

The LABEL_RELEVANCE rule type is designed for manual label printing processes. Changes caught by this rule mark the entity for printing. Hii Retail identifies and schedules what needs to be printed but does not manage the print process itself; integration is required.

Once printing is confirmed via the input API, Hii Retail marks the print schedules as completed. The changes are then ready for distribution, unless manual approval is also required.

See the Label Query API for more information.

Distribution

The Distribution service holds all changes until a Validation Result is received from the Validation Engine. If the result is positive, the data is distributed. If negative, actions are performed according to the severity defined in the Validation Result.

Note: Some actions may be handled by external services, not natively by Hii Retail or the Distribution service.