2 Auto Categorization Of Spend Transactions
This topic provides information on 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_IDcolumn value of the newly created Category & Subcategory from the tableDIGX_SP_SPEND_CATEGORY(Eg: 10 and 101 respectively). - Insert a row in table
DIGX_RL_SPENDas 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_BU'); - Insert a row in table
DIGX_RL_CONDITIONas below:- ID as any unique value
- RULE_ID as provided in the
DIGX_RL_SPENDtable above - EXPRESSION_OBJECT value should contain the keyword as
follows:
utl_raw.cast_to_raw('{ "@class" : " com.ofss.digx.app.spendanalysis.dto.rule.SpendCategorizationExpressionFactValueDTO", "keyword" : "Big Bazaar" }') OUTCOME_OBJECTvalue should contain the corresponding Category & Subcategory ID as follows (Subcategory is NOT mandatory):utl_raw.cast_to_raw('{ "@class" : " com.ofss.digx.app.spendanalysis.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.spendanalysis.dto.rule.SpendCategorizationOutcomeFactValueDTO","category" : "10","subCategory" : "101"}'), utl_raw.cast_to_raw('{"@class" : "com.ofss.digx.app.spendanalysis.dto.rule.SpendCategorizationExpressionFactValueDTO","keyword" : "Big Bazaar"}'), '', null, '', null, '', 1, 'OBDX_BU');
- Insert such rows in table
DIGX_RL_CONDITIONfor each keyword & Category-Subcategory combination as required by the Bank. - Verify the following properties (select * from
DIGX_CFG_CONFIG_ALL_Bwhere prop_id like '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)- SPEND_DEFAULT_CATEGORY_ID → This property is used for maintaining default category, if no keyword is match from all maintained rules.
Below attached screenshot entry is required for setting default category. We need to update the entry from day one configuration screen. We have to maintain the Category ID in this configuration value.
Note:
If below entry is not maintain and no rule is matched, then no category is set against the spend transaction.Figure 2-1 “System configuration” screen with required entry for setting default category
