Catalog Level Batch Jobs

These types of batch jobs, for example, DataProfileBatch Job and ContextEligibilityBatch job, operate on the catalog level for the list of offers associated with the catalog.

The data profile batch job caches the catalog profile, list of offers, and metadata information associated with that catalog. This information is used in subsequent batches. The data profile batch job iterates through the catalogProductRelationships and gets the list of valid offers between the given start and end caching dates and the catalog code selected. The other batches, such as getOffers, use this cached information, iterate through those lists of offers, and generate the offer profiles.

The catalog data profile result item batch job computes the time slice key using the catalog code and selected start and end time. Using the timeslice key, the job gets the time slice list with the information of the number of time slices, its corresponding effectivity dates, and time-slice key. The cache data in each time slice is then processed by the batch job and used as input to the batch. Corresponding catalog result items are generated and cached with the effectivity of the cache according to the effective cache date times of the time slice.

Data Profile Batch Job

The following table shows an example of the Cached Data instance.

Data profile result item of time slice 1{"profileType":"catalog","code":"VersionCatalog1","data":{"sortedCatalogEligibilityObjectListMap":["01t4x000000ZL08AAG","01t4x000000ZL0DAAW","01t4x000000ZL4wAAG","01t4x000000ZL0DAAW","promotionalId1"]},"catalogProductRelationDetails":{"Promotion":[{"promotionId1":"promotionalItemId1"}],"Product":["01t4x000000ZL08AAG","01t4x000000ZL0DAAW","01t4x000000ZL4wAAG","01t4x000000ZL0DAAW"]},"catalogCodeToRuleAssignments":{},"metrics":{"pcisCount":0,"promosCount":1,"prodsCount":4}}dprKeycatalog12021-03-01T08:00:00.000+00002021-03-03T08:00:00.000+0000dataprofileResultItem
Data profile result item of time slice 2{"profileType":"catalog","code":"VersionCatalog1","data":{"sortedCatalogEligibilityObjectListMap":["01t4x000000ZL08AAG","01t4x000000ZL4rAAG","01t4x000000ZL4wAAG","01t4x000000ZL0DAAW","promotionId1"]},"catalogProductRelationDetails":{"Promotion":[{"promotionId1":"promotionalItemId2","promotionId2":"promotionalItemId3"}],"Product":["01t4x000000ZL08AAG","01t4x000000ZL4rAAG","01t4x000000ZL4wAAG","01t4x000000ZL0DAAW"]},"catalogCodeToRuleAssignments":{},"metrics":{"pcisCount":0,"promosCount":2,"prodsCount":4}}dprKeycatalog12021-03-03T08:00:00.000+00002021-03-15T08:00:00.000+0000dataprofileResultItem

This batch job caches the eligible offers for a context combination. It queries all the cacheable context dimensions, creates the context combinations, computes the qualified eligibility list of the qualified offers, and caches that list for each combination. This information is then used by the getOffers batch job to transform it into the structure used by the getOffers API when a combination of context is passed.

The batch jobs are broken into three parts, each having its own set of roles and responsibilities:

  • Context combination generator: This batch job generates and caches the context combinations. The job queries the cached version info list for the catalog containing information about all the offer versions occurring between the selected start and end date. Using that information, the job gets all the cacheable context dimensions and their values. The job then generates the context combinations and caches them.

    Context combination generator

  • Eligibility generator: This batch job takes the combination set generated by the context combination generator batch and version info list for that catalog (master list of all offer versions), calculates the offer eligibility list, and caches it against that combination.

    The qualifying rule set assignment for an offer (product or promotion) version is a fixed reference, so it becomes a version-specific reference. Time slicing for the catalog-level batch jobs depends on all the offer versions associated with the catalog.

    Therefore, a particular product version can be spawned across multiple time slices with no change in its qualifying criteria with respect to a time slice. As such, creating an eligibility master list of all offer versions that are eligible for a given context combination is beneficial for performance because the eligibility of an offer version is only calculated once.

    Eligibility generator

  • Time sliced eligibility list generator: This batch job caches the context eligibility list of catalog offers per time slice. For each time slice, the job gets the dataProfileResultItem and eligibility master list. The catalog profile result items present in the master eligibility list are marked as qualified and that eligibility list is cached with the effectivity of the time slice.

    Time sliced eligibility list generator

This batch job transforms the context eligibility generated data into the format read by the getOffers API. The eligibility list for a context combination created by the context eligibility generator batch is a list ordered by ID. The getOffers batch job generates the paginated list of eligible offers. Each page contains the list of offers according to its page size and offset and is ordered by a column (ID by default).

Since getOffers batch job is a catalog-level batch job, its method of operation is per time slice. The batch job gets the context eligibility result items generated for each time slice in a separate batch process, paginates the resulting items into pages of a given page size, creates all the pages, generates a cache key for each record page, and caches the results.

GetOffers Batch Job

This batch job gets all the rule sets associated with the offers under that catalog, gets the rule conditions, and caches the rule expressions that are used during the context eligibility calculations of the cacheable dimension combinations.

This batch job operates on the versionInfo list that contains all the offers (productIds, promotionIds and promotionItemIds) that occur between the selected start and end date for a particular catalog. The job gets the qualification type rule sets and performs operations.

Rule Set Batch Job