This article is a reference guide for addon developers who are creating addons for the Decision Support Pipeline (DSP). The guide will include changes to the System Manager and a better understanding of the Transaction Record workflows as it moves throughout the system. For a more general overview of the DSP process, see Decision Support Pipeline Overview

There are currently no Lending Processing or DocDel pipelines but the pipelines and addons in the feature are designed to support additional process types. The goal is to help make development in the future an easier transition if new pipelines and workflows were to be added.  


Decision Support Addons | Business Rules | Addon Event Hooks | Pipelines | Pipeline Stages

Decision Support Addons 

The Customization Manager now allows for addons to be uploaded with the Addon Type of "DecisionSupport" and allows the Server addon to be registered to a specific NVTGC and Pipeline.


Business Rules 

The Business Rule Evaluation stage of the DSP evaluates user-defined business rules against individual requests, allowing the System Manager to compare different fulfillment options for each request. Business Rules filter out different fulfillment options, by evaluating the Business Rule’s MatchString against the Request’s current state and information gathered after running the addons. The match strings for Business Rules are evaluated as boolean SQL statements that work similarly to how the match string works for Routing Rules.

The following joins and aliases are used in the business rule match string:

After the fulfillment options have been filtered and the request is in the Business Rule stage, the System Manager will use the Target properties of each Business Rule to select a recommended action. Details regarding how these Business Rules are evaluated are included in the Workflow section of the Business Rule Evaluation Stage below.

Example

u.Status = 'Faculty' and fd.Cost <= 10 and t.NotWantedAfter > DATEADD(DAY, 5, GETDATE()) 

In the example, the request would be filtered based on the Users who are "Faculty", the cost (of the fulfillment option) being less than or equal to $10, and the Transaction's NotWantedAfter being no more than 5 days from the current date.

 


Addon Event Hooks 

ILLiad now has 4 new event hooks (stage 3 consists of event hooks 3a and 3b) which allow the System Manager to trigger Decision Support addons whenever a request is run through a stage of a pipeline.

Decision Support addons can register to individual stages of the DSP by using the RegisterSystemEventHandleraddon function. For more information on the system script environment method of RegisterSystemEvenHandler see Environment Methods. For a more in-depth explanation of the RegisterSystemEvenHandler, see the Handling System Events article.

The following Event Hooks can be used with the DSP feature:

Event Hook: GatherInformation
Stage: Information Gathering Stage

This event hook allows addons to populate additional fields in a Request Form (e.g., DOI, ISSN, etc.). 

Event Hook: GenerateFulfillmentData
Stage: Fulfillment Data Generation Stage

This event hook allows addons to generate fulfillment options for the request (e.g., item availability, cost, format), each creating a single FulfillmentData record in the FufillmentData Table of the Request Form.

It is recommended that any addons that register for this event hook should also register to the AutomationDecision event hook.

Event Hook: EvaluateBusinessRules
Stage: Business Rule Evaluation Stage

This event hook allows addons to override the results of running pre-defined business rules with its own business rules. These addons are given access to the Recommendation record with the result of the business rules. From there, he addon is responsible for recording their own recommendations on the record. If no addons register to this event hook, then the business rules will be evaluated as normal.

Event Hook: AutomationDecision
Stage: Automation Decision Stage

This event hook allows addons to perform actions for the request without requiring staff intervention or review of the request. For example, sending the request to an external system such as Rapid or Relais for fulfillment. The automation occurs when a specific fulfillment option has been met and the request has been routed to Awaiting Pipeline Sending.


Pipelines

When configuring DecisionSupport addons in Customization Manager, staff users will be responsible for selecting the registered Pipeline(s) for each addon. There are 3 request processing pipelines in the Decision Support Pipeline, which generate and evaluate Fulfillment Data for request records. There is also a final decision pipeline that acts on the recommendation records. The final stage is only important to addon developers. In ILLiad, this pipeline is a segment of the other pipelines instead of being designated as its own pipeline. 

Each of these pipelines is associated with a designated set of Stages that will run the addons and add information or send the request, based on the Process Type (Borrowing, DocDel, Lending), Request Type (Article, Loan), and which queue it's in (input queue). If any problem occurs during one of the stages, then the request will be sent to the appropriate error queue for staff review. 

Processing Pipelines

Pre-Copyright

Post-Copyright

Final Decision Pipeline


Pipeline Stages

Whenever a Request enters a pipeline, it will be executed against the Stages that are used in that pipeline, as mentioned above. As of ILLiad v9.2, if while processing a Transaction, any of the stages encounter an error (e.g., a 404 response from an external server), the Transaction will be handled in one of the following ways:

  1. If the addon encounters an error that's handled by an OnError function written into the addon, the request(s) will be routed to the error queue associated with that pipeline only if the OnError function re-throws the error. If the error is not re-thrown, the DSP will assume that the addon was not able to process the request and it will be sent to other addons for processing (if applicable).


  2. If the addon encounters an error that isn't handled, the request(s) will be routed to the error queue associated with that pipeline.

