def process_actions(actions, node_processor): # takes and returns a list of actions # node_processor must take an action (dict) and return a list of actions action_list = [] logger.set_segment_context("branching") for action in actions: if action["type"]=="WORKFLOW_ENROLLMENT": logger.log_event("action_dependency", {"workflowId": str(action["workflowId"])}) if action["type"]=="BRANCH": logger.log_event("branching_action") branch_node = action.copy() branch_node["rejectActions"] = process_actions(action["rejectActions"], node_processor) branch_node["acceptActions"] = process_actions(action["acceptActions"], node_processor) action_list.extend(node_processor(branch_node)) else: action_list.extend(node_processor(action)) return action_list
def get_reEnrollmentTriggerSets(value_origin): logger.set_segment_context("reenrollment") return parse_reEnrollment(value_origin)
def get_goalCriteria(value_origin): logger.set_segment_context("goal") return parse_segments(value_origin)
def get_segmentCriteria(value_origin): logger.set_segment_context("enrollment") return parse_segments(value_origin)
row_counter = 0 for row in reader: row_counter += 1 if row_counter == 1: number_of_rows = len(row) dict_keys = row[4:] else: try: assert len(row) == number_of_rows except: print(row) print(len(row)) print(number_of_rows) assert False object_type = row[0] object_id = row[1] segment_context = row[2] log_key = row[3] set_logging_object(object_type, object_id) if row[2] in [ "enrollment", "reenrollment", "branching", "goal" ]: set_segment_context(row[2]) else: assert row[2] == "" event_dict = {} for j in range(len(dict_keys)): if row[j + 4] != "": event_dict[dict_keys[j]] = row[j + 4] log_event(log_key, event_dict) write_todo("test_todo")