pyegeria 5.3.10__py3-none-any.whl → 5.4.0.dev2__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 (69) hide show
  1. commands/cat/debug_log.2025-06-05_20-24-18_123924.log.zip +0 -0
  2. commands/cat/debug_log.2025-06-10_08-45-03_929921.log.zip +0 -0
  3. commands/cat/debug_log.2025-06-11_09-57-21_247890.log.zip +0 -0
  4. commands/cat/debug_log.2025-06-12_16-14-31_212042.log.zip +0 -0
  5. commands/cat/dr_egeria_md.py +32 -5
  6. commands/cat/list_collections.py +10 -4
  7. commands/cat/list_data_designer.py +171 -0
  8. md_processing/__init__.py +7 -2
  9. md_processing/data/commands.json +4666 -848
  10. md_processing/md_commands/data_designer_commands.py +840 -557
  11. md_processing/md_commands/solution_architect_commands.py +985 -0
  12. md_processing/md_processing_utils/common_md_proc_utils.py +262 -89
  13. md_processing/md_processing_utils/common_md_utils.py +11 -4
  14. md_processing/md_processing_utils/md_processing_constants.py +18 -16
  15. pyegeria/_client.py +39 -0
  16. pyegeria/classification_manager_omvs.py +1 -1
  17. pyegeria/collection_manager_omvs.py +248 -188
  18. pyegeria/data_designer_omvs.py +217 -9
  19. pyegeria/governance_officer_omvs.py +2349 -0
  20. pyegeria/output_formatter.py +24 -12
  21. pyegeria/solution_architect_omvs.py +4219 -1084
  22. pyegeria/utils.py +15 -2
  23. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev2.dist-info}/METADATA +2 -1
  24. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev2.dist-info}/RECORD +27 -62
  25. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev2.dist-info}/entry_points.txt +3 -0
  26. commands/cat/.DS_Store +0 -0
  27. md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +0 -254
  28. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +0 -696
  29. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +0 -254
  30. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +0 -298
  31. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +0 -608
  32. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +0 -94
  33. md_processing/dr_egeria_inbox/archive/freddie_intro.md +0 -284
  34. md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +0 -275
  35. md_processing/dr_egeria_inbox/archive/test-term.md +0 -110
  36. md_processing/dr_egeria_inbox/cat_test.md +0 -100
  37. md_processing/dr_egeria_inbox/data_field.md +0 -54
  38. md_processing/dr_egeria_inbox/data_spec.md +0 -77
  39. md_processing/dr_egeria_inbox/data_spec_test.md +0 -2406
  40. md_processing/dr_egeria_inbox/data_test.md +0 -86
  41. md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +0 -168
  42. md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +0 -280
  43. md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +0 -313
  44. md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +0 -1073
  45. md_processing/dr_egeria_inbox/dr_egeria_isc1.md +0 -44
  46. md_processing/dr_egeria_inbox/glossary_test1.md +0 -324
  47. md_processing/dr_egeria_inbox/rel.md +0 -8
  48. md_processing/dr_egeria_inbox/sb.md +0 -119
  49. md_processing/dr_egeria_inbox/search_test.md +0 -39
  50. md_processing/dr_egeria_inbox/solution-components.md +0 -154
  51. md_processing/dr_egeria_inbox/solution_blueprints.md +0 -118
  52. md_processing/dr_egeria_inbox/synonym_test.md +0 -42
  53. md_processing/dr_egeria_inbox/t1.md +0 -0
  54. md_processing/dr_egeria_inbox/t2.md +0 -268
  55. md_processing/dr_egeria_outbox/processed-2025-05-15 19:52-data_test.md +0 -94
  56. md_processing/dr_egeria_outbox/processed-2025-05-16 07:39-data_test.md +0 -88
  57. md_processing/dr_egeria_outbox/processed-2025-05-17 16:01-data_field.md +0 -56
  58. md_processing/dr_egeria_outbox/processed-2025-05-18 15:51-data_test.md +0 -103
  59. md_processing/dr_egeria_outbox/processed-2025-05-18 16:47-data_test.md +0 -94
  60. md_processing/dr_egeria_outbox/processed-2025-05-19 07:14-data_test.md +0 -96
  61. md_processing/dr_egeria_outbox/processed-2025-05-19 07:20-data_test.md +0 -100
  62. md_processing/dr_egeria_outbox/processed-2025-05-19 07:22-data_test.md +0 -88
  63. md_processing/dr_egeria_outbox/processed-2025-05-19 09:26-data_test.md +0 -91
  64. md_processing/dr_egeria_outbox/processed-2025-05-19 10:27-data_test.md +0 -91
  65. md_processing/dr_egeria_outbox/processed-2025-05-19 14:04-data_test.md +0 -91
  66. md_processing/md_commands/blueprint_commands.py +0 -303
  67. pyegeria/.DS_Store +0 -0
  68. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev2.dist-info}/LICENSE +0 -0
  69. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev2.dist-info}/WHEEL +0 -0
