Skip to main content
Skip table of contents

Product Data Synchronization (CIS)

Background:

Using the DataSync Product, Price and Promotion message sets, its possible to synchronize product data across the retail pharmacy industry.

This guide will assume that the use case is an eCommerce store who wants to buy goods from suppliers and sell goods to consumers. In reality, this is only one narrow use cases, other use cases would be in-app experiences, data-analytics data cleansing, POS applications, head office procurement arrangements, or purchase order optimisation.

Goal:

Synchronize data from Corum’s CIS product service, into your database, and published onto the web via your ecommerce platform.

Steps:

  • Register with PharmX DataSync and recieve a SiteID

  • Enter into a data-sharing agreement with CIS (currently this is done manually via email)

    • Specifically you should request to recieve:

      • Products

      • Prices

      • Promotions

      • Partners

  • Connect to the DataSync service via the .net DataSync.SDK

  • Stream messages from the service to your ecommerce systems REST API

    • (PharmX’s managed integration services, can assist or own this part of the process if you prefer)

Architecture

In Words

  • CIS recieves files from 380 suppliers, and validates, cleanses and publishes data to datasync

  • The eCommerce company will recieve a stream of products, prices, promotions and partners

  • The eCommerce company will filter data to their specifications

  • The eCommerce company will post any relevant data to their eCommerce systems API

    • (PharmX’s managed integration services, can assist or own this part of the process if you prefer)

In coming data

Please refer to the message specification for each of these messages:

  • Products

  • Prices

  • Promotions (under development)

  • Partners (under development)

Processing the data option 1: In Code deployed as a function

Once the SDK recieves the message it will be locked from other recievers (in this example, imagine you have two workers processing messages from datasync using an Azure Function or AWS Lambda.)

In code you would then check the MessageType to determine which handler should be executed.

Each handler would then get ecommerce lookup data, transform the object, and then post it to the API.

Pseudo code example in pseudo C# (will not compile), magento example
C#
public class MessageReciever {

   public MessageReciever()
   {
      DataSync.SDK.Client datasyncClient = new DataSync.SDK.Client(**creds here**);
      Magento.Client magentoClient = new Magento.Client(**url and creds here**);
      datasyncClient.MessageRecieved += MessageRecieved;
   }
   
   public MessageRecieved(DataSyncMessage message, Handler handler) {
    if (message.MessageType == "Product")
    {
      var product = Convert<DataSyncMesssage, MagentoProduct>(message);
      var result = magentoClient.PostProduct(product);
    }
    else if (message.MessageType == "Price")
    {
      var price = Convert<DataSyncMesssage, MagentoPrice>(message);
      var result = magentoClient.PostPrice(price);
    }
    else
    {
      Console.Write("Message {message.ID} not handled.")
    }
    
    if (result.Status == 200)
    {
      Console.Write("Message {message.ID} handled.")
      handler.CompleteMessage(message);
    }
    else {
      Console.Write("Message {message.ID} had an error.")
      handler.AbandonMessage(message);
    }
   }
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.