|
23 | 23 | }, |
24 | 24 | { |
25 | 25 | "cell_type": "raw", |
| 26 | + "metadata": { |
| 27 | + "collapsed": false |
| 28 | + }, |
26 | 29 | "source": [ |
27 | 30 | "# Status Transitions graph\n", |
28 | 31 | "\n", |
29 | | - "Display a directed graph of status transitions of the issues data from an issue tracker (e.g., Jira).\n", |
| 32 | + "Display a directed graph of status transitions of the issues data from an issue tracker.\n", |
30 | 33 | "\n", |
31 | 34 | "This graph can give an overview like a value stream map and highlights potential waste like delays and rework.\n", |
32 | 35 | "\n", |
33 | | - "> **_NOTE:_** Requires [graphviz](https://graphviz.org/download/) to be installed locally." |
34 | | - ], |
35 | | - "metadata": { |
36 | | - "collapsed": false |
37 | | - } |
| 36 | + "> **_NOTE:_** Requires [graphviz](https://graphviz.org/download/) to be installed locally.\n", |
| 37 | + "\n", |
| 38 | + "## How to interpret the graph:\n", |
| 39 | + "- Each node represents a status of an issue.\n", |
| 40 | + "- The color of the node represents the category of the status (e.g., To Do, In Progress, Done).\n", |
| 41 | + "- Each edge represents a transition from one status to another.\n", |
| 42 | + "- The number of times that transition has occurred is shown on the edge, and the thickness of the edge is proportional to the number of transitions.\n", |
| 43 | + "\n", |
| 44 | + "Issue tracker tested: JIRA.\n", |
| 45 | + "Other DevLake plugins might not provide the necessary data to generate the graph. An error will be shown if the data is not available." |
| 46 | + ] |
38 | 47 | }, |
39 | 48 | { |
40 | 49 | "cell_type": "code", |
|
52 | 61 | "from playground.process_analysis.status_transition_graph_vistualizer import StatusTransitionGraphVisualizer, StatisticLabelConfig\n", |
53 | 62 | "from playground.process_analysis.utils.status_transition_data_generator import generate_random_status_changes\n", |
54 | 63 | "\n", |
| 64 | + "# Connection to the devlake database\n", |
| 65 | + "DB_URL = \"mysql://merico:merico@127.0.0.1:3306/lake\"\n", |
| 66 | + "# Specify the filter for the issues to be included in the graph\n", |
| 67 | + "ISSUE_FILTER = IssueFilter(\n", |
| 68 | + " # Example usage:\n", |
| 69 | + " # issue_type = \"Story\",\n", |
| 70 | + " # from_date = pd.Timestamp(datetime.strptime(\"2020-01-01\", \"%Y-%m-%d\"))\n", |
| 71 | + ")\n", |
| 72 | + "# For demo purposes, the following flag can be set to true to generate some random data\n", |
| 73 | + "USE_DEMO_DATA = False\n", |
55 | 74 | "\n", |
56 | | - "DB_URL = \"mysql://root:admin@127.0.0.1:3306/lake\"\n", |
57 | 75 | "\n", |
58 | 76 | "if not StatusTransitionGraphVisualizer.is_dot_executable_available():\n", |
59 | 77 | " print(\"dot executable not found, please install graphviz\")\n", |
60 | 78 | "\n", |
61 | | - "issue_filter = IssueFilter(\n", |
62 | | - " # Example usage:\n", |
63 | | - " # issue_type = \"Story\",\n", |
64 | | - " # from_date = pd.Timestamp(datetime.strptime(\"2000-01-01\", \"%Y-%m-%d\"))\n", |
65 | | - ") \n", |
66 | | - "process_graph = StatusTransitionGraph.from_database(create_db_engine(DB_URL), issue_filter=issue_filter)\n", |
67 | | - "\n", |
68 | | - "# For demo purpose, enable the following lines to generate some random data\n", |
69 | | - "# data_frame = generate_random_status_changes(5000)\n", |
70 | | - "# process_graph = StatusTransitionGraph.from_data_frame(data_frame, issue_filter=issue_filter)\n", |
| 79 | + "if not USE_DEMO_DATA:\n", |
| 80 | + " process_graph = StatusTransitionGraph.from_database(create_db_engine(DB_URL), issue_filter=ISSUE_FILTER)\n", |
| 81 | + "else:\n", |
| 82 | + " data_frame = generate_random_status_changes(5000)\n", |
| 83 | + " process_graph = StatusTransitionGraph.from_data_frame(data_frame, issue_filter=ISSUE_FILTER)\n", |
71 | 84 | "\n", |
72 | 85 | "svg = StatusTransitionGraphVisualizer().visualize(process_graph, threshold=0.99, label_statistic = StatisticLabelConfig.MEDIAN)\n", |
73 | 86 | "display(svg)" |
|
116 | 129 | "name": "python", |
117 | 130 | "nbconvert_exporter": "python", |
118 | 131 | "pygments_lexer": "ipython3", |
119 | | - "version": "3.12.1" |
| 132 | + "version": "3.12.2" |
120 | 133 | } |
121 | 134 | }, |
122 | 135 | "nbformat": 4, |
|
0 commit comments