AUTO CATEGORIZATION OF SPEND TRANSACTIONS
Scenario:
If a Spend transaction description contains keyword "Big Bazaar" then that transaction should get auto-categorized as follows:
Category --> Shopping
Subcategory --> Groceries
Maintenance steps:
- Create a Category and a Subcategory as required after login as an Admin user.
- Note the CATEGORY_ID column value of the newly created Category & Subcategory from the table DIGX_SP_SPEND_CATEGORY (Eg: 10 and 101 respectively).
- Insert a row in table DIGX_RL_SPEND as below (Note the ID column value which is '10001' in this example).
Sample script:
insert into DIGX_RL_SPEND (ID, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE, OBJECT_STATUS, OBJECT_VERSION_NUMBER, NAME, DESCRIPTION, DETERMINANT_VALUE) values ('10001', '', sysdate , '', sysdate , '', 1, 'SpendRule', 'SpendDTODesc', 'OBDX_BUBusiness Unit');
- Insert a row in table DIGX_RL_CONDITION as below:
- ID as any unique value
- RULE_ID as provided in the DIGX_RL_SPEND table above
- EXPRESSION_OBJECT value should contain the keyword as follows:
utl_raw.cast_to_raw('{
"@class" : "com.ofss.digx.app.common.dto.rule.SpendCategorizationExpressionFactValueDTO",
"keyword" : "Big Bazaar"
}') - OUTCOME_OBJECT value should contain the corresponding Category & Subcategory ID as follows (Subcategory is NOT mandatory):
utl_raw.cast_to_raw('{
"@class" : "com.ofss.digx.app.common.dto.rule.SpendCategorizationOutcomeFactValueDTO",
"category" : "10",
"subCategory" : "101"
}') - OPERATOR value should be 'CONTAINS' (No other operators are supported out of the box
Sample script:
insert into DIGX_RL_CONDITION (ID, RULE_ID, OPERATOR, OUTCOME_OBJECT, EXPRESSION_OBJECT, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE, OBJECT_STATUS, OBJECT_VERSION_NUMBER, DETERMINANT_VALUE)
values ('103', '10001', 'CONTAINS', utl_raw.cast_to_raw('{
"@class" : "com.ofss.digx.app.common.dto.rule.SpendCategorizationOutcomeFactValueDTO",
"category" : "10",
"subCategory" : "101"
}'), utl_raw.cast_to_raw('{
"@class" : "com.ofss.digx.app.common.dto.rule.SpendCategorizationExpressionFactValueDTO",
"keyword" : "Big Bazaar"
}'), '', null, '', null, '', 1, 'OBDX_BU');
- Insert such rows in table DIGX_RL_CONDITION for each keyword & Category-Subcategory combination as required by the Bank.
- Verify the following properties (select * from DIGX_FW_CONFIG_ALL_B where category_id = 'ruleconfig';):
- IS_RULE_EVALUATION_REQUIRED --> Y
- SPEND_EVALUATOR --> com.ofss.digx.app.spendanalysis.ruleengine.evaluator.SpendRuleEvaluator (out of the box Spend rule evaluator)
- SPEND_RULE_NAME --> SpendRule (As per the value of NAME column in DIGX_RL_SPEND table)