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.
- md_processing/__init__.py +49 -0
- md_processing/commands.json +3252 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +254 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +696 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +254 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +298 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +608 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +94 -0
- md_processing/dr_egeria_inbox/archive/freddie_intro.md +284 -0
- md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +275 -0
- md_processing/dr_egeria_inbox/archive/test-term.md +110 -0
- md_processing/dr_egeria_inbox/cat_test.md +100 -0
- md_processing/dr_egeria_inbox/data_field.md +54 -0
- md_processing/dr_egeria_inbox/data_spec.md +77 -0
- md_processing/dr_egeria_inbox/data_spec_test.md +2406 -0
- md_processing/dr_egeria_inbox/data_test.md +86 -0
- md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +168 -0
- md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +280 -0
- md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +313 -0
- md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +1073 -0
- md_processing/dr_egeria_inbox/dr_egeria_isc1.md +44 -0
- md_processing/dr_egeria_inbox/glossary_creation_experiment.ipynb +341 -0
- md_processing/dr_egeria_inbox/glossary_test1.md +324 -0
- md_processing/dr_egeria_inbox/rel.md +8 -0
- md_processing/dr_egeria_inbox/sb.md +119 -0
- md_processing/dr_egeria_inbox/search_test.md +39 -0
- md_processing/dr_egeria_inbox/solution-components.md +154 -0
- md_processing/dr_egeria_inbox/solution_blueprints.md +118 -0
- md_processing/dr_egeria_inbox/synonym_test.md +42 -0
- md_processing/dr_egeria_inbox/t1.md +0 -0
- md_processing/dr_egeria_inbox/t2.md +268 -0
- md_processing/dr_egeria_outbox/processed-2025-05-15 19:52-data_test.md +94 -0
- md_processing/dr_egeria_outbox/processed-2025-05-16 07:39-data_test.md +88 -0
- md_processing/dr_egeria_outbox/processed-2025-05-17 16:01-data_field.md +56 -0
- md_processing/dr_egeria_outbox/processed-2025-05-18 15:51-data_test.md +103 -0
- md_processing/dr_egeria_outbox/processed-2025-05-18 16:47-data_test.md +94 -0
- md_processing/dr_egeria_outbox/processed-2025-05-19 07:14-data_test.md +96 -0
- md_processing/dr_egeria_outbox/processed-2025-05-19 07:20-data_test.md +100 -0
- md_processing/dr_egeria_outbox/processed-2025-05-19 07:22-data_test.md +88 -0
- md_processing/md_commands/__init__.py +3 -0
- md_processing/md_commands/blueprint_commands.py +303 -0
- md_processing/md_commands/data_designer_commands.py +1182 -0
- md_processing/md_commands/glossary_commands.py +1144 -0
- md_processing/md_commands/project_commands.py +163 -0
- md_processing/md_processing_utils/__init__.py +4 -0
- md_processing/md_processing_utils/common_md_proc_utils.py +724 -0
- md_processing/md_processing_utils/common_md_utils.py +172 -0
- md_processing/md_processing_utils/extraction_utils.py +486 -0
- md_processing/md_processing_utils/md_processing_constants.py +112 -0
- md_processing/md_processing_utils/message_constants.py +19 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/METADATA +1 -2
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/RECORD +55 -5
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.3.9.9.4.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
"""
|
2
|
+
This file contains project-related object_action functions for processing Egeria Markdown
|
3
|
+
"""
|
4
|
+
|
5
|
+
from rich.markdown import Markdown
|
6
|
+
|
7
|
+
from md_processing.md_processing_utils.common_md_utils import (debug_level, print_msg, is_valid_iso_date)
|
8
|
+
from md_processing.md_processing_utils.extraction_utils import (extract_command, process_simple_attribute)
|
9
|
+
from md_processing.md_processing_utils.md_processing_constants import ALWAYS, ERROR, INFO, pre_command
|
10
|
+
from pyegeria._globals import NO_PROJECTS_FOUND
|
11
|
+
from pyegeria.project_manager_omvs import ProjectManager
|
12
|
+
|
13
|
+
|
14
|
+
def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, directive: str = "display") -> str | None:
|
15
|
+
"""
|
16
|
+
Processes a personal project create or update object_action by extracting key attributes such as
|
17
|
+
glossary name, language, description, and usage from the given cell.
|
18
|
+
|
19
|
+
:param txt: A string representing the input cell to be processed for
|
20
|
+
extracting glossary-related attributes.
|
21
|
+
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
22
|
+
:return: A string summarizing the outcome of the processing.
|
23
|
+
"""
|
24
|
+
from md_processing.md_processing_utils.common_md_utils import set_debug_level
|
25
|
+
|
26
|
+
command = extract_command(txt)
|
27
|
+
object = command.split()
|
28
|
+
object_type = f"{object[1]} {object[2]}"
|
29
|
+
object_action = object[0]
|
30
|
+
set_debug_level(directive)
|
31
|
+
|
32
|
+
project_name = process_simple_attribute(txt, ['Project Name'])
|
33
|
+
description = process_simple_attribute(txt, ['Description'])
|
34
|
+
project_identifier = process_simple_attribute(txt, ['Project Identifier'])
|
35
|
+
project_status = process_simple_attribute(txt, ['Project Status'])
|
36
|
+
project_phase = process_simple_attribute(txt, ['Project Phase'])
|
37
|
+
project_health = process_simple_attribute(txt, ['Project Health'])
|
38
|
+
start_date = process_simple_attribute(txt, ['Start Date'])
|
39
|
+
planned_end_date = process_simple_attribute(txt, ['Planned End Date'])
|
40
|
+
print(Markdown(f"{pre_command} `\'{command}\'` for project: `{project_name}` with directive: `{directive}` "))
|
41
|
+
|
42
|
+
project_display = (f"\n* Command: {command}\n\t* Project: {project_name}\n\t"
|
43
|
+
f"* Status: {project_status}\n\t* Description: {description}\n\t"
|
44
|
+
f"* Phase: {project_phase}\n\t* Health: {project_health}\n\t"
|
45
|
+
f"* Start Date: {start_date}\n\t* Planned End Date: {planned_end_date}\n")
|
46
|
+
|
47
|
+
def validate_project(obj_action: str) -> tuple[bool, bool, str, str]:
|
48
|
+
valid = True
|
49
|
+
msg = ""
|
50
|
+
known_guid = None
|
51
|
+
known_q_name = None
|
52
|
+
|
53
|
+
project_details = egeria_client.get_projects_by_name(project_name)
|
54
|
+
if project_details == NO_PROJECTS_FOUND:
|
55
|
+
project_exists = False
|
56
|
+
else:
|
57
|
+
project_exists = True
|
58
|
+
|
59
|
+
if project_name is None:
|
60
|
+
msg = f"* {ERROR}Project name is missing\n"
|
61
|
+
valid = False
|
62
|
+
if project_status is None:
|
63
|
+
msg += f"* {INFO}No Project status found\n"
|
64
|
+
|
65
|
+
if description is None:
|
66
|
+
msg += f"* {INFO}No Description found\n"
|
67
|
+
|
68
|
+
if project_identifier is None:
|
69
|
+
msg += f"* {INFO}No Project Identifier found\n"
|
70
|
+
|
71
|
+
if project_phase is None:
|
72
|
+
msg += f"* {INFO}No Project Phase found\n"
|
73
|
+
|
74
|
+
if project_health is None:
|
75
|
+
msg += f"* {INFO}No Project Health found\n"
|
76
|
+
|
77
|
+
if start_date is None:
|
78
|
+
msg += f"* {INFO}No Start Date found\n"
|
79
|
+
elif not is_valid_iso_date(start_date):
|
80
|
+
msg += f"* {ERROR}Start Date is not a valid ISO date of form YYYY-MM-DD\n"
|
81
|
+
valid = False
|
82
|
+
|
83
|
+
if planned_end_date is None:
|
84
|
+
msg += f"* {INFO} No Planned End Date found\n"
|
85
|
+
elif not is_valid_iso_date(planned_end_date):
|
86
|
+
msg += f"* {ERROR}Planned End Date is not a valid ISO date of form YYYY-MM-DD\n"
|
87
|
+
valid = False
|
88
|
+
|
89
|
+
if obj_action == "Update":
|
90
|
+
q_name = process_simple_attribute(txt, 'Qualified Name')
|
91
|
+
|
92
|
+
if not project_exists:
|
93
|
+
msg += f"* {ERROR}Project {project_name} does not exist\n"
|
94
|
+
valid = False
|
95
|
+
if len(project_details) > 1 and project_exists:
|
96
|
+
msg += f"* {ERROR}More than one project with name {project_name} found\n"
|
97
|
+
valid = False
|
98
|
+
if len(project_details) == 1:
|
99
|
+
known_guid = project_details[0]['elementHeader'].get('guid', None)
|
100
|
+
known_q_name = project_details[0]['glossaryProperties'].get('qualifiedName', None)
|
101
|
+
if q_name is None:
|
102
|
+
msg += f"* {INFO}Qualified Name is missing => can use known qualified name of {known_q_name}\n"
|
103
|
+
valid = True
|
104
|
+
elif q_name != known_q_name:
|
105
|
+
msg += (f"* {ERROR}Project {project_name} qualifiedName mismatch between {q_name} and {known_q_name}\n")
|
106
|
+
valid = False
|
107
|
+
if valid:
|
108
|
+
msg += project_display
|
109
|
+
msg += f"* -->Project {project_name} exists and can be updated\n"
|
110
|
+
else:
|
111
|
+
msg += f"* --> validation failed\n"
|
112
|
+
msg += '---'
|
113
|
+
print(Markdown(msg))
|
114
|
+
return valid, project_exists, known_guid, known_q_name
|
115
|
+
|
116
|
+
elif obj_action == "Create":
|
117
|
+
if project_exists:
|
118
|
+
msg += f"\n{ERROR}Project {project_name} already exists"
|
119
|
+
else:
|
120
|
+
msg += f"\n-->It is valid to create Project \'{project_name}\' with:\n"
|
121
|
+
print(Markdown(msg))
|
122
|
+
return valid, project_exists, known_guid, known_q_name
|
123
|
+
|
124
|
+
if directive == "display":
|
125
|
+
print(Markdown(project_display))
|
126
|
+
return None
|
127
|
+
elif directive == "validate":
|
128
|
+
valid, project_exists, known_guid, known_q_name = validate_project(object_action)
|
129
|
+
return valid
|
130
|
+
elif directive == "process":
|
131
|
+
valid, project_exists, known_guid, known_q_name = validate_project(object_action)
|
132
|
+
if valid:
|
133
|
+
if object_action == "Create":
|
134
|
+
if project_exists:
|
135
|
+
print(f"\n{ERROR}Project {project_name} already exists\n")
|
136
|
+
return None
|
137
|
+
else:
|
138
|
+
project_guid = egeria_client.create_personal_project(project_name, description, project_identifier,
|
139
|
+
project_status, project_phase, project_health,
|
140
|
+
start_date, planned_end_date)
|
141
|
+
if project_guid:
|
142
|
+
print_msg(ALWAYS, f"Created Project {project_name} with GUID {project_guid}", debug_level)
|
143
|
+
return egeria_client.get_project_by_guid(project_guid, output_format='MD')
|
144
|
+
else:
|
145
|
+
print_msg(ERROR, f"Failed to create Project {project_name}", debug_level)
|
146
|
+
return None
|
147
|
+
elif object_action == "Update":
|
148
|
+
if not project_exists:
|
149
|
+
print(f"\n{ERROR}Project {project_name} does not exist\n")
|
150
|
+
return None
|
151
|
+
else:
|
152
|
+
project_guid = egeria_client.update_personal_project(known_guid, project_name, description,
|
153
|
+
project_identifier, project_status,
|
154
|
+
project_phase, project_health, start_date,
|
155
|
+
planned_end_date)
|
156
|
+
if project_guid:
|
157
|
+
print_msg(ALWAYS, f"Updated Project {project_name} with GUID {project_guid}", debug_level)
|
158
|
+
return egeria_client.get_project_by_guid(project_guid, output_format='MD')
|
159
|
+
else:
|
160
|
+
print_msg(ERROR, f"Failed to update Project {project_name}", debug_level)
|
161
|
+
return None
|
162
|
+
else:
|
163
|
+
return None
|