Uploading Classified Products

The MLAC service offers a REST Direct OIEP for uploading sets of products that are already classified, or 'labeled,' using a CSV file. Uploading data requires an OIEP for a single hierarchy with the required output format to publish the data.

To upload hierarchies, perform all steps in the following sections:

  1. Prerequisites
  2. Configure a Classified Products OIEP
  3. Publish Classified Products Data to MLAC

File Requirements

As outlined in the Mapping steps below, the REST Direct OIEP requires a CSV file with the following headers / columns in the specified order.

For the primary product hierarchy case, if there are intermediate hierarchy levels between the product and the classification / hierarchy node (for example, a product family level), a calculated attribute can be used to output the appropriate hierarchy node ID for this column.

Important: The example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

The example below shows a function that will output either the ID of the parent or ID of the grandparent, based on whether the parent is of a specific object type.

{
  i:=path(), 
  parent:=listitem(i,listlen(i)-1),
  grandparent:=listitem(i,listlen(i)-2),
  parentobjecttype:=iterate(parent, 'stepobjecttype()') 
} if (exact(parentobjecttype, "Sales Item Family"), iterate(grandparent, 'stepid()'), iterate(parent, 'stepid()'))

In this example, 'stepobjecttype()' returns the object type name and not the ID. Thus, on systems with dimension dependent object type names, consider the object type for the Context of the export when making the comparison on the name.

Prerequisites

Complete the following setup to successfully configure the OIEP and publish data.

  1. In the 'workarea' directory shared between the application servers, edit the sharedconfig.properties file. Add the case-sensitive RestDirectDeliveryURL property to identify the hierarchy-specific URL for the MLAC service training products upload resource. The URL is used to supply values for the REST Direct Delivery Method in the OIEP.
RestDirectDeliveryURL=1= https://app.stibosystems.com/ds/mlac/v1/products
  1. Restart the server to implement the properties file changes.
  1. If you do not already have a token, confirm your username and a password to get a token.
  2. If you do not already have a token, use the service token endpoint (https://app.stibosystems.com/ds/mlac/v1/token) to obtain a token. See the Swagger UI available at https://app.stibosystems.com/ds/mlac/v1/. By default, tokens are valid for one (1) month.

Make note of the token for use in configuring the REST Direct Delivery Method Headers.

Configure a Classified Products OIEP

Use the following steps to configure the necessary OIEP. For more general information on OIEPs, see the Outbound Integration Endpoints topic in the Data Exchange documentation here.

  1. Create an event-based OIEP (as defined in the Creating an Event-Based Outbound Integration Endpoint topic of the Data Exchange documentation here) with the following settings in the wizard:
  1. Open the OIEP's Event Triggering Definitions tab, open the Triggering Object Types flipper, and click the Add Object Type link to add the product object type(s).

  1. On the Configuration tab, open the Configuration flipper and open the 'Schedule' parameter:

  1. On the Configuration tab, open the Output Templates flipper, and set the following for the Object-Eventtype column:

  1. On the Output Templates flipper set the following for the Format column:

Note: See the File Requirements section above for definitions of the mapping elements below.

If a source ID that has significance for the classification is available in an attribute, map the Select Attribute data source and choose that attribute.

If a source ID that has significance for the classification is not available in an attribute, map the Constant Value data source.

The final Header and Value mapping should match the image below.

For example, in the screenshot below, two hierarchy columns have been mapped: one by mapping a calculated attribute, and one by mapping a link type.

  1. On the Delivery Method flipper, click the Edit Delivery link to open the 'Edit Delivery Configuration' dialog.

Note: To validate the configuration, instead of setting the REST Direct method, first use the 'Copy to directory' or 'Email' delivery method and check the generated CSV file. See the OIEP Delivery Methods topic (here) in the Data Exchange documentation for details.

Publish Classified Products Data to MLAC

Publishing hierarchy data to the MLAC service requires invoking an OIEP with unread events. For details about these steps, see the Running an Outbound Integration Endpoint topic (here) and the Event-Based OIEP Forward, Rewind, Purge, and Republish topic (here), both in the Data Exchange documentation.

Important: Before publishing data to the MLAC service, it can be useful to first validate the configuration by using either the 'Copy to directory' or 'Email' delivery method and checking the generated CSV file. See the OIEP Delivery Methods topic (here) in the Data Exchange documentation for details.

Use the following steps to publish hierarchy data to the MLAC service.

  1. On System Setup, right-click the configured OIEP and click the Enable Integration Endpoint option.
  2. On the OIEP's Configuration tab, open the Event Queue Configuration flipper and set the Queue Status parameter to Read Events.
  3. Click the Republish button to display the Republish dialog.

  1. On the Republish dialog:

  1. Verify that the republish background process finishes successfully.
  2. Right-click the OIEP and click the Invoke option to manually publish the hierarchy data.
  3. Right-click the OIEP and click the Disable Integration Endpoint option.
  4. On the OIEP's Configuration tab, open the Event Queue Configuration flipper and set the Queue Status parameter to Discard Events.

Important: A model must be trained by Stibo Systems and the model made available before predictions can be generated for uploaded data.