@@ -1,9 +1,14 @@
1
1
  """
2
2
  This is an ongoing experiment in parsing and playing with Freddie docs
3
3
  """
4
- import os
4
+ import os, sys
5
5
  from datetime import datetime
6
-
6
+ from loguru import logger
7
+ log_format = "{time} | {level} | {function} | {line} | {message} | {extra}"
8
+ logger.remove()
9
+ logger.add(sys.stderr, level="SUCCESS", format=log_format, colorize=True)
10
+ logger.add("debug_log.log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
11
+ colorize=True)
7
12
  import click
8
13
  from rich import print
9
14
  from rich.console import Console
@@ -15,12 +20,14 @@ from md_processing import (extract_command, process_glossary_upsert_command, pro
15
20
  process_category_list_command, process_glossary_list_command, process_term_history_command,
16
21
  process_glossary_structure_command, process_term_revision_history_command,
17
22
  process_create_term_term_relationship_command, process_term_details_command,
18
- )
23
+ process_information_supply_chain_upsert_command, process_information_supply_chain_segment_upsert_command,
24
+ process_information_supply_chain_link_unlink_command,process_sol_arch_list_command)
19
25
  from md_processing.md_commands.data_designer_commands import (process_data_spec_upsert_command,
20
26
  process_data_dict_upsert_command,
21
27
  process_data_dict_list_command,
22
28
  process_data_field_upsert_command,
23
- process_data_structure_upsert_command)
29
+ process_data_structure_upsert_command,
30
+ process_data_class_upsert_command)
24
31
 
25
32
  from pyegeria import EgeriaTech
26
33
 
@@ -53,10 +60,12 @@ EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_eger
53
60
  @click.option("--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to")
54
61
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
55
62
  @click.option("--user_pass", default=EGERIA_USER_PASSWORD, help="Egeria user password")
63
+ @logger.catch
56
64
  def process_markdown_file(file_path: str, directive: str, server: str, url: str, userid: str, user_pass: str, ) -> None:
57
65
  """
58
66
  Process a markdown file by parsing and executing Dr. Egeria md_commands. Write output to a new file.
59
67
  """
68
+
60
69
  cmd_list = command_list
61
70
  console = Console(width=int(EGERIA_WIDTH))
62
71
  client = EgeriaTech(server, url, user_id=userid)
@@ -64,7 +73,8 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
64
73
 
65
74
  updated = False
66
75
  full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, file_path)
67
- print(f"Processing Markdown File: {full_file_path}")
76
+ logger.info("\n\n====================================================\n\n")
77
+ logger.info(f"Processing Markdown File: {full_file_path}")
68
78
  try:
69
79
  with open(full_file_path, 'r') as f:
70
80
  lines = f.readlines()
@@ -121,8 +131,23 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
121
131
  elif potential_command in ["Create Blueprint", "Update Blueprint", "Create Solution Blueprint",
122
132
  "Update Solution Blueprint"]:
123
133
  result = process_blueprint_upsert_command(client, current_block, directive)
134
+ elif potential_command in ["View Solution Blueprints", "View Blueprint", "View Solution Blueprint"]:
135
+ result = process_sol_arch_list_command(client, current_block, "Solution Blueprints",directive)
136
+ elif potential_command in ["View Solution Component", "View Solution Components"]:
137
+ result = process_sol_arch_list_command(client, current_block, "Solution Components",directive)
138
+ elif potential_command in ["View Solution Roles", "View Solution Role"]:
139
+ result = process_sol_arch_list_command(client, current_block, "Solution Roles",directive)
140
+ elif potential_command in ["View Information Supply Chain", "View Information Supply Chains"]:
141
+ result = process_sol_arch_list_command(client, current_block, "Information Supply Chains",directive)
124
142
  elif potential_command in ["Create Solution Component", "Update Solution Component"]:
125
143
  result = process_solution_component_upsert_command(client, current_block, directive)
144
+ elif potential_command in ["Create Information Supply Chain", "Update Information Supply Chain"]:
145
+ result = process_information_supply_chain_upsert_command(client, current_block, directive)
146
+ elif potential_command in ["Create Information Supply Chain Segment", "Update Information Supply Chain Segment"]:
147
+ result = process_information_supply_chain_segment_upsert_command(client, current_block, directive)
148
+ elif potential_command in ["Link Segments", "Detach Segments"]:
149
+ result = process_information_supply_chain_link_unlink_command(client, current_block, directive)
150
+
126
151
  elif potential_command in ["Create Data Spec", "Create Data Specification", "Update Data Spec",
127
152
  "Update Data Specification"]:
