Data Quality

Data Quality is a functionality within the Summary View widget, which provides a possibility to calculate and show the state of an item in terms of quality.

Quality, in terms of Data Quality functionality, means how many requirements an item meets. Requirements are, by default, represented by the validation constraints. Such solution extends the meaning of quality from just checking if necessary attributes contain a value, up to a complex checks of provided value quality like, for example, a number of referenced objects, if the description is long enough, if the product has a thumbnail assigned and more.

Data Quality Group enables users to define the Data Quality section in Summary View Widget and determines at which thresholds the quality of an item should be considered as a warning or an error.

How the quality information is calculated and which attributes or semantic of the data are considered is up to the implementation.

To know more about it, please, read the Coverage Calculation Framework document.

Data Quality Configuration

Below, you can see a code snippet containing a sample configuration of Data Quality Group for a Product item and a default domain.

cockpit-config.xml

<context type="Product" component="summary-view">
    <summary-view:summary-view xmlns:summary-view="http://www.hybris.com/cockpitng/component/summaryview">
        <summary-view:section name="QualityGroup">
            <summary-view:data-quality-group warning="0.8" error="0.2" label="dataQualityGroupLabel" domain-id="default"/>
        </summary-view:section>
    </summary-view:summary-view>
</context>

It can be seen that the thresholds are, in this case, defined in the following way that if the quality is below 80 percent, but higher than 20 percent, it is a warning. If the quality is below 20 percent, it is an error.

Data Quality Renderers

Data Quality renderers get the Data Quality Group configuration and ask the calculation engine for results to show them in Summary View widget.

Data Quality section is grouped by domain-id. Any new and defined domain-id for a group may contain different sets of constraints, for example:

  • Core Attributes - attributes related with the core product data.
  • Marketing Attributes - attributes related with the marketing product data.

For any correctly configured Data Quality Group the components are rendered:

  • An extendable progress bar with a label above. The value presented in the progress bar indicates the overall index of quality (percentage) returned from the Calculation Framework.

    Responsible renderer: com.hybris.cockpitng.widgets.summaryview.dataquality.renderer.DefaultDataQualityGroupRenderer
  • Messages are presented according to the "Default error message" or "Error message" defined in the Constraint (Validation Constraint). Messages are only shown when Data Quality Group is expanded.

    Responsible renderer: com.hybris.cockpitng.widgets.summaryview.dataquality.renderer.DefaultDataQualityPropertyRenderer

In case of Data Quality Group being incorrectly configured (domain-id does not exist) nothing is shown in Summary View widget and a warning is printed out in the console:

Data quality does not exist for domain "default" and object "Product".

Thresholds

Threshold values (warning, error) are rendered in a form of a style class. The Data Quality Group style class basis lays on the data quality index and defined thresholds.

Adding Group Coverage to Data Quality

Provide a custom configurable coverage group to Data Quality.

Context

It is possible to provide a custom configurable coverage group. It is done by defining the proper spring beans in the extension, defining a new CoverageGroup with a domainID equal to the one used in a bean definition, and defining new or using already existing constraints and adding them to the created group.

Procedure

  1. Define a proper spring beans in the extension in the following way:
    <cng:list-extender bean="defaultCoverageCalculationStrategyRegistry" property="domainStrategies"
                   getter="@domainStrategiesList">
       <cng:add>
          <bean class="de.hybris.platform.validation.coverage.strategies.impl.CoverageCalculationStrategyMapping">
             <property name="domainID" value="firstAttributesCoverageGroup"/> <!-- same value needs to be added to summary-view:data-quality-group configuration (domain-id attribute) -->
    
             <property name="strategyMap">
                <map>
                   <entry key="Product">
                      <bean class="de.hybris.platform.validation.coverage.strategies.impl.ValidationBasedCoverageCalculationStrategy">
                         <property name="validationService" ref="validationService"/>
                         <property name="typeService" ref="typeService"/>
                         <property name="coverageConstraintGroupDao" ref="coverageConstraintGroupDao"/>
                         <property name="sortProperties" value="true"/>
                         <property name="constraintGroupID" value="firstAttributesCoverageGroup"/> <!-- same value needs to be added to the constraint group -->
                      </bean>
                   </entry>
                </map>
             </property>
          </bean>
       </cng:add>
    </cng:list-extender>
    
  2. Define a new CoverageConstraintGroup with domainID equal to the one used in the bean definition constraintGroupID.
    1. Log in to Backoffice as an admin user.
    2. Go to the Start of the navigation pathSystem Next navigation step Validation Next navigation step Constraint GroupsEnd of the navigation path nodes.
    3. Create a Coverage constraint group by using the create action.
    4. Set the domain-id (coverageDomainID field of CoverageConstraintGroup type) to the same value as it has been defined in the constraintGroupID property.
    5. Add any constraint to the newly created CoverageConstraintGroup.
    6. Save and reload the validation engine.
  3. Add the Data Quality Group into the Summary View section.

    Below, you can see a sample of code showing how to configure Data Quality Group for a Product item and the firstAttributesCoverageGroup domain.

    cockpit-config.xml

    <context type="Product" component="summary-view">
        <summary-view:summary-view xmlns:summary-view="http://www.hybris.com/cockpitng/component/summaryview">
            <summary-view:section name="QualityGroup">
                <summary-view:data-quality-group warning="0.8" error="0.2" label="firstAttributesCoverageGroup.label" domain-id="firstAttributesCoverageGroup"/> <!-- same value needs to be set in the <property name="domainID"> of CoverageCalculationStrategyMapping bean -->
            </summary-view:section>
        </summary-view:summary-view>
    </context>