pyegeria 5.4.0.dev13__py3-none-any.whl → 5.4.0.dev14__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.
- commands/cat/debug_log +2802 -2
- commands/cat/debug_log.2025-07-15_14-28-38_087378.zip +0 -0
- commands/cat/debug_log.2025-07-16_15-48-50_037087.zip +0 -0
- commands/cat/dr_egeria_md.py +30 -6
- md_processing/__init__.py +16 -3
- md_processing/data/commands.json +18541 -171
- md_processing/dr_egeria_outbox-pycharm/.obsidian/app.json +1 -0
- md_processing/dr_egeria_outbox-pycharm/.obsidian/appearance.json +1 -0
- md_processing/dr_egeria_outbox-pycharm/.obsidian/core-plugins.json +31 -0
- md_processing/dr_egeria_outbox-pycharm/.obsidian/workspace.json +177 -0
- md_processing/dr_egeria_outbox-pycharm/monday/processed-2025-07-14 12:38-data_designer_out.md +663 -0
- md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 15:00-Derive-Dr-Gov-Defs.md +719 -0
- md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:13-Derive-Dr-Gov-Defs.md +41 -0
- md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:14-Derive-Dr-Gov-Defs.md +33 -0
- md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:50-Derive-Dr-Gov-Defs.md +192 -0
- md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-16 19:15-gov_def2.md +527 -0
- md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-17 12:08-gov_def2.md +527 -0
- md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-17 14:27-gov_def2.md +474 -0
- md_processing/family_docs/Data Designer/Create_Data_Class.md +164 -0
- md_processing/family_docs/Data Designer/Create_Data_Dictionary.md +30 -0
- md_processing/family_docs/Data Designer/Create_Data_Field.md +162 -0
- md_processing/family_docs/Data Designer/Create_Data_Specification.md +36 -0
- md_processing/family_docs/Data Designer/Create_Data_Structure.md +38 -0
- md_processing/family_docs/Data Designer/View_Data_Classes.md +78 -0
- md_processing/family_docs/Data Designer/View_Data_Dictionaries.md +78 -0
- md_processing/family_docs/Data Designer/View_Data_Fields.md +78 -0
- md_processing/family_docs/Data Designer/View_Data_Specifications.md +78 -0
- md_processing/family_docs/Data Designer/View_Data_Structures.md +78 -0
- md_processing/family_docs/Data Designer.md +842 -0
- md_processing/family_docs/Digital Product Manager/Add_Member->Collection.md +42 -0
- md_processing/family_docs/Digital Product Manager/Attach_Collection->Resource.md +36 -0
- md_processing/family_docs/Digital Product Manager/Create_Agreement.md +96 -0
- md_processing/family_docs/Digital Product Manager/Create_Data_Sharing_Agreement.md +72 -0
- md_processing/family_docs/Digital Product Manager/Create_DigitalSubscription.md +102 -0
- md_processing/family_docs/Digital Product Manager/Create_Digital_Product.md +134 -0
- md_processing/family_docs/Digital Product Manager/Link_Agreement_Items.md +60 -0
- md_processing/family_docs/Digital Product Manager/Link_Contracts.md +26 -0
- md_processing/family_docs/Digital Product Manager/Link_Digital_Product_-_Digital_Product.md +30 -0
- md_processing/family_docs/Digital Product Manager/Link_Subscribers.md +48 -0
- md_processing/family_docs/Digital Product Manager.md +668 -0
- md_processing/family_docs/Glossary/Attach_Category_Parent.md +18 -0
- md_processing/family_docs/Glossary/Attach_Term-Term_Relationship.md +26 -0
- md_processing/family_docs/Glossary/Create_Category.md +38 -0
- md_processing/family_docs/Glossary/Create_Glossary.md +42 -0
- md_processing/family_docs/Glossary/Create_Term.md +70 -0
- md_processing/family_docs/Glossary.md +206 -0
- md_processing/family_docs/Governance Officer/Create_Business_Imperative.md +106 -0
- md_processing/family_docs/Governance Officer/Create_Certification_Type.md +112 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Approach.md +114 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Obligation.md +114 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Principle.md +114 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Procedure.md +128 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Process.md +122 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Processing_Purpose.md +106 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Responsibility.md +122 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Rule.md +122 -0
- md_processing/family_docs/Governance Officer/Create_Governance_Strategy.md +106 -0
- md_processing/family_docs/Governance Officer/Create_License_Type.md +112 -0
- md_processing/family_docs/Governance Officer/Create_Naming_Standard_Rule.md +122 -0
- md_processing/family_docs/Governance Officer/Create_Regulation_Article.md +106 -0
- md_processing/family_docs/Governance Officer/Create_Regulation_Definition.md +118 -0
- md_processing/family_docs/Governance Officer/Create_Security_Access_Control.md +114 -0
- md_processing/family_docs/Governance Officer/Create_Security_Group.md +120 -0
- md_processing/family_docs/Governance Officer/Create_Service_Level_Objectives.md +122 -0
- md_processing/family_docs/Governance Officer/Create_Threat_Definition.md +106 -0
- md_processing/family_docs/Governance Officer/Link_Governance_Controls.md +32 -0
- md_processing/family_docs/Governance Officer/Link_Governance_Drivers.md +32 -0
- md_processing/family_docs/Governance Officer/Link_Governance_Policies.md +32 -0
- md_processing/family_docs/Governance Officer/View_Governance_Definitions.md +82 -0
- md_processing/family_docs/Governance Officer.md +2412 -0
- md_processing/family_docs/Solution Architect/Create_Information_Supply_Chain.md +70 -0
- md_processing/family_docs/Solution Architect/Create_Solution_Blueprint.md +44 -0
- md_processing/family_docs/Solution Architect/Create_Solution_Component.md +96 -0
- md_processing/family_docs/Solution Architect/Create_Solution_Role.md +66 -0
- md_processing/family_docs/Solution Architect/Link_Information_Supply_Chain_Peers.md +32 -0
- md_processing/family_docs/Solution Architect/Link_Solution_Component_Peers.md +32 -0
- md_processing/family_docs/Solution Architect/View_Information_Supply_Chains.md +32 -0
- md_processing/family_docs/Solution Architect/View_Solution_Blueprints.md +32 -0
- md_processing/family_docs/Solution Architect/View_Solution_Components.md +32 -0
- md_processing/family_docs/Solution Architect/View_Solution_Roles.md +32 -0
- md_processing/family_docs/Solution Architect.md +490 -0
- md_processing/md_commands/data_designer_commands.py +9 -10
- md_processing/md_commands/glossary_commands.py +16 -2
- md_processing/md_commands/governance_officer_commands.py +420 -0
- md_processing/md_commands/product_manager_commands.py +186 -752
- md_processing/md_commands/project_commands.py +5 -2
- md_processing/md_commands/solution_architect_commands.py +9 -8
- md_processing/md_processing_utils/common_md_proc_utils.py +15 -10
- md_processing/md_processing_utils/common_md_utils.py +194 -2
- md_processing/md_processing_utils/debug_log +574 -0
- md_processing/md_processing_utils/dr-egeria-help-2025-07-17T17:22:09.md +2065 -0
- md_processing/md_processing_utils/extraction_utils.py +1 -1
- md_processing/md_processing_utils/generate_dr_help.py +20 -5
- md_processing/md_processing_utils/generate_md_cmd_templates.py +143 -0
- md_processing/md_processing_utils/md_processing_constants.py +56 -4
- pyegeria/governance_officer_omvs.py +14 -99
- pyegeria/output_formatter.py +3 -2
- pyegeria/utils.py +7 -0
- {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/RECORD +103 -29
- commands/cat/debug_log.2025-07-01_15-22-20_102237.zip +0 -0
- commands/cat/debug_log.2025-07-04_15-43-28_460900.zip +0 -0
- commands/cat/debug_log.2025-07-06_20-48-04_338314.zip +0 -0
- commands/cat/debug_log.2025-07-09_10-17-09_526262.zip +0 -0
- commands/cat/debug_log.2025-07-10_10-25-47_958331.zip +0 -0
- pyegeria/m_test.py +0 -118
- {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/entry_points.txt +0 -0
@@ -412,7 +412,7 @@ def get_element_by_name(egeria_client, element_type: str, element_name: str) ->
|
|
412
412
|
return q_name, guid, unique, exists
|
413
413
|
|
414
414
|
# Haven't seen this element before
|
415
|
-
property_names = ['qualifiedName', 'name', 'displayName']
|
415
|
+
property_names = ['qualifiedName', 'name', 'displayName', 'title']
|
416
416
|
open_metadata_type_name = None
|
417
417
|
details = egeria_client.get_elements_by_property_value(element_name, property_names, open_metadata_type_name)
|
418
418
|
if isinstance(details, str):
|
@@ -4,6 +4,7 @@ This file contains general utility functions for processing Egeria Markdown
|
|
4
4
|
import json
|
5
5
|
import os
|
6
6
|
import sys
|
7
|
+
from datetime import datetime
|
7
8
|
from typing import List
|
8
9
|
|
9
10
|
from loguru import logger
|
@@ -45,6 +46,10 @@ full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, "data_designe
|
|
45
46
|
# colorize=True)
|
46
47
|
logger.add("debug_log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
47
48
|
colorize=True)
|
49
|
+
def get_iso8601_datetime():
|
50
|
+
"""Returns the current date and time in ISO 8601 format."""
|
51
|
+
return datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
|
52
|
+
|
48
53
|
def yes_no(input: str)->str:
|
49
54
|
if type(input) is bool:
|
50
55
|
if input:
|
@@ -116,7 +121,10 @@ def create_help_terms():
|
|
116
121
|
|
117
122
|
term_entry = """# Generating glossary entries for the documented commands\n\n
|
118
123
|
This file contains generated Dr.Egeria commands to generate glossary term entries describing
|
119
|
-
each command
|
124
|
+
each Dr.Egeria command.
|
125
|
+
|
126
|
+
> Usage: Before executing this file, make sure you have a glossary named `Egeria-Markdown`
|
127
|
+
> already created. If you Need to create one, you can use the \n"""
|
120
128
|
|
121
129
|
for command, values in commands.items():
|
122
130
|
if command == "exported":
|
@@ -127,7 +135,7 @@ def create_help_terms():
|
|
127
135
|
command_verb = commands[command].get("verb","")
|
128
136
|
|
129
137
|
term_entry+= "# Create Term\n"
|
130
|
-
term_entry+= f"## Term Name\n\n{
|
138
|
+
term_entry+= f"## Term Name\n\n{command}\n\n"
|
131
139
|
term_entry+= f"## Description\n\n{command_description}\n\n"
|
132
140
|
term_entry+= f"## Owning Glossary\n\n{glossary_name}\n\n"
|
133
141
|
term_entry+= f"## Categories\n\nWriting Dr.Egeria Markdown\n\n"
|
@@ -138,13 +146,20 @@ def create_help_terms():
|
|
138
146
|
|
139
147
|
term_entry+= f"## Usage\n\n{output}\n\n___\n\n"
|
140
148
|
print(term_entry)
|
141
|
-
|
142
|
-
|
149
|
+
# Generate filename with current date and time in ISO 8601 format
|
150
|
+
current_datetime = get_iso8601_datetime()
|
151
|
+
filename = f"dr-egeria-help-{current_datetime}.md"
|
152
|
+
file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, filename)
|
153
|
+
|
154
|
+
# Write the content to the file
|
155
|
+
with open(file_path, 'w', encoding="utf-8") as f:
|
143
156
|
f.write(term_entry)
|
144
157
|
|
158
|
+
logger.info(f"Help documentation saved to {file_path}")
|
159
|
+
|
145
160
|
def main():
|
146
161
|
create_help_terms()
|
147
162
|
|
148
163
|
|
149
164
|
if __name__ == "__main__":
|
150
|
-
main()
|
165
|
+
main()
|
@@ -0,0 +1,143 @@
|
|
1
|
+
"""
|
2
|
+
This file contains general utility functions for processing Egeria Markdown
|
3
|
+
"""
|
4
|
+
import os
|
5
|
+
import sys
|
6
|
+
from typing import List, Dict
|
7
|
+
import io
|
8
|
+
|
9
|
+
from loguru import logger
|
10
|
+
from rich import print
|
11
|
+
from rich.console import Console
|
12
|
+
|
13
|
+
from commands.cat.dr_egeria_command_help import EGERIA_INBOX_PATH
|
14
|
+
from md_processing.md_processing_utils.common_md_utils import (get_current_datetime_string, get_element_dictionary,
|
15
|
+
update_element_dictionary,
|
16
|
+
split_tb_string, str_to_bool, )
|
17
|
+
from md_processing.md_processing_utils.extraction_utils import (process_simple_attribute, extract_attribute,
|
18
|
+
get_element_by_name)
|
19
|
+
from md_processing.md_processing_utils.md_processing_constants import (get_command_spec, load_commands, load_commands, COMMAND_DEFINITIONS)
|
20
|
+
|
21
|
+
from md_processing.md_processing_utils.message_constants import (ERROR, INFO, WARNING, ALWAYS, EXISTS_REQUIRED)
|
22
|
+
from pyegeria import EgeriaTech
|
23
|
+
from pyegeria._globals import DEBUG_LEVEL
|
24
|
+
|
25
|
+
|
26
|
+
# Constants
|
27
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
28
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", ".")
|
29
|
+
EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", ".")
|
30
|
+
|
31
|
+
console = Console(width=EGERIA_WIDTH)
|
32
|
+
|
33
|
+
debug_level = DEBUG_LEVEL
|
34
|
+
global COMMAND_DEFINITIONS
|
35
|
+
|
36
|
+
load_commands('commands.json')
|
37
|
+
|
38
|
+
|
39
|
+
log_format = "D {time} | {level} | {function} | {line} | {message} | {extra}"
|
40
|
+
logger.remove()
|
41
|
+
logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
|
42
|
+
full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, "data_designer_debug.log")
|
43
|
+
# logger.add(full_file_path, rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
44
|
+
# colorize=True)
|
45
|
+
logger.add("debug_log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
46
|
+
colorize=True)
|
47
|
+
@logger.catch
|
48
|
+
def main():
|
49
|
+
"""
|
50
|
+
Generate markdown command templates organized by family
|
51
|
+
"""
|
52
|
+
glossary_name = "Egeria-Markdown"
|
53
|
+
commands = COMMAND_DEFINITIONS["Command Specifications"]
|
54
|
+
|
55
|
+
# Create base output directory if it doesn't exist
|
56
|
+
base_output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "family_docs")
|
57
|
+
os.makedirs(base_output_dir, exist_ok=True)
|
58
|
+
|
59
|
+
# Group commands by family
|
60
|
+
families = {}
|
61
|
+
for command, values in commands.items():
|
62
|
+
if command == "exported":
|
63
|
+
continue
|
64
|
+
if values.get("level", "") not in ["Basic"]:
|
65
|
+
continue
|
66
|
+
|
67
|
+
family = values.get("family", "Other")
|
68
|
+
if family not in families:
|
69
|
+
families[family] = []
|
70
|
+
|
71
|
+
families[family].append(command)
|
72
|
+
|
73
|
+
# Process each family
|
74
|
+
for family, command_list in sorted(families.items()):
|
75
|
+
# Create a folder for each family
|
76
|
+
family_dir = os.path.join(base_output_dir, family)
|
77
|
+
os.makedirs(family_dir, exist_ok=True)
|
78
|
+
|
79
|
+
print(f"\n# Family: {family}\n")
|
80
|
+
|
81
|
+
# Process each command in the family
|
82
|
+
for command in sorted(command_list):
|
83
|
+
values = commands[command]
|
84
|
+
command_description = values.get("description", "")
|
85
|
+
command_verb = values.get("verb", "")
|
86
|
+
|
87
|
+
# Create a string buffer for the command's output
|
88
|
+
command_output = io.StringIO()
|
89
|
+
|
90
|
+
# Write command header
|
91
|
+
command_output.write(f"# **{command}**\n>\t{command_description}\n")
|
92
|
+
print(f"\n## {command_verb} **{command}**\n>\t{command_description}")
|
93
|
+
|
94
|
+
# Process command attributes
|
95
|
+
attributes = values['Attributes']
|
96
|
+
for attribute in attributes:
|
97
|
+
for key, value in attribute.items():
|
98
|
+
if value.get('level', "") not in ["Basic"]:
|
99
|
+
continue
|
100
|
+
user_specified = value.get('user_specified', 'true') in ["true", "True"]
|
101
|
+
|
102
|
+
command_output.write(f"\n## **{key}**\n")
|
103
|
+
print(f"\n### **{key}**")
|
104
|
+
|
105
|
+
command_output.write(f">\t**Input Required**: {value.get('input_required', 'false')}\n\n")
|
106
|
+
print(f">\tInput Required: {value.get('input_required', 'false')}")
|
107
|
+
|
108
|
+
command_output.write(f">\t**Description**: {value.get('description', '')}\n\n")
|
109
|
+
print(f">\tDescription: {value.get('description', '')}")
|
110
|
+
|
111
|
+
labels = value.get("attr_labels", None)
|
112
|
+
if labels:
|
113
|
+
command_output.write(f">\t**Alternative Labels**: {labels}\n\n")
|
114
|
+
print(f">\tAlternative Labels: {labels}")
|
115
|
+
|
116
|
+
valid_values = value.get("valid_values", None)
|
117
|
+
if valid_values:
|
118
|
+
command_output.write(f">\t**Valid Values**: {valid_values}\n\n")
|
119
|
+
print(f">\tValid Values: {valid_values}")
|
120
|
+
|
121
|
+
default_value = value.get("default_value", None)
|
122
|
+
if default_value:
|
123
|
+
command_output.write(f">\t**Default Value**: {default_value}\n\n")
|
124
|
+
print(f">\tDefault Value: {default_value}")
|
125
|
+
|
126
|
+
# Save the command to its own file in the family directory
|
127
|
+
# Use a sanitized version of the command name for the filename
|
128
|
+
command_filename = command.replace(" ", "_").replace(":", "").replace("/", "_")
|
129
|
+
command_file_path = os.path.join(family_dir, f"{command_filename}.md")
|
130
|
+
|
131
|
+
with open(command_file_path, 'w') as f:
|
132
|
+
f.write(command_output.getvalue())
|
133
|
+
|
134
|
+
logger.info(f"Saved command documentation to {command_file_path}")
|
135
|
+
print("\n___\n")
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
#
|
141
|
+
|
142
|
+
if __name__ == "__main__":
|
143
|
+
main()
|
@@ -47,6 +47,30 @@ TERM_RELATIONSHPS = ["Synonym", "Translation", "PreferredTerm", "TermISATYPEOFRe
|
|
47
47
|
"ISARelationship"]
|
48
48
|
|
49
49
|
# List of supported md_commands
|
50
|
+
GOV_LINK_LIST = [ "Link Governance Drivers", "Detach Governance Drivers",
|
51
|
+
"Link Governance Policies", "Detach Governance Policies",
|
52
|
+
"Link Governance Controls", "Detach Governance Controls",]
|
53
|
+
|
54
|
+
GOV_COM_LIST = [ "Create Business Imperative", "Update Business Imperative",
|
55
|
+
"Create Regulation Article Definition", "Update Regulation Article Definition",
|
56
|
+
"Create Threat Definition", "Update Threat Definition",
|
57
|
+
"Create Governance Principle", "Update Governance Principle",
|
58
|
+
"Create Governance Obligation", "Update Governance Obligation",
|
59
|
+
"Create Governance Approach", "Update Governance Approach",
|
60
|
+
"Create Governance Strategy", "Update Governance Strategy",
|
61
|
+
"Create Regulation", "Create Regulation Definition", "Update Regulation", "Update Regulation Definition",
|
62
|
+
"Create Governance Control:", "Update Governance Control",
|
63
|
+
"Create Governance Rule:", "Update Governance Rule",
|
64
|
+
"Create Service Level Objective", "Update Service Level Objective",
|
65
|
+
"Create Governance Process", "Update Governance Process",
|
66
|
+
"Create Governance Responsibility", "Update Governance Responsibility",
|
67
|
+
"Create Governance Procedure", "Update Governance Procedure",
|
68
|
+
"Create Security Access Control", "Update Security Access Control",
|
69
|
+
"Create Security Group", "Update Security Group",
|
70
|
+
"Create Naming Standard Rule", "Update Naming Standard Rule",
|
71
|
+
"Create Certification Type", "Update Certification Type",
|
72
|
+
"Create License Type", "Update License Type",]
|
73
|
+
|
50
74
|
command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term", "List Terms",
|
51
75
|
"List Term Details", "List Glossary Terms", "List Term History", "List Term Revision History",
|
52
76
|
"List Term Update History", "List Glossary Structure", "List Glossaries", "List Categories",
|
@@ -67,8 +91,7 @@ command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term
|
|
67
91
|
"View Data Specs", "View Data Structures", "View Data Structure", "View Data Fields", "View Data Field",
|
68
92
|
"View Dataa Classes", "View Data Class", "Create Data Class", "Update Data Class",
|
69
93
|
"Create Digital Product", "Create Data Product", "Update Digital Product", "Update Data Product",
|
70
|
-
"Create Agreement", "
|
71
|
-
"Update Agreement", "Update Data Agreement", "Update Data Agreement",
|
94
|
+
"Create Agreement", "Update Agreement",
|
72
95
|
"Link Digital Products", "Link Data Products", "Detach Digital Products", "Detach Data Products",
|
73
96
|
"Create Data Sharing Agreement", "Update Data Sharing Agreement",
|
74
97
|
"Create Digital Subscription", "Create Product Subscription", "Update Digital Subscription", "Update Product Subscription",
|
@@ -81,8 +104,37 @@ command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term
|
|
81
104
|
"Remove Member from Collection","Remove Member from Collection",
|
82
105
|
"View Digital Products", "View Data Products", "List Data Products", "List Digtal Products",
|
83
106
|
"View Agreements", "View Data Sharing Agreements", "List Agreements", "List Data Sharing Agreements",
|
84
|
-
"View Subscriptions", "List Subscriptions",
|
85
|
-
|
107
|
+
"View Subscriptions", "List Subscriptions", "View Governance Definitions", "View Gov Definitions",
|
108
|
+
"List Governance Definitions", "List Gov Definitions",
|
109
|
+
"View Governance Definition Context","List Governance Definition Context",
|
110
|
+
"View Governance Def Context", "List Governance Def Context",
|
111
|
+
# "Create Business Imperative", "Update Business Imperative",
|
112
|
+
# "Create Regulation Article Definition", "Update Regulation Article Definition",
|
113
|
+
# "Create Threat Definition", "Update Threat Definition",
|
114
|
+
# "Create Governance Principle", "Update Governance Principle",
|
115
|
+
# "Create Governance Obligation", "Update Governance Obligation",
|
116
|
+
# "Create Governance Approach", "Update Governance Approach",
|
117
|
+
# "Create Governance Strategy", "Update Governance Strategy",
|
118
|
+
# "Create Regulation", "Create Regulation Definition", "Update Regulation", "Update Regulation Definition",
|
119
|
+
# "Create Governance Control:", "Update Governance Control",
|
120
|
+
# "Create Governance Rule:", "Update Governance Rule",
|
121
|
+
# "Create Service Level Objective", "Update Service Level Objective",
|
122
|
+
# "Create Governance Process", "Update Governance Process",
|
123
|
+
# "Create Governance Responsibility", "Update Governance Responsibility",
|
124
|
+
# "Create Governance Procedure", "Update Governance Procedure",
|
125
|
+
# "Create Security Access Control", "Update Security Access Control",
|
126
|
+
# "Create Security Group", "Update Security Group",
|
127
|
+
# "Create Naming Standard Rule", "Update Naming Standard Rule",
|
128
|
+
# "Create Certification Type", "Update Certification Type",
|
129
|
+
# "Create License Type", "Update License Type",
|
130
|
+
# "Link Governance Drivers", "Detach Governance Drivers",
|
131
|
+
# "Link Governance Policies", "Detach Governance Policies",
|
132
|
+
# "Link Governance Controls", "Detach Governance Controls",
|
133
|
+
|
134
|
+
]
|
135
|
+
|
136
|
+
command_list.extend(GOV_COM_LIST)
|
137
|
+
command_list.extend(GOV_LINK_LIST)
|
86
138
|
|
87
139
|
pre_command = "\n---\n==> Processing object_action:"
|
88
140
|
command_seperator = Markdown("\n---\n")
|
@@ -127,25 +127,6 @@ class GovernanceOfficer(Client):
|
|
127
127
|
#
|
128
128
|
#
|
129
129
|
|
130
|
-
def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
|
131
|
-
"""
|
132
|
-
Normalize governance definition response for a list of dictionaries.
|
133
|
-
Args:
|
134
|
-
element: Dict or List
|
135
|
-
|
136
|
-
Returns:
|
137
|
-
list of Dict
|
138
|
-
|
139
|
-
"""
|
140
|
-
if isinstance(element, dict):
|
141
|
-
return [self._extract_gov_def_properties(element)]
|
142
|
-
elif isinstance(element, list):
|
143
|
-
comp_list = []
|
144
|
-
for i in range(len(element)):
|
145
|
-
comp_list.append(self._extract_gov_def_properties(element[i]))
|
146
|
-
return comp_list
|
147
|
-
else:
|
148
|
-
return []
|
149
130
|
|
150
131
|
def _extract_gov_def_properties(self, element: dict) -> dict:
|
151
132
|
"""
|
@@ -160,6 +141,8 @@ class GovernanceOfficer(Client):
|
|
160
141
|
guid = element['elementHeader'].get("guid", None)
|
161
142
|
properties = element['properties']
|
162
143
|
properties['GUID'] = guid
|
144
|
+
mermaid = element.get('mermaidGraph', "") or ""
|
145
|
+
properties['Mermaid'] = mermaid
|
163
146
|
del properties['class']
|
164
147
|
|
165
148
|
#
|
@@ -179,72 +162,6 @@ class GovernanceOfficer(Client):
|
|
179
162
|
|
180
163
|
return properties
|
181
164
|
|
182
|
-
def _extract_solution_blueprint_properties(self, element: dict) -> dict:
|
183
|
-
"""
|
184
|
-
Extract properties from a solution blueprint element.
|
185
|
-
|
186
|
-
Args:
|
187
|
-
element: Dictionary containing element data
|
188
|
-
|
189
|
-
Returns:
|
190
|
-
Dictionary with extracted properties
|
191
|
-
"""
|
192
|
-
guid = element['elementHeader'].get("guid", None)
|
193
|
-
element_properties = element['properties']
|
194
|
-
display_name = element_properties.get("displayName", None)
|
195
|
-
description = element_properties.get("description", None)
|
196
|
-
version = element_properties.get("version", None)
|
197
|
-
qualified_name = element_properties.get("qualifiedName", None)
|
198
|
-
|
199
|
-
solution_components = element.get('solutionComponents', None)
|
200
|
-
solution_components_md = ""
|
201
|
-
if solution_components:
|
202
|
-
for solution_component in solution_components:
|
203
|
-
sol_comp_prop = solution_component['solutionComponent']['properties']
|
204
|
-
sol_comp_name = sol_comp_prop.get("displayName", None)
|
205
|
-
sol_comp_desc = sol_comp_prop.get("description", None)
|
206
|
-
solution_components_md += '{' + f" {sol_comp_name}:\t {sol_comp_desc}" + " },\n"
|
207
|
-
|
208
|
-
return {
|
209
|
-
'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
|
210
|
-
'version': version, 'solution_components': solution_components_md
|
211
|
-
}
|
212
|
-
|
213
|
-
def _extract_solution_roles_properties(self, element: dict) -> dict:
|
214
|
-
"""
|
215
|
-
Extract properties from a solution role element.
|
216
|
-
|
217
|
-
Args:
|
218
|
-
element: Dictionary containing element data
|
219
|
-
|
220
|
-
Returns:
|
221
|
-
Dictionary with extracted properties
|
222
|
-
"""
|
223
|
-
guid = element['elementHeader'].get("guid", None)
|
224
|
-
element_properties = element['properties']
|
225
|
-
display_name = element_properties.get("title", None)
|
226
|
-
role_id = element_properties.get("roleId", None)
|
227
|
-
scope = element_properties.get("scope", None)
|
228
|
-
description = element_properties.get("description", None)
|
229
|
-
domain_identifier = element_properties.get("domainIdentifier", None)
|
230
|
-
qualified_name = element_properties.get("qualifiedName", None)
|
231
|
-
|
232
|
-
solution_components = element.get('solutionComponents', None)
|
233
|
-
solution_components_md = ""
|
234
|
-
if solution_components:
|
235
|
-
for solution_component in solution_components:
|
236
|
-
sol_comp_prop = solution_component.get('relationshipProperties', None)
|
237
|
-
if sol_comp_prop:
|
238
|
-
sol_comp_name = sol_comp_prop.get("role", None)
|
239
|
-
sol_comp_desc = sol_comp_prop.get("description", None)
|
240
|
-
solution_components_md += "{" + f" {sol_comp_name}:\t {sol_comp_desc}" + " },\n"
|
241
|
-
|
242
|
-
return {
|
243
|
-
'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
|
244
|
-
'role_id': role_id, 'scope': scope, 'domain_identifier': domain_identifier,
|
245
|
-
'solution_components': solution_components_md
|
246
|
-
}
|
247
|
-
|
248
165
|
def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
|
249
166
|
"""
|
250
167
|
Normalize for a list of dictionaries.
|
@@ -256,7 +173,7 @@ class GovernanceOfficer(Client):
|
|
256
173
|
|
257
174
|
"""
|
258
175
|
if isinstance(element, dict):
|
259
|
-
return [self.
|
176
|
+
return [self._extract_gov_def_properties(element)]
|
260
177
|
elif isinstance(element, list):
|
261
178
|
def_list = []
|
262
179
|
for i in range(len(element)):
|
@@ -1048,7 +965,7 @@ class GovernanceOfficer(Client):
|
|
1048
965
|
|
1049
966
|
url = (
|
1050
967
|
f"{self.platform_url}/s"
|
1051
|
-
f"ervers/{self.view_server}/api/open-metadata/
|
968
|
+
f"ervers/{self.view_server}/api/open-metadata/governance-officer/governance-definitions/"
|
1052
969
|
f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/attach")
|
1053
970
|
|
1054
971
|
await self._async_make_request("POST", url, body_slimmer(body))
|
@@ -1210,7 +1127,7 @@ class GovernanceOfficer(Client):
|
|
1210
1127
|
definition_guid2: str, body: dict = None) -> None:
|
1211
1128
|
""" Attach a supporting governance definition. Request body is optional.
|
1212
1129
|
The relationshipTypeNme can be:
|
1213
|
-
* GovernanceResponse between governance drivers (GovernanceStrategy,
|
1130
|
+
* GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
|
1214
1131
|
RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
|
1215
1132
|
GovernanceApproach).
|
1216
1133
|
* GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
|
@@ -1276,7 +1193,7 @@ class GovernanceOfficer(Client):
|
|
1276
1193
|
body: dict = None) -> None:
|
1277
1194
|
""" Attach a supporting governance definition. Request body is optional.
|
1278
1195
|
The relationshipTypeNme can be:
|
1279
|
-
* GovernanceResponse between governance drivers (GovernanceStrategy,
|
1196
|
+
* GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
|
1280
1197
|
RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
|
1281
1198
|
GovernanceApproach).
|
1282
1199
|
* GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
|
@@ -2275,7 +2192,7 @@ class GovernanceOfficer(Client):
|
|
2275
2192
|
|
2276
2193
|
await self._async_make_request("POST", url, body_slimmer(body))
|
2277
2194
|
|
2278
|
-
def
|
2195
|
+
def detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str, body: dict = None) -> None:
|
2279
2196
|
""" Detach a design object such as a solution component or governance definition from one of its implementation
|
2280
2197
|
resources. Request body is optional.
|
2281
2198
|
|
@@ -2317,9 +2234,9 @@ class GovernanceOfficer(Client):
|
|
2317
2234
|
loop = asyncio.get_event_loop()
|
2318
2235
|
loop.run_until_complete(self._async_detach_implementation_resource(design_desc_guid, implementation_guid, body))
|
2319
2236
|
|
2320
|
-
async def _async_get_gov_def_in_context(self, guid: str, body: dict, output_format: str, start_from: int = 0,
|
2237
|
+
async def _async_get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON", start_from: int = 0,
|
2321
2238
|
page_size: int = 0) -> list[dict] | str:
|
2322
|
-
""" Get governance definition in context.
|
2239
|
+
""" Get governance definition in context. Brings back the graph.
|
2323
2240
|
Async version.
|
2324
2241
|
|
2325
2242
|
Parameters
|
@@ -2382,16 +2299,14 @@ class GovernanceOfficer(Client):
|
|
2382
2299
|
else:
|
2383
2300
|
response = await self._async_make_request("POST", url)
|
2384
2301
|
|
2385
|
-
element = response.json().get("
|
2386
|
-
if element == NO_ELEMENTS_FOUND:
|
2387
|
-
return NO_ELEMENTS_FOUND
|
2302
|
+
element = response.json().get("element", NO_ELEMENTS_FOUND)
|
2388
2303
|
if output_format != 'JSON': # return a simplified markdown representation
|
2389
|
-
return self.
|
2390
|
-
return response.json().get("
|
2304
|
+
return self.generate_governance_definition_output(element, "", output_format)
|
2305
|
+
return response.json().get("element", NO_ELEMENTS_FOUND)
|
2391
2306
|
|
2392
|
-
def get_gov_def_in_context(self, guid: str, body: dict, output_format: str, start_from: int = 0,
|
2307
|
+
def get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON", start_from: int = 0,
|
2393
2308
|
page_size: int = 0) -> list[dict] | str:
|
2394
|
-
""" Get governance definition in context.
|
2309
|
+
""" Get governance definition in context. Brings back the graph.
|
2395
2310
|
|
2396
2311
|
Parameters
|
2397
2312
|
----------
|
pyegeria/output_formatter.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
import re
|
3
3
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
4
|
-
|
4
|
+
from pyegeria.utils import (camel_to_title_case)
|
5
5
|
from markdown_it import MarkdownIt
|
6
6
|
from rich.console import Console
|
7
7
|
|
@@ -126,7 +126,8 @@ def make_md_attribute(attribute_name: str, attribute_value: str, output_type: st
|
|
126
126
|
if attribute_name.upper() == "GUID":
|
127
127
|
attribute_title = attribute_name.upper()
|
128
128
|
else:
|
129
|
-
attribute_title = attribute_name.title()
|
129
|
+
# attribute_title = attribute_name.title()
|
130
|
+
attribute_title = camel_to_title_case(attribute_name)
|
130
131
|
else:
|
131
132
|
attribute_title = ""
|
132
133
|
|
pyegeria/utils.py
CHANGED
@@ -205,6 +205,13 @@ def body_slimmer(body: dict) -> dict:
|
|
205
205
|
slimmed[key] = value
|
206
206
|
return slimmed
|
207
207
|
|
208
|
+
import re
|
209
|
+
|
210
|
+
def camel_to_title_case(input_string):
|
211
|
+
# Add a space before uppercase letters and capitalize each word
|
212
|
+
result = re.sub(r'([a-z])([A-Z])', r'\1 \2', input_string).title()
|
213
|
+
return result
|
214
|
+
|
208
215
|
|
209
216
|
if __name__ == "__main__":
|
210
217
|
print("Main-Utils")
|