128
153
  result = process_data_spec_upsert_command(client, current_block, directive)
@@ -133,6 +158,8 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
133
158
  result = process_data_field_upsert_command(client, current_block, directive)
134
159
  elif potential_command in ["Create Data Structure", "Update Data Structure"]:
135
160
  result = process_data_structure_upsert_command(client, current_block, directive)
161
+ elif potential_command in ["Create Data Class", "Update Data Class"]:
162
+ result = process_data_class_upsert_command(client, current_block, directive)
136
163
  elif potential_command in ["View Data Dictionaries", "View Data Dictionary"]:
137
164
  result = process_data_dict_list_command(client, current_block, directive)
138
165
 
@@ -94,7 +94,7 @@ def display_collections(
94
94
  full_file_path = os.path.join(file_path, file_name)
95
95
  os.makedirs(os.path.dirname(full_file_path), exist_ok=True)
96
96
  output = m_client.find_collections(
97
- search_string.strip(), None, False, ends_with=False, ignore_case=True,
97
+ search_string.strip(), None, None, False, ends_with=False, ignore_case=True,
98
98
  output_format=output_format
99
99
  )
100
100
  if output == NO_ELEMENTS_FOUND:
@@ -129,7 +129,7 @@ def display_collections(
129
129
  table.add_column("Members")
130
130
 
131
131
  collections = m_client.find_collections(
132
- search_string.strip(), None, False, ends_with=False, ignore_case=True,
132
+ search_string.strip(), None, None, False, ends_with=False, ignore_case=True,
133
133
  output_format = "DICT"
134
134
  )
135
135
  if type(collections) is list:
@@ -145,8 +145,14 @@ def display_collections(
145
145
  collection_type = collection.get("collectionType", "---")
146
146
  classifications = collection.get("classifications", "---")
147
147
  classifications_md = Markdown(classifications)
148
- members = "\n* ".join(collection.get("members", []))
149
- members_md = Markdown(members)
148
+ members_struct = m_client.get_collection_members(collection_guid=guid)
149
+ member_list = ""
150
+ if isinstance(members_struct, list):
151
+ for member in members_struct:
152
+ member_list = member_list + f"- {member['properties'].get('qualifiedName','---')}\n"
153
+
154
+ # members = "\n* ".join(collection.get("members", []))
155
+ members_md = Markdown(member_list)
150
156
 
151
157
  table.add_row(
152
158
  display_name,
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ List categories for a category.
7
+
8
+
9
+ A simple display for category terms
10
+ """
11
+ import argparse
12
+ import os
13
+ import sys
14
+ import time
15
+
16
+ from rich import box, print
17
+ from rich.console import Console
18
+ from rich.prompt import Prompt
19
+ from rich.table import Table
20
+ from rich.text import Text
21
+ from rich.console import Console
22
+ from rich.markdown import Markdown
23
+
24
+
25
+ from pyegeria import (
26
+ EgeriaTech,
27
+ InvalidParameterException,
28
+ PropertyServerException,
29
+ UserNotAuthorizedException,
30
+ print_exception_response,
31
+ )
32
+
33
+ disable_ssl_warnings = True
34
+
35
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
36
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
37
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
38
+ EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
39
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
40
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
41
+ )
42
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
43
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
44
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
45
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
46
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
47
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
48
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
49
+ EGERIA_category_PATH = os.environ.get("EGERIA_category_PATH", None)
50
+ EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../../")
51
+ EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "md_processing/dr_egeria_inbox")
52
+ EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_egeria_outbox")
53
+
54
+ console = Console(width=EGERIA_WIDTH)
55
+
56
+
57
+ def display_categories(
58
+ object_type: str,
59
+ search_string: str = "*",
60
+ view_server: str = EGERIA_VIEW_SERVER,
61
+ view_url: str = EGERIA_VIEW_SERVER_URL,
62
+ user: str = EGERIA_USER,
63
+ user_pass: str = EGERIA_USER_PASSWORD,
64
+ jupyter: bool = EGERIA_JUPYTER,
65
+ width: int = EGERIA_WIDTH,
66
+ output_format: str = "TABLE",
67
+ ):
68
+ """Display either a specified category or all categories if the search_string is '*'.
69
+ Parameters
70
+ ----------
71
+ object_type: str
72
+ The type of object to display,
73
+ search_string : str, default is '*'
74
+ The string used to search for categories.
75
+ view_server : str
76
+ The view server name or address where the Egeria services are hosted.
77
+ view_url : str
78
+ The URL of the platform the view server is on.
79
+ user : str
80
+ The user ID for authentication with the Egeria server.
81
+ user_pass : str
82
+ The password for authentication with the Egeria server.
83
+ jupyter : bool, optional
84
+ A boolean indicating whether the output is intended for a Jupyter notebook (default is EGERIA_JUPYTER).
85
+ width : int, optional
86
+ The width of the console output (default is EGERIA_WIDTH).
87
+ output_format: str, optional, default is 'JSON'
88
+ One of FORM, REPORT, TABLE
89
+ """
90
+ m_client = EgeriaTech(view_server, view_url, user_id=user, user_pwd=user_pass)
91
+ token = m_client.create_egeria_bearer_token()
92
+
93
+ match object_type:
94
+ case "Data Structure":
95
+ find_proc = m_client.find_data_structures
96
+ case "Data Fields":
97
+ find_proc = m_client.find_data_fields
98
+ case "Data Classes":
99
+ find_proc = m_client.find_data_classes
100
+
101
+ try:
102
+ if output_format == "FORM":
103
+ action = "Update-Form"
104
+ elif output_format == "REPORT":
105
+ action = "Report"
106
+ if output_format != "TABLE":
107
+ file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_OUTBOX_PATH)
108
+ file_name = f"{object_type}-{time.strftime('%Y-%m-%d-%H-%M-%S')}-{action}.md"
109
+ full_file_path = os.path.join(file_path, file_name)
110
+ os.makedirs(os.path.dirname(full_file_path), exist_ok=True)
111
+ output = m_client.find_proc(search_string, output_format=output_format)
112
+ if output == "NO_ELEMENTSS_FOUND":
113
+ print(f"\n==> No elements found for search string '{search_string}'")
114
+ return
115
+ with open(full_file_path, 'w') as f:
116
+ f.write(output)
117
+ print(f"\n==> Elements output written to {full_file_path}")
118
+ return
119
+ else:
120
+ output = m_client.find_proec(search_string, output_format=output_format)
121
+ console.print(Markdown(output))
122
+ return
123
+
124
+
125
+
126
+
127
+ except (InvalidParameterException, PropertyServerException) as e:
128
+ print_exception_response(e)
129
+ finally:
130
+ m_client.close_session()
131
+
132
+
133
+ def main_structs():
134
+ main(object_type = "Data Structure")
135
+
136
+ def main_fileds():
137
+ main(object_type = "Data Fields")
138
+
139
+ def main_classes():
140
+ main(object_type = "Data Classes")
141
+
142
+ def main(object_type: str):
143
+ parser = argparse.ArgumentParser()
144
+ parser.add_argument("--server", help="Name of the server to display status for")
145
+ parser.add_argument("--url", help="URL Platform to connect to")
146
+ parser.add_argument("--userid", help="User Id")
147
+ parser.add_argument("--password", help="User Password")
148
+
149
+ args = parser.parse_args()
150
+
151
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
152
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
153
+ userid = args.userid if args.userid is not None else EGERIA_USER
154
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
155
+
156
+ try:
157
+ search_string = Prompt.ask(
158
+ "Enter the category you are searching for or '*' for all:", default="*"
159
+ )
160
+ output_format = Prompt.ask("What output format do you want?", choices=["TABLE", "FORM", "REPORT"],
161
+ default="TABLE")
162
+ object_type = object_type if not None else "Data Structure"
163
+ display_categories(object_type, search_string, server, url, userid,
164
+ user_pass, output_format = output_format)
165
+
166
+ except KeyboardInterrupt:
167
+ pass
168
+
169
+
170
+ if __name__ == "__main__":
171
+ main()
md_processing/__init__.py CHANGED
@@ -2,8 +2,13 @@
2
2
  This package contains functions to parse and process Egeria Markdown (Freddie)
3
3
  """
4
4
 
5
- from md_processing.md_commands.blueprint_commands import (process_blueprint_upsert_command,
6
- process_solution_component_upsert_command)
5
+ from md_processing.md_commands.solution_architect_commands import (process_blueprint_upsert_command,
6
+ process_solution_component_upsert_command,
7
+ process_information_supply_chain_upsert_command,
8
+ process_information_supply_chain_segment_upsert_command,
9
+ process_information_supply_chain_link_unlink_command,
10
+ process_sol_arch_list_command)
11
+
7
12
  from md_processing.md_commands.data_designer_commands import (process_data_field_upsert_command,
8
13
  process_data_spec_upsert_command,
9
14
  process_data_dict_upsert_command,