Writing Life Event Recommendations Rule Sets

After submitting a Life Event the user is presented with a Screen showing Community Services in their area that are deemed suitable based on the Life Event they have just submitted. The same screen can also list recommended Government Programs for which to Self Screen or perform Intake. Life Event Recommendations Rule Sets must extend the TriageInterface rule set and extend AbstractTriageResult. As follows:

<RuleSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
  "../../../../CREOLEInfrastructure/xsd/curam/
    creole/xsd/RuleSet.xsd"
  name="LifeEventRecommendationsRuleSet">        
  <Class name="LifeEventRecommendation"
    extends="AbstractTriageResult"
    extendsRuleSet="TriageInterfaceRuleSet">
    ...
  </Class>
  ...
</RuleSet>

For the most part, writing a Life Event Recommendations rule set resembles writing a Triage Rule Set, readers are referred to the Chapter Customizing Triage in this guide and. Where Rules for Life Event Recommendations differ is that they can make decisions based on whether a given Data Store entity was changed by the user executing the Life Event Script and, if it was changed, what was the nature of the change. For example, the Rule Set could make one recommendation based on the addition of a new Income entity or a different one based on a change to an existing Income Entity. The example below shows how to add rule attributes in support of Life Event Recommendations to a Person class.

<Class name="Person" xsi:noNamespaceSchemaLocation=
  "http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Attribute name="curamDataStoreUniqueID">
    <type>
      <javaclass name="Long"/>
    </type>
    <derivation>
      <specified/>
    </derivation>
  </Attribute>
  
  <Attribute name="curamHasChanged">
    <type>
      <javaclass name="Boolean"/>
    </type>
    <derivation>
      <specified/>
    </derivation>
  </Attribute>
  
  <Attribute name="curamChangeType">
    <type>
      <javaclass name="String"/>
    </type>
    <derivation>
      <specified/>
    </derivation>
  </Attribute>
</Class>

Following the submission of a Life Event, the Life Event Broker initializes a Rule Session and creates Rule Objects corresponding to the Data Store Entities for the Life Event. It then modifies these Rule Objects based on the Difference Command that correspond to that Data Store entity. Taking the example of the Person Rule Class described above: If the Person entity in the data store was changed as a result of the execution of the Life Event IEG script then the curamHasChanged attribute will return true. The curamChangeType will return the type of change that was made: