pyegeria 5.3.9.9.3__py3-none-any.whl → 5.3.9.9.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. md_processing/__init__.py +49 -0
  2. md_processing/commands.json +3252 -0
  3. md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +254 -0
  4. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +696 -0
  5. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +254 -0
  6. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +298 -0
  7. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +608 -0
  8. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +94 -0
  9. md_processing/dr_egeria_inbox/archive/freddie_intro.md +284 -0
  10. md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +275 -0
  11. md_processing/dr_egeria_inbox/archive/test-term.md +110 -0
  12. md_processing/dr_egeria_inbox/cat_test.md +100 -0
  13. md_processing/dr_egeria_inbox/data_field.md +54 -0
  14. md_processing/dr_egeria_inbox/data_spec.md +77 -0
  15. md_processing/dr_egeria_inbox/data_spec_test.md +2406 -0
  16. md_processing/dr_egeria_inbox/data_test.md +86 -0
  17. md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +168 -0
  18. md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +280 -0
  19. md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +313 -0
  20. md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +1073 -0
  21. md_processing/dr_egeria_inbox/dr_egeria_isc1.md +44 -0
  22. md_processing/dr_egeria_inbox/glossary_creation_experiment.ipynb +341 -0
  23. md_processing/dr_egeria_inbox/glossary_test1.md +324 -0
  24. md_processing/dr_egeria_inbox/rel.md +8 -0
  25. md_processing/dr_egeria_inbox/sb.md +119 -0
  26. md_processing/dr_egeria_inbox/search_test.md +39 -0
  27. md_processing/dr_egeria_inbox/solution-components.md +154 -0
  28. md_processing/dr_egeria_inbox/solution_blueprints.md +118 -0
  29. md_processing/dr_egeria_inbox/synonym_test.md +42 -0
  30. md_processing/dr_egeria_inbox/t1.md +0 -0
  31. md_processing/dr_egeria_inbox/t2.md +268 -0
  32. md_processing/dr_egeria_outbox/processed-2025-05-15 19:52-data_test.md +94 -0
  33. md_processing/dr_egeria_outbox/processed-2025-05-16 07:39-data_test.md +88 -0
  34. md_processing/dr_egeria_outbox/processed-2025-05-17 16:01-data_field.md +56 -0
  35. md_processing/dr_egeria_outbox/processed-2025-05-18 15:51-data_test.md +103 -0
  36. md_processing/dr_egeria_outbox/processed-2025-05-18 16:47-data_test.md +94 -0
  37. md_processing/dr_egeria_outbox/processed-2025-05-19 07:14-data_test.md +96 -0
  38. md_processing/dr_egeria_outbox/processed-2025-05-19 07:20-data_test.md +100 -0
  39. md_processing/dr_egeria_outbox/processed-2025-05-19 07:22-data_test.md +88 -0
  40. md_processing/md_commands/__init__.py +3 -0
  41. md_processing/md_commands/blueprint_commands.py +303 -0
  42. md_processing/md_commands/data_designer_commands.py +1182 -0
  43. md_processing/md_commands/glossary_commands.py +1144 -0
  44. md_processing/md_commands/project_commands.py +163 -0
  45. md_processing/md_processing_utils/__init__.py +4 -0
  46. md_processing/md_processing_utils/common_md_proc_utils.py +724 -0
  47. md_processing/md_processing_utils/common_md_utils.py +172 -0
  48. md_processing/md_processing_utils/extraction_utils.py +486 -0
  49. md_processing/md_processing_utils/md_processing_constants.py +112 -0
  50. md_processing/md_processing_utils/message_constants.py +19 -0
  51. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/METADATA +1 -2
  52. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/RECORD +55 -5
  53. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/LICENSE +0 -0
  54. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/WHEEL +0 -0
  55. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,96 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
