View source | Discuss this page | Page history | Printable version   

How to create a data quality management provider

Warning.png   This document is still a work in progress. It may contain inaccuracies or errors.

Objective

The purpose of this document is to explain how to create a Data Quality Management Provider.

Bulbgraph.png   This feature is available starting from 3.0RR20.Q1

Data Quality Management project provides a infrastructure in Customer and Customer Address Webpos forms to support integrations to external providers of specialized solutions for optimizing data quality, data such as customer address, phone or email.

This infrastructure allow validations and suggestions, through webservice, a simple code function or a query to the database.

Definition

Add new value to Data Quality Provider List reference

Dqmreflist3.png

Implements the provider

Create new JavaScript class extending CustomerValidatorProvider class.

1. Define the fields that are going to validate or suggest overriding the functions, using the modelProperty of each component.

 
    /* @Override */
    static getValidatedFields() {
      return ['phone', 'alternativePhone', 'email'];
    }
    /* @Override */
    static getSuggestedFields() {
      return [];
    }

2. Implements the logic overriding suggest and/or validate functions. This logic could call a webservice, a simple code function or a query to the database.

 
 /* @Override */
    static validate(property, value, callback) {
      let result;
      switch (property) {
        case 'phone':
          return (result = validatePhoneFormat(value));
        case 'alternativePhone':
          return (result = validatePhoneFormat(value));
        case 'email':
          return (result = validateEmailFormat(value));
      }
      callback(result);
    }

3. Configure the previous defined reference list

 
    /* @Override */
    static getImplementorSearchKey() {
      return 'OBPOS_CUSTOMERDETAILSVALIDATIONS';
    }

4. Register the provider

 
  OB.DQMController.registerProvider(PosterminalValidations);

Data Quality Management example: Customer Details Validations

 
(function() {
  class PosterminalValidations extends OB.DQMController
    .CustomerValidatorProvider {
    /* @Override */
    static getValidatedFields() {
      return ['phone', 'alternativePhone', 'email'];
    }
    /* @Override */
    static getSuggestedFields() {
      return [];
    }
    /* @Override */
    static validate(property, value, callback) {
      let result;
      switch (property) {
        case 'phone':
          return (result = validatePhoneFormat(value));
        case 'alternativePhone':
          return (result = validatePhoneFormat(value));
        case 'email':
          return (result = validateEmailFormat(value));
      }
      callback(result);
    }
    /* @Override */
    static getImplementorSearchKey() {
      return 'OBPOS_CUSTOMERDETAILSVALIDATIONS';
    }
  }
}
  OB.DQMController.registerProvider(PosterminalValidations);
})();

Retrieved from "http://wiki.openbravo.com/wiki/How_to_create_a_data_quality_management_provider"

This page has been accessed 2,883 times. This page was last modified on 23 December 2019, at 08:41. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.