Process multiple determinations within the same Assess request

(please note that content in this topic will be subject to change for the V10.2 final release)

The Determinations Server is able to process multiple determinations within the same Assess request. To do this you must:

  1. Design your rulebase to concurrently determine multiple outcomes.
  2. At runtime, construct your request to send all the entities you want to reason on, and all the outcomes that you want.

Rulebase Design

You can design a rulebase in such a way that it can make multiple determinations concurrently if the determinations are attributes or, less commonly, inferred relationships belonging to a non-singleton (and not the global) entity.

Once the outcomes belong to an entity, it is possible to create multiple entities and infer the values for all entities at once.

Example

In a Human Resources department, we want to determine the number of days of leave per year an employee is eligible for. We also want to determine if that person is eligible for long service leave. Both these outcomes are based on the number of years the employee has served in the company.

This example is demonstrated in the Rulebase BatchDSExample. You should be able to take that rulebase, and using a SOAP tool such as soapUI (http://www.soapui.org/) to reproduce the example outlined below.

Employee Attributes
Attribute Type
Date Joined company Base level (input)
The employee is eligible for long service leave Inferred (outcome)
The number of days of leave per year Inferred (outcome)

If we decide that the employee is the global entity, and the attributes are created against this entity, then we can only infer one employee’s outcomes per session, as we can only have one global entity.

However, if we create an entity "the employee" we can then have many employees in the rulebase, and we can effectively run a batch job, getting many outcomes within in the same session and think cycle.

Assess request at runtime

If the rulebase has been designed along the principles above, we can use a single Assess request to get multiple outcomes.

This can be done with the Determinations Server, and it is also possible to do this against the Determinations Engine API directly. In both cases the principle is:

  1. Create a session with multiple entity instances
  2. Provide all the input data necessary to determine the outcomes
  3. Retrieve outcomes.

Example Asses Request and Response

In the following example request, we are sending an Assess request with three employee entities. For each of these entities we are asking for the outcomes for the number of days of annual leave each employee is entitled to, and also whether the employee is eligible for long service leave. Because these outcomes are on the employee entity we can ask for outcomes for multiple employee entities, effectively doing a batch request.

       <soapenv:Body>
              <typ:assess-request>
                     <typ:session-data>
                            <typ:list-entity entity-type="employee">
                                   <typ:entity id="employee1">
                                          <typ:attribute-outcome
                                                    id="days_leave_per_year"
                                                    outcome-style="value-only"/>
                                          <typ:attribute-outcome
                                                    id="long_service_leave"
                                                    outcome-style="value-only"/>
                                          <typ:attribute id="date_joined_company">
                                                 <typ:date-val>1986-02-16</typ:date-val>
                                          </typ:attribute>
                                   </typ:entity>
                                   <typ:entity id="employee2">
                                          <typ:attribute-outcome
                                                    id="days_leave_per_year"
                                                    outcome-style="value-only"/>
                                          <typ:attribute-outcome
                                                    id="long_service_leave"
                                                    outcome-style="value-only"/>
                                          <typ:attribute id="date_joined_company">
                                                 <typ:date-val>2001-01-01</typ:date-val>
                                          </typ:attribute>
                                   </typ:entity>
                                   <typ:entity id="employee3">
                                          <typ:attribute-outcome
                                                    id="days_leave_per_year"
                                                    outcome-style="value-only"/>
                                          <typ:attribute-outcome
                                                    id="long_service_leave"
                                                    outcome-style="value-only"/>
                                          <typ:attribute id="date_joined_company">
                                                 <typ:date-val>1992-12-16</typ:date-val>
                                          </typ:attribute>
                                   </typ:entity>
                            </typ:list-entity>
                     </typ:session-data>
              </typ:assess-request>
       </soapenv:Body>
</soapenv:Envelope>

In the following response, we can see that for each employee we have an answer for the two outcomes we requested. We can parse the returned XML and get the outcomes for each employee

<SOAP-ENV:Body>
       <typ:assess-response>
              <typ:session-data>
                     <typ:list-entity entity-type="global">
                            <typ:entity id="global"/>
                     </typ:list-entity>
                     <typ:list-entity collected="false" entity-type="employee">
                            <typ:entity id="employee1">
                                   <typ:attribute id="days_leave_per_year"
                                          inferencing-type="goal" type="number">
                                          <typ:number-val>24.8</typ:number-val>
                                   </typ:attribute>
                                   <typ:attribute id="long_service_leave"
                                          inferencing-type="goal" type="boolean">
                                          <typ:boolean-val>false</typ:boolean-val>
                                   </typ:attribute>
                                   <typ:attribute id="date_joined_company"
                                          inferencing-type="base-level" type="date">
                                          <typ:date-val>1986-02-16</typ:date-val>
                                   </typ:attribute>
                            </typ:entity>
                            <typ:entity id="employee2">
                                   <typ:attribute id="days_leave_per_year"
                                          inferencing-type="goal" type="number">
                                          <typ:number-val>21.8</typ:number-val>
                                   </typ:attribute>
                                   <typ:attribute id="long_service_leave"
                                          inferencing-type="goal" type="boolean">
                                          <typ:boolean-val>false</typ:boolean-val>
                                   </typ:attribute>
                                   <typ:attribute id="date_joined_company"
                                          inferencing-type="base-level" type="date">
                                          <typ:date-val>2001-01-01</typ:date-val>
                                   </typ:attribute>
                            </typ:entity>
                            <typ:entity id="employee3">
                                   <typ:attribute id="days_leave_per_year"
                                          inferencing-type="goal" type="number">
                                          <typ:number-val>23.6</typ:number-val>
                                   </typ:attribute>
                                   <typ:attribute id="long_service_leave"
                                          inferencing-type="goal" type="boolean">
                                          <typ:boolean-val>false</typ:boolean-val>
                                   </typ:attribute>
                                   <typ:attribute id="date_joined_company"
                                          inferencing-type="base-level" type="date">
                                          <typ:date-val>1992-12-16</typ:date-val>
                                   </typ:attribute>
                            </typ:entity>
                     </typ:list-entity>
              </typ:session-data>
       </typ:assess-response>
</SOAP-ENV:Body>

See also:

Assess Request and Response Elements

Example: Assess Request xml

Example: Assess Response xml