add category and rule caculate logic