from diagrams import Diagram from diagrams.custom import Custom from diagrams import Node, Cluster graph_attributes = { "fontsize": "20", "compund": "True", "splines":"spline", "resolution": "256", "margin": "-2", } node_attributes = { "shape": "ellipse", "style": "solid", "labelloc": "c", "width": "2", "height": "1", } edge_attributes = { "minlen": "2.0", "penwidth":"1.0", "color": "black", } cluster_attributes = { "fontsize": "15", "bgcolor": "#ffffff", "margin": "20", "style": "solid" } def create_diagram(): with Diagram(name="UseCase", filename="out/usecase", show=False, node_attr=node_attributes, edge_attr=edge_attributes, graph_attr=graph_attributes): actor = Custom("User", "../resources/actor.png", labelloc="b", width="1.4", fontsize="15") with Cluster("Smart Eating", "TB", graph_attr=cluster_attributes): uc_open_chatbot = Node(label="Open chatbot") with Cluster("Chatbot", "TB", graph_attr=cluster_attributes): uc_next_step = Node(label="Next step of\ncooking process") uc_all_steps = Node(label="Steps of cooking\nprocess") uc_ingredients = Node(label="Ingredients of\nreceipe") uc_total_time = Node(label="Total time for the\nreceipe") uc_remaining_time = Node(label="Remaining time to\nfinish cooking") uc_previous_step = Node(label="Infos about previous\nstep") uc_text_input = Node(label="Communicate via\ntext") uc_voice_input = Node(label="Communicate via\nvoice") uc_choose_assistant = Node(label="Choose assistant\nmodel") uc_select_receipe = Node(label="Select receipe") # actor >> uc_next_step # actor >> uc_ingredients # actor >> uc_total_time # actor >> uc_all_steps # actor >> uc_remaining_time # actor >> uc_previous_step # actor >> uc_text_input # actor >> uc_voice_input actor >> uc_open_chatbot uc_open_chatbot >> uc_choose_assistant uc_choose_assistant >> uc_text_input uc_choose_assistant >> uc_voice_input uc_text_input >> uc_select_receipe uc_voice_input >> uc_select_receipe uc_select_receipe >> uc_next_step uc_select_receipe >> uc_all_steps uc_select_receipe >> uc_ingredients uc_select_receipe >> uc_total_time uc_select_receipe >> uc_remaining_time uc_select_receipe >> uc_previous_step if __name__ == "__main__": create_diagram()