traverse_children(graph.root_node.children) get_all_alpha_nodes(graph.root_node.children[0].children) # ---------------------- Fetch data from DB data = DataLayer().get_data(rules=[rule], filter={}, limit=5) # ---------------------- Rule variables print('\n\nPROCESSING VARIABLES...') VariableProcessor().process_variables(data=data, variable_objs=rule['variables']) # ---------------------- Initiate rule engine print('\n\nPROCESSING RULES...') engine = RuleEngine() trigger = engine.run_efficiently(graphs=[graph], data=data, key=rule['key'], email='*****@*****.**') # ---------------------- Expected Output # PROCESSING VARIABLES... # PROCESSING RULES... # before checking file size # here # .................................... # For ObjectNode: persons # Items Processed: 4
'webhook_details': {}, 'params': [{ 'name': 'points', 'value': '1000__as_str' }] }] } graph = ReteGraph() graph.load_rule(rule) # ---------------------- Fetch data from DB data = DataLayer().get_data(rules=[rule], filter={}, limit=10) data['webhook'] = { '_id': 'Webhook_data', 'email': '*****@*****.**', 'total_price': '57.00', 'taxes': '12.50', 'note_attributes': [1, 2, 3] } # ---------------------- Rule variables print('\n\nPROCESSING VARIABLES...') VariableProcessor().eval_variables(data=data, variable_objs=rule['variables']) # ---------------------- Initiate rule engine print('\n\nPROCESSING RULES...') engine = RuleEngine() trigger = engine.run_efficiently(graphs=[graph], data=[webhook_data])