Update wbs_diagram_generator.py
Browse files- wbs_diagram_generator.py +81 -11
wbs_diagram_generator.py
CHANGED
@@ -2,7 +2,7 @@ import graphviz
|
|
2 |
import json
|
3 |
from tempfile import NamedTemporaryFile
|
4 |
import os
|
5 |
-
from graph_generator_utils import add_nodes_and_edges
|
6 |
|
7 |
def generate_wbs_diagram(json_input: str) -> str:
|
8 |
"""
|
@@ -12,26 +12,93 @@ def generate_wbs_diagram(json_input: str) -> str:
|
|
12 |
json_input (str): A JSON string describing the WBS structure.
|
13 |
It must follow the Expected JSON Format Example below.
|
14 |
|
15 |
-
Returns:
|
16 |
-
str: The filepath to the generated PNG image file.
|
17 |
-
|
18 |
Expected JSON Format Example:
|
19 |
{
|
20 |
-
"project_title": "
|
21 |
"phases": [
|
22 |
{
|
23 |
"id": "phase_prep",
|
24 |
-
"label": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
"tasks": [
|
26 |
-
{
|
|
|
|
|
27 |
"subtasks": [
|
28 |
-
{
|
|
|
|
|
29 |
"sub_subtasks": [
|
30 |
-
{
|
|
|
|
|
31 |
"sub_sub_subtasks": [
|
32 |
-
{
|
|
|
|
|
33 |
"final_level_tasks": [
|
34 |
-
{"id": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
]
|
36 |
}
|
37 |
]
|
@@ -44,6 +111,9 @@ def generate_wbs_diagram(json_input: str) -> str:
|
|
44 |
}
|
45 |
]
|
46 |
}
|
|
|
|
|
|
|
47 |
"""
|
48 |
try:
|
49 |
if not json_input.strip():
|
|
|
2 |
import json
|
3 |
from tempfile import NamedTemporaryFile
|
4 |
import os
|
5 |
+
from graph_generator_utils import add_nodes_and_edges
|
6 |
|
7 |
def generate_wbs_diagram(json_input: str) -> str:
|
8 |
"""
|
|
|
12 |
json_input (str): A JSON string describing the WBS structure.
|
13 |
It must follow the Expected JSON Format Example below.
|
14 |
|
|
|
|
|
|
|
15 |
Expected JSON Format Example:
|
16 |
{
|
17 |
+
"project_title": "AI Model Development Project",
|
18 |
"phases": [
|
19 |
{
|
20 |
"id": "phase_prep",
|
21 |
+
"label": "Preparation",
|
22 |
+
"tasks": [
|
23 |
+
{
|
24 |
+
"id": "task_1_1_vision",
|
25 |
+
"label": "Identify Vision",
|
26 |
+
"subtasks": [
|
27 |
+
{
|
28 |
+
"id": "subtask_1_1_1_design_staff",
|
29 |
+
"label": "Design & Staffing",
|
30 |
+
"sub_subtasks": [
|
31 |
+
{
|
32 |
+
"id": "ss_task_1_1_1_1_env_setup",
|
33 |
+
"label": "Environment Setup",
|
34 |
+
"sub_sub_subtasks": [
|
35 |
+
{
|
36 |
+
"id": "sss_task_1_1_1_1_1_lib_install",
|
37 |
+
"label": "Install Libraries",
|
38 |
+
"final_level_tasks": [
|
39 |
+
{"id": "ft_1_1_1_1_1_1_data_access", "label": "Grant Data Access"}
|
40 |
+
]
|
41 |
+
}
|
42 |
+
]
|
43 |
+
}
|
44 |
+
]
|
45 |
+
}
|
46 |
+
]
|
47 |
+
}
|
48 |
+
]
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"id": "phase_plan",
|
52 |
+
"label": "Planning",
|
53 |
"tasks": [
|
54 |
+
{
|
55 |
+
"id": "task_2_1_cost_analysis",
|
56 |
+
"label": "Cost Analysis",
|
57 |
"subtasks": [
|
58 |
+
{
|
59 |
+
"id": "subtask_2_1_1_benefit_analysis",
|
60 |
+
"label": "Benefit Analysis",
|
61 |
"sub_subtasks": [
|
62 |
+
{
|
63 |
+
"id": "ss_task_2_1_1_1_risk_assess",
|
64 |
+
"label": "AI Risk Assessment",
|
65 |
"sub_sub_subtasks": [
|
66 |
+
{
|
67 |
+
"id": "sss_task_2_1_1_1_1_model_selection",
|
68 |
+
"label": "Model Selection",
|
69 |
"final_level_tasks": [
|
70 |
+
{"id": "ft_2_1_1_1_1_1_data_strategy", "label": "Data Strategy"}
|
71 |
+
]
|
72 |
+
}
|
73 |
+
]
|
74 |
+
}
|
75 |
+
]
|
76 |
+
}
|
77 |
+
]
|
78 |
+
}
|
79 |
+
]
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"id": "phase_dev",
|
83 |
+
"label": "Development",
|
84 |
+
"tasks": [
|
85 |
+
{
|
86 |
+
"id": "task_3_1_change_mgmt",
|
87 |
+
"label": "Data Preprocessing",
|
88 |
+
"subtasks": [
|
89 |
+
{
|
90 |
+
"id": "subtask_3_1_1_implementation",
|
91 |
+
"label": "Feature Engineering",
|
92 |
+
"sub_subtasks": [
|
93 |
+
{
|
94 |
+
"id": "ss_task_3_1_1_1_beta_testing",
|
95 |
+
"label": "Model Training",
|
96 |
+
"sub_sub_subtasks": [
|
97 |
+
{
|
98 |
+
"id": "sss_task_3_1_1_1_1_other_task",
|
99 |
+
"label": "Model Evaluation",
|
100 |
+
"final_level_tasks": [
|
101 |
+
{"id": "ft_3_1_1_1_1_1_hyperparam_tune", "label": "Hyperparameter Tuning"}
|
102 |
]
|
103 |
}
|
104 |
]
|
|
|
111 |
}
|
112 |
]
|
113 |
}
|
114 |
+
|
115 |
+
Returns:
|
116 |
+
str: The filepath to the generated PNG image file.
|
117 |
"""
|
118 |
try:
|
119 |
if not json_input.strip():
|