Once a request has been routed to an error queue, that will conclude the pipeline’s processing for that Request. The request will need to be reviewed by staff to determine if the request should be routed to an input queue that will send it back into the pipeline or manually processed. 

All stages of the Decision Support Pipeline communicate with DecisionSupport addons, so the functions that are registered to any stages of the Decision Support Pipeline should accept a single parameter. Each stage of the Decision Support Pipeline has a distinct schema that it will populate before handing the event argument object to the addon.


1. Information Gathering Stage

This stage of the Decision Support Pipeline allows addons to add additional information to the Request Form. For example, an addon could look up additional information for a Request based on a DOI number. 

Stage Event Argument Properties

Workflow

  1. The System Manager will create a list of all the active addons that (a) are registered to the current pipeline, (b) are registered to an NVTGC that matches the NVTGC for the Request, and (c) have registered to the GatherInformation event hook.

  2. The System Manager will then execute all the addons in that list in a round.

    1. If any of the addons set the “Handled” flag of their event argument to true, they will be removed from the list for the next round.

    2. The System Manager will keep executing addons in that list until the list is empty, or none of the addons reported “Handled” during a single round.


2. Fulfillment Data Generation Stage

This stage of the Decision Support Pipeline allows addons to generate fulfillment options for Requests. This information is stored in a new data table in ILLiad called the FulfillmentData table. 

Stage Event Argument Properties

The event arguments for this stage include a “Handled” property, along with the non-metadata fields from the FulfillmentData model. Not all FufillmentData model properties are included in this stage's event arguments (e.g., ID, Source, and TransactionNumber fields).

Workflow

  1. The System Manager will create a list of all the active addons that (a) are registered to the current pipeline, (b) are registered to an NVTGC that matches the NVTGC for the Request, and (c) have registered to the GenerateFulfillmentData event hook.

  2. The System Manager will then execute all the selected addons.


3a. Business Rule Evaluation Stage

This stage of the Decision Support Pipeline evaluates pre-defined business rules, which compare different fulfillment options against each other.  This stage of the Decision Support Pipeline also allows an addon to override the pre-defined business rules, allowing a single addon to compare different FulfillmentData records. Any rules in the addon take priority over rules set in the Customization Manager. 

Stage Event Argument Properties

The model will first evaluate the argument properties for the addon before evaluating the business rule argument properties.

Addon Arguments:

Business Rule Arguments:

Addon Workflow

  1. The System Manager will create a list of all the active addons that (a) are registered to the current pipeline, (b) are registered to an NVTGC that matches the NVTGC for the Request, and (c) have registered to the EvaluateBusinessRules event hook.

  2. The System Manager will then attempt to execute an addon that has registered to the event hook.

The ordering of the addons that are considered for this stage is not defined. If 2 addons register for this stage’s event hook, there is no way to guarantee which one will execute. It is recommended that only one addon registers to this event hook, for each NVTGC.

For more information on how business rules work with the System Manager, see Business Rule Evaluation & the System Manager.


3b. Automation Decision Stage

This stage of the Decision Support Pipeline operates on requests from the “Awaiting Pipeline Sending” Queue. The System Manager will record a business rule evaluation as either Automatic or Recommended in the new DecisionSupportPipelineRecommendations database table which will act as the Recommendation Record. The stage evaluates each request’s Recommendation Record, either routing the request to the queue specified by the Recommendation’s QueueTarget or executing the DecisionSupport Addon specified by the Recommendation’s Target. 

Stage Event Argument Properties

The event arguments for this stage include a “Handled” property, along with the non-metadata fields from the FulfillmentData model. Not all FufillmentData model properties are included in this stage's event arguments (e.g., ID, Source, and TransactionNumber fields). For this stage, the only property that should be written to is the “Handled” property. For example, eventArgs.Handled=true. All the other properties are intended to allow the addon to access all the data it generated during its Fulfillment Data Generation stage.

Workflow

  1. From the “Awaiting Pipeline Sending” Queue, the System Manager will pull all Borrowing Requests along with the Recommendation records that are linked to the Requests.

  2. For each request, the System Manager will validate the Recommendation.

Addons that register to the AutomationDecision event hook should also register to the GenerateFulfillmentData event hook. If a DecisionSupport addon does not register to the GenerateFulfillmentData event hook, it will never generate any fulfillment options, so System Manager will never ask it to run during the AutomationDecision event. 

Addons are expected to route Requests during this stage of the pipeline. If the DecisionSupport addon does not route the Request, System Manager will route the Request to the “Awaiting Pipeline Error Review” Queue once the addon has completed.