def import_rule_history_master(ds: DataService): # Delete all histories(H) rules l2_rules: {Rule} = ds.get_rules({PARENT: HISTORIES}) for r in l2_rules: # delete all l3_rules ds.delete_rules({PARENT: r[CODE]}) # delete all l2_rules ds.delete_rules({PARENT: HISTORIES}) # delete the l1_rule ds.delete_rules({CODE: HISTORIES}) print('Histories(H) rules are deleted.') # define Identities(I)' rules master: level 1 rule = create_new_rule(1, None, 'H', 'سوابق تعاملات', 30, 270) ds.insert_rule(rule) print('Histories(H) master rule is created.')
def import_rule_timeliness_master(ds: DataService): # Delete all Timeliness(T) rules l2_rules: {Rule} = ds.get_rules({PARENT: TIMELINESS}) for r in l2_rules: # delete all l3_rules ds.delete_rules({PARENT: r[CODE]}) # delete all l2_rules ds.delete_rules({PARENT: TIMELINESS}) # delete the l1_rule ds.delete_rules({CODE: TIMELINESS}) print('Timeliness(T) rules are deleted.') # define Timeliness(T)' rules master: level 1 # rule.drop_collection() rule = create_new_rule(1, None, 'T', 'انجام به موقع تعهدات', 35, 270) ds.insert_rule(rule) print('Timeliness(T) master rule is created.')
def import_rule_identity_master(ds: DataService): # Delete all identities(I) rules # l2_rules: [Rule] = Rule.objects(Q(parent='I')) l2_rules: {Rule} = ds.get_rules({PARENT: IDENTITIES}) for r in l2_rules: # l3_rules: [Rule] = Rule.objects(Q(parent=r.code)) # l3_rules.delete() ds.delete_rules({PARENT: r[CODE]}) # l2_rules.delete() ds.delete_rules({PARENT: IDENTITIES}) # l1_rule = Rule.objects(Q(code='I')) # l1_rule.delete() ds.delete_rules({CODE: IDENTITIES}) print('Identities(I) rules are deleted.') # define Identities(I)' rules master: level 1 rule = create_new_rule(1, None, 'I', 'اطلاعات هویتی', 10, 100) ds.insert_rule(rule) print('Identities(I) master rule is created.')