8
+
9
+
10
+ # Update Collection Form - created at 2025-05-19 07:14
11
+ Collection found from the search string: `<class 'filter'>`
12
+
13
+ # Update Collection
14
+
15
+ ## Collection Name
16
+
17
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
18
+
19
+ ## Description
20
+ Principle data requirements for Teddy Bear Drop Foot Clinical Trial.
21
+
22
+ ## Qualified Name
23
+ DataSpec::Data Specification for the Teddy Bear Drop Foot Clinical Trial
24
+
25
+ ## Classifications
26
+
27
+
28
+ ## Collection Type
29
+ Data Specification
30
+
31
+ ## Guid
32
+ 1f5a7c95-9f12-41d1-83f6-2078e8b15978
33
+
34
+
35
+ # foo Create Data Dictionary
36
+ ## Name
37
+ Clinical Trial Data Dictionary
38
+
39
+ ## Description
40
+ A data dictionary for clinical trial data elements.
41
+
42
+
43
+
44
+
45
+ ___
46
+
47
+
48
+
49
+ TBDF-Incoming Weekly Measurement Data
50
+
51
+ # foo Create Data Structure
52
+
53
+ ## Data Structure
54
+
55
+ TBDF-Incoming Weekly Measurement Data
56
+
57
+ ## Description
58
+ This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial
59
+
60
+ ## In Data Specification
61
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
62
+
63
+
64
+ ## Qualified Name
65
+
66
+
67
+ ___
68
+
69
+ WWT-Incoming Weekly Measurement Data
70
+
71
+ # foo Create Data Structure
72
+
73
+ ## Qualified Name
74
+ DataStruct::WWT-Incoming Weekly Measurement Data
75
+
76
+ ## GUID
77
+ ae221834-a3a6-4f32-ac94-110dff761b49
78
+
79
+ ## Data Structure
80
+
81
+ WWT-Incoming Weekly Measurement Data
82
+
83
+
84
+ ## Description
85
+ A collection of data fields that form a data structure.
86
+
87
+
88
+ ## In Data Specification
89
+
90
+
91
+
92
+ ## Qualified Name
93
+
94
+ # Provenance
95
+
96
+ * Results from processing file data_test.md on 2025-05-19 07:14
@@ -0,0 +1,100 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
8
+
9
+ # foo Create Data Specification
10
+
11
+ ## Data Specification
12
+
13
+
14
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
15
+ >woof
16
+ ## Description
17
+ >Meow -
18
+
19
+ Principle data requirements for Teddy Bear Drop Foot Clinical Trial.
20
+
21
+
22
+
23
+
24
+
25
+ # Update Collection Form - created at 2025-05-19 07:20
26
+ Collection found from the search string: `<class 'filter'>`
27
+
28
+ # Update Collection
29
+
30
+ ## Collection Name
31
+
32
+ Clinical Trial Data Dictionary
33
+
34
+ ## Description
35
+ A data dictionary for clinical trial data elements.
36
+
37
+ ## Qualified Name
38
+ DataDict::Clinical Trial Data Dictionary
39
+
40
+ ## Classifications
41
+
42
+
43
+ ## Collection Type
44
+ Data Dictionary
45
+
46
+ ## Guid
47
+ 81edea89-0ae5-4729-86fe-0e4ed61aef9f
48
+
49
+
50
+
51
+
52
+
53
+ TBDF-Incoming Weekly Measurement Data
54
+
55
+ # foo Create Data Structure
56
+
57
+ ## Data Structure
58
+
59
+ TBDF-Incoming Weekly Measurement Data
60
+
61
+ ## Description
62
+ This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial
63
+
64
+ ## In Data Specification
65
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
66
+
67
+
68
+ ## Qualified Name
69
+
70
+
71
+ ___
72
+
73
+ WWT-Incoming Weekly Measurement Data
74
+
75
+ # foo Create Data Structure
76
+
77
+ ## Qualified Name
78
+ DataStruct::WWT-Incoming Weekly Measurement Data
79
+
80
+ ## GUID
81
+ ae221834-a3a6-4f32-ac94-110dff761b49
82
+
83
+ ## Data Structure
84
+
85
+ WWT-Incoming Weekly Measurement Data
86
+
87
+
88
+ ## Description
89
+ A collection of data fields that form a data structure.
90
+
91
+
92
+ ## In Data Specification
93
+
94
+
95
+
96
+ ## Qualified Name
97
+
98
+ # Provenance
99
+
100
+ * Results from processing file data_test.md on 2025-05-19 07:20
@@ -0,0 +1,88 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
8
+
9
+ # foo Create Data Specification
10
+
11
+ ## Data Specification
12
+
13
+
14
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
15
+ >woof
16
+ ## Description
17
+ >Meow -
18
+
19
+ Principle data requirements for Teddy Bear Drop Foot Clinical Trial.
20
+
21
+
22
+
23
+
24
+ # foo Create Data Dictionary
25
+ ## Name
26
+ Clinical Trial Data Dictionary
27
+
28
+ ## Description
29
+ A data dictionary for clinical trial data elements.
30
+
31
+
32
+
33
+
34
+ ___
35
+
36
+
37
+
38
+ TBDF-Incoming Weekly Measurement Data
39
+
40
+ # Update Data Structure
41
+
42
+ ## GUID
43
+ 3eb5d206-6d3f-4b61-8f45-d7fbc05a870e
44
+
45
+ ## Data Structure
46
+
47
+ TBDF-Incoming Weekly Measurement Data
48
+
49
+ ## Description
50
+ This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial
51
+
52
+ ## In Data Specification
53
+ Data Specification for the Teddy Bear Drop Foot Clinical Trial
54
+
55
+
56
+ ## Qualified Name
57
+
58
+
59
+ ___
60
+
61
+ WWT-Incoming Weekly Measurement Data
62
+
63
+ # foo Create Data Structure
64
+
65
+ ## Qualified Name
66
+ DataStruct::WWT-Incoming Weekly Measurement Data
67
+
68
+ ## GUID
69
+ ae221834-a3a6-4f32-ac94-110dff761b49
70
+
71
+ ## Data Structure
72
+
73
+ WWT-Incoming Weekly Measurement Data
74
+
75
+
76
+ ## Description
77
+ A collection of data fields that form a data structure.
78
+
79
+
80
+ ## In Data Specification
81
+
82
+
83
+
84
+ ## Qualified Name
85
+
86
+ # Provenance
87
+
88
+ * Results from processing file data_test.md on 2025-05-19 07:22
@@ -0,0 +1,3 @@
1
+ """
2
+ This package contains object_action-specific functions for processing Egeria Markdown
3
+ """
@@ -0,0 +1,303 @@
1
+ """
2
+ This file contains blueprint/solution-related object_action functions for processing Egeria Markdown
3
+ """
4
+ from typing import Optional
5
+
6
+ from rich.markdown import Markdown
7
+
8
+ from pyegeria.egeria_tech_client import EgeriaTech
9
+ from md_processing.md_processing_utils.common_md_utils import (
10
+ debug_level, print_msg, update_element_dictionary
11
+ )
12
+ from md_processing.md_processing_utils.extraction_utils import (
13
+ extract_command_plus, process_simple_attribute, process_name_list, process_element_identifiers, update_a_command
14
+ )
15
+
16
+ from md_processing.md_processing_utils.md_processing_constants import (
17
+ BLUEPRINT_NAME_LABELS, COMPONENT_NAME_LABELS, ALWAYS, ERROR, INFO, pre_command, EXISTS_REQUIRED,
18
+ )
19
+
20
+ def process_blueprint_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
21
+ """
22
+ Processes a solution blueprint create or update object_action by extracting key attributes such as
23
+ blueprint name, description, and usage from the given text.
24
+
25
+ :param txt: A string representing the input cell to be processed for
26
+ extracting blueprint-related attributes.
27
+ :param directive: an optional string indicating the directive to be used - display, validate or execute
28
+ :return: A string summarizing the outcome of the processing.
29
+ """
30
+ from md_processing.md_processing_utils.common_md_utils import set_debug_level
31
+
32
+ command, object_type, object_action = extract_command_plus(txt)
33
+ set_debug_level(directive)
34
+
35
+ blueprint_name = process_simple_attribute(txt, BLUEPRINT_NAME_LABELS, ERROR)
36
+ print(Markdown(f"{pre_command} `{object_action}` `{object_type}` for blueprint: `\'{blueprint_name}\'` with directive: `{directive}` "))
37
+ description = process_simple_attribute(txt, ['Description'], INFO)
38
+ usage = process_simple_attribute(txt, ['Usage'], INFO)
39
+ q_name = process_simple_attribute(txt, ['Qualified Name'], INFO)
40
+ valid = True
41
+
42
+ if blueprint_name is None:
43
+ valid = False
44
+ known_q_name = None
45
+ known_guid = None
46
+ blueprint_exists = False
47
+ else:
48
+ element_labels = BLUEPRINT_NAME_LABELS
49
+ element_labels.append('Display Name')
50
+ known_q_name, known_guid, valid, blueprint_exists = process_element_identifiers(egeria_client, object_type,
51
+ element_labels, txt,
52
+ object_action, None)
53
+
54
+ blueprint_display = (f"\n* Command: `{command}`\n\t* Blueprint Name: {blueprint_name}\n\t"
55
+ f"* Description: {description}\n\t* Usage: {usage}\n")
56
+
57
+ if object_action == 'Update':
58
+ guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
59
+ blueprint_display += f"* Qualified Name: `{q_name}`\n\t* GUID: {guid}\n\n"
60
+ if not blueprint_exists:
61
+ msg = f"Blueprint can't be updated; `{blueprint_name}` not found"
62
+ print_msg("ERROR", msg, debug_level)
63
+ valid = False
64
+ else:
65
+ msg = f"Blueprint can be updated; `{blueprint_name}` found"
66
+ print_msg(ALWAYS, msg, debug_level)
67
+
68
+ elif object_action == "Create":
69
+ if blueprint_exists:
70
+ msg = f"Blueprint `{blueprint_name}` can't be created because it already exists.\n"
71
+ print_msg("ERROR", msg, debug_level)
72
+ valid = False
73
+ elif valid:
74
+ msg = f"It is valid to create Blueprint `{blueprint_name}` with:\n"
75
+ print_msg("ALWAYS", msg, debug_level)
76
+
77
+ if directive == "display":
78
+ print(Markdown(blueprint_display))
79
+ return None
80
+
81
+ elif directive == "validate":
82
+ if valid:
83
+ print(Markdown(blueprint_display))
84
+ else:
85
+ msg = f"Validation failed for Blueprint `{blueprint_name}`\n"
86
+ print_msg(ERROR, msg, debug_level)
87
+ print(Markdown(blueprint_display))
88
+
89
+ return valid
90
+
91
+ elif directive == "process":
92
+ if valid:
93
+ print(Markdown(blueprint_display))
94
+ else:
95
+ if blueprint_exists and object_action == "Create":
96
+ msg = f"Create failed because blueprint `{blueprint_name}` exists - changing `Create` to `Update` in processed output \n"
97
+ print_msg(ERROR, msg, debug_level)
98
+ print(Markdown(blueprint_display))
99
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
100
+ else:
101
+ return None
102
+
103
+ if object_action == "Update":
104
+ if not blueprint_exists:
105
+ print(f"\n{ERROR}Blueprint `{blueprint_name}` does not exist! Updating result document with Create "
106
+ f"object_action\n")
107
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
108
+
109
+ body = {
110
+ "class": "ReferenceableRequestBody", "elementProperties": {
111
+ "class": "SolutionBlueprintProperties", "qualifiedName": known_q_name, "description": description,
112
+ "usage": usage
113
+ }
114
+ }
115
+ egeria_client.update_solution_blueprint(known_guid, body)
116
+ print_msg(ALWAYS, f"Updated Blueprint `{blueprint_name}` with GUID {known_guid}", debug_level)
117
+ update_element_dictionary(known_q_name, {
118
+ 'guid': known_guid, 'display_name': blueprint_name
119
+ })
120
+ return egeria_client.get_solution_blueprint_by_guid(known_guid, output_format='MD')
121
+
122
+ elif object_action == "Create":
123
+ if blueprint_exists:
124
+ print(f"\nBlueprint `{blueprint_name}` already exists and result document updated\n")
125
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
126
+ else:
127
+ blueprint_guid = egeria_client.create_solution_blueprint(blueprint_name, description, usage)
128
+ if blueprint_guid:
129
+ print_msg(ALWAYS, f"Created Blueprint `{blueprint_name}` with GUID {blueprint_guid}", debug_level)
130
+ return egeria_client.get_solution_blueprint_by_guid(blueprint_guid, output_format='MD')
131
+ else:
132
+ print_msg(ERROR, f"Failed to create Blueprint `{blueprint_name}`", debug_level)
133
+ return None
134
+
135
+
136
+ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
137
+ """
138
+ Processes a solution component create or update object_action by extracting key attributes such as
139
+ component name, description, and parent components from the given text.
140
+
141
+ :param txt: A string representing the input cell to be processed for
142
+ extracting component-related attributes.
143
+ :param directive: an optional string indicating the directive to be used - display, validate or execute
144
+ :return: A string summarizing the outcome of the processing.
145
+ """
146
+ from md_processing.md_processing_utils.common_md_utils import set_debug_level
147
+
148
+ command, object_type, object_action = extract_command_plus(txt)
149
+ set_debug_level(directive)
150
+
151
+ component_name = process_simple_attribute(txt, COMPONENT_NAME_LABELS, ERROR)
152
+ print(Markdown(f"{pre_command} `{object_action}` `{object_type}` for component: `\'{component_name}\'` with directive: `{directive}` "))
153
+ description = process_simple_attribute(txt, ['Description'], INFO)
154
+ q_name = process_simple_attribute(txt, ['Qualified Name'], INFO)
155
+ valid = True
156
+
157
+ if component_name is None:
158
+ valid = False
159
+ known_q_name = None
160
+ known_guid = None
161
+ component_exists = False
162
+ else:
163
+ element_labels = COMPONENT_NAME_LABELS
164
+ element_labels.append('Display Name')
165
+ known_q_name, known_guid, valid, component_exists = process_element_identifiers(egeria_client, object_type,
166
+ element_labels, txt,
167
+ object_action, None)
168
+
169
+ # Get the blueprint this component is in
170
+ blueprint_name = process_simple_attribute(txt, BLUEPRINT_NAME_LABELS)
171
+ if blueprint_name:
172
+ known_blueprint_q_name, known_blueprint_guid, blueprint_valid, blueprint_exists = process_element_identifiers(
173
+ egeria_client, "Solution Blueprint", BLUEPRINT_NAME_LABELS, txt, EXISTS_REQUIRED, None)
174
+ if not blueprint_exists:
175
+ valid = False
176
+ else:
177
+ known_blueprint_q_name = None
178
+ known_blueprint_guid = None
179
+ blueprint_valid = True
180
+ blueprint_exists = False
181
+
182
+ # Get the parent components if specified
183
+ parent_components = process_simple_attribute(txt, ['Parent Components', 'Parent Component'])
184
+ if parent_components:
185
+ parent_components_list, parent_q_name_list, parents_valid, parents_exist = process_name_list(
186
+ egeria_client, 'Solution Components', txt, COMPONENT_NAME_LABELS)
187
+ if not parents_exist:
188
+ valid = False
189
+ else:
190
+ parent_components_list = None
191
+ parent_q_name_list = None
192
+ parents_valid = True
193
+ parents_exist = False
194
+
195
+ component_display = (f"\n* Command: `{command}`\n\t* Component Name: {component_name}\n\t"
196
+ f"* Blueprint: {blueprint_name}\n\t* Parent Components: {parent_components}\n\t"
197
+ f"* Description: {description}\n")
198
+
199
+ if object_action == 'Update':
200
+ guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
201
+ component_display += f"* Qualified Name: `{q_name}`\n\t* GUID: {guid}\n\n"
202
+ if not component_exists:
203
+ msg = f"Component can't be updated; `{component_name}` not found"
204
+ print_msg("ERROR", msg, debug_level)
205
+ valid = False
206
+ else:
207
+ msg = f"Component can be updated; `{component_name}` found"
208
+ print_msg(ALWAYS, msg, debug_level)
209
+
210
+ elif object_action == "Create":
211
+ if component_exists:
212
+ msg = f"Component `{component_name}` can't be created because it already exists.\n"
213
+ print_msg("ERROR", msg, debug_level)
214
+ valid = False
215
+ elif valid:
216
+ msg = f"It is valid to create Component `{component_name}` with:\n"
217
+ print_msg("ALWAYS", msg, debug_level)
218
+
219
+ if directive == "display":
220
+ print(Markdown(component_display))
221
+ return None
222
+
223
+ elif directive == "validate":
224
+ if valid:
225
+ print(Markdown(component_display))
226
+ else:
227
+ msg = f"Validation failed for Component `{component_name}`\n"
228
+ print_msg(ERROR, msg, debug_level)
229
+ print(Markdown(component_display))
230
+
231
+ return valid
232
+
233
+ elif directive == "process":
234
+ if valid:
235
+ print(Markdown(component_display))
236
+ else:
237
+ if component_exists and object_action == "Create":
238
+ msg = f"Create failed because component `{component_name}` exists - changing `Create` to `Update` in processed output \n"
239
+ print_msg(ERROR, msg, debug_level)
240
+ print(Markdown(component_display))
241
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
242
+ else:
243
+ return None
244
+
245
+ if object_action == "Update":
246
+ if not component_exists:
247
+ print(f"\n{ERROR}Component `{component_name}` does not exist! Updating result document with Create "
248
+ f"object_action\n")
249
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
250
+
251
+ body = {
252
+ "class": "ReferenceableRequestBody", "elementProperties": {
253
+ "class": "SolutionComponentProperties", "qualifiedName": known_q_name, "description": description
254
+ }
255
+ }
256
+ egeria_client.update_solution_component(known_guid, body)
257
+ print_msg(ALWAYS, f"Updated Component `{component_name}` with GUID {known_guid}", debug_level)
258
+ update_element_dictionary(known_q_name, {
259
+ 'guid': known_guid, 'display_name': component_name
260
+ })
261
+
262
+ # Update parent components if specified
263
+ if parent_components and parents_exist and parents_valid:
264
+ # Get the current parent components
265
+ component_details = egeria_client.get_solution_component_by_guid(known_guid)
266
+ current_parents = []
267
+ if 'parentComponents' in component_details:
268
+ for parent in component_details['parentComponents']:
269
+ current_parents.append(parent.get('guid', None))
270
+
271
+ # Add new parent components
272
+ for parent in parent_q_name_list:
273
+ if parent not in current_parents:
274
+ egeria_client.add_parent_component(parent, known_guid)
275
+ print_msg(INFO, f"Added parent component to {component_name}", debug_level)
276
+
277
+ # Remove parent components that are not in the new list
278
+ for parent in current_parents:
279
+ if parent not in parent_q_name_list:
280
+ egeria_client.remove_parent_component(parent, known_guid)
281
+ print_msg(INFO, f"Removed parent component from {component_name}", debug_level)
282
+
283
+ return egeria_client.get_solution_component_by_guid(known_guid, output_format='MD')
284
+
285
+ elif object_action == "Create":
286
+ if component_exists:
287
+ print(f"\nComponent `{component_name}` already exists and result document updated\n")
288
+ return update_a_command(txt, object_action, object_type, known_q_name, known_guid)
289
+ else:
290
+ component_guid = egeria_client.create_solution_component(component_name, description, known_blueprint_guid)
291
+ if component_guid:
292
+ print_msg(ALWAYS, f"Created Component `{component_name}` with GUID {component_guid}", debug_level)
293
+
294
+ # Add parent components if specified
295
+ if parent_components and parents_exist and parents_valid:
296
+ for parent in parent_q_name_list:
297
+ egeria_client.add_parent_component(parent, component_guid)
298
+ print_msg(INFO, f"Added parent component to {component_name}", debug_level)
299
+
300
+ return egeria_client.get_solution_component_by_guid(component_guid, output_format='MD')
301
+ else:
302
+ print_msg(ERROR, f"Failed to create Component `{component_name}`", debug_level)
303
+ return None