pyegeria 5.3.9.9.3__py3-none-any.whl → 5.5.3.3__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.

Potentially problematic release.


This version of pyegeria might be problematic. Click here for more details.

Files changed (272) hide show
  1. commands/__init__.py +24 -0
  2. commands/cat/Dr-Egeria_md-orig.py +2 -2
  3. commands/cat/__init__.py +1 -17
  4. commands/cat/collection_actions.py +197 -0
  5. commands/cat/dr_egeria_command_help.py +372 -0
  6. commands/cat/dr_egeria_jupyter.py +7 -7
  7. commands/cat/dr_egeria_md.py +27 -182
  8. commands/cat/exp_list_glossaries.py +11 -14
  9. commands/cat/get_asset_graph.py +37 -267
  10. commands/cat/{get_collection.py → get_collection_tree.py} +10 -18
  11. commands/cat/get_project_dependencies.py +14 -14
  12. commands/cat/get_project_structure.py +15 -14
  13. commands/cat/get_tech_type_elements.py +16 -116
  14. commands/cat/glossary_actions.py +145 -298
  15. commands/cat/list_assets.py +3 -11
  16. commands/cat/list_cert_types.py +17 -63
  17. commands/cat/list_collections.py +46 -138
  18. commands/cat/list_deployed_catalogs.py +15 -27
  19. commands/cat/list_deployed_database_schemas.py +27 -43
  20. commands/cat/list_deployed_databases.py +16 -31
  21. commands/cat/list_deployed_servers.py +35 -54
  22. commands/cat/list_glossaries.py +18 -17
  23. commands/cat/list_projects.py +10 -12
  24. commands/cat/list_tech_type_elements.py +21 -37
  25. commands/cat/list_tech_types.py +13 -25
  26. commands/cat/list_terms.py +38 -79
  27. commands/cat/list_todos.py +4 -11
  28. commands/cat/list_user_ids.py +3 -10
  29. commands/cat/my_reports.py +559 -0
  30. commands/cat/run_report.py +394 -0
  31. commands/cat/run_report_orig.py +528 -0
  32. commands/cli/egeria.py +222 -247
  33. commands/cli/egeria_cat.py +68 -81
  34. commands/cli/egeria_my.py +13 -0
  35. commands/cli/egeria_ops.py +69 -74
  36. commands/cli/egeria_tech.py +17 -93
  37. commands/cli/ops_config.py +3 -6
  38. commands/{cat/list_categories.py → deprecated/list_data_designer.py} +53 -64
  39. commands/{cat/list_data_structures.py → deprecated/list_data_structures_full.py} +3 -6
  40. commands/deprecated/old_get_asset_graph.py +315 -0
  41. commands/my/__init__.py +0 -2
  42. commands/my/list_my_profile.py +27 -34
  43. commands/my/list_my_roles.py +1 -7
  44. commands/my/monitor_my_todos.py +1 -7
  45. commands/my/monitor_open_todos.py +6 -7
  46. commands/my/todo_actions.py +4 -5
  47. commands/ops/__init__.py +0 -2
  48. commands/ops/gov_server_actions.py +17 -21
  49. commands/ops/list_archives.py +17 -38
  50. commands/ops/list_catalog_targets.py +33 -40
  51. commands/ops/load_archive.py +35 -26
  52. commands/ops/{monitor_engine_activity_c.py → monitor_active_engine_activity.py} +51 -82
  53. commands/ops/{monitor_integ_daemon_status.py → monitor_daemon_status.py} +35 -55
  54. commands/ops/monitor_engine_activity.py +79 -77
  55. commands/ops/{monitor_gov_eng_status.py → monitor_engine_status.py} +10 -7
  56. commands/ops/monitor_platform_status.py +38 -50
  57. commands/ops/monitor_server_startup.py +6 -11
  58. commands/ops/monitor_server_status.py +7 -11
  59. commands/ops/orig_monitor_server_list.py +8 -8
  60. commands/ops/orig_monitor_server_status.py +1 -5
  61. commands/ops/refresh_integration_daemon.py +5 -5
  62. commands/ops/restart_integration_daemon.py +5 -5
  63. commands/ops/table_integ_daemon_status.py +6 -6
  64. commands/ops/x_engine_actions.py +7 -7
  65. commands/tech/__init__.py +0 -2
  66. commands/tech/{generic_actions.py → element_actions.py} +6 -11
  67. commands/tech/get_element_info.py +20 -29
  68. commands/tech/get_guid_info.py +23 -42
  69. commands/tech/get_tech_details.py +20 -35
  70. commands/tech/get_tech_type_template.py +28 -39
  71. commands/tech/list_all_om_type_elements.py +24 -30
  72. commands/tech/list_all_om_type_elements_x.py +22 -28
  73. commands/tech/list_all_related_elements.py +19 -28
  74. commands/tech/list_anchored_elements.py +22 -30
  75. commands/tech/list_asset_types.py +19 -24
  76. commands/tech/list_elements_by_classification_by_property_value.py +26 -32
  77. commands/tech/list_elements_by_property_value.py +19 -25
  78. commands/tech/list_elements_by_property_value_x.py +20 -28
  79. commands/tech/list_elements_for_classification.py +28 -41
  80. commands/tech/list_gov_action_processes.py +16 -27
  81. commands/tech/list_information_supply_chains.py +22 -30
  82. commands/tech/list_registered_services.py +14 -26
  83. commands/tech/list_related_elements_with_prop_value.py +15 -25
  84. commands/tech/list_related_specification.py +1 -4
  85. commands/tech/list_relationship_types.py +15 -25
  86. commands/tech/list_relationships.py +20 -36
  87. commands/tech/list_solution_blueprints.py +28 -33
  88. commands/tech/list_solution_components.py +23 -29
  89. commands/tech/list_solution_roles.py +21 -32
  90. commands/tech/list_tech_templates.py +51 -54
  91. commands/tech/list_valid_metadata_values.py +5 -9
  92. commands/tech/table_tech_templates.py +2 -6
  93. commands/tech/x_list_related_elements.py +1 -4
  94. examples/GeoSpatial Products Example.py +524 -0
  95. examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2137 -0
  96. examples/Jupyter Notebooks/README.md +2 -0
  97. examples/Jupyter Notebooks/common/P-environment-check.ipynb +115 -0
  98. examples/Jupyter Notebooks/common/__init__.py +14 -0
  99. examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
  100. examples/Jupyter Notebooks/common/environment-check.ipynb +52 -0
  101. examples/Jupyter Notebooks/common/globals.ipynb +184 -0
  102. examples/Jupyter Notebooks/common/globals.py +154 -0
  103. examples/Jupyter Notebooks/common/orig_globals.py +152 -0
  104. examples/format_sets/all_format_sets.json +910 -0
  105. examples/format_sets/custom_format_sets.json +268 -0
  106. examples/format_sets/subset_format_sets.json +187 -0
  107. examples/format_sets_save_load_example.py +291 -0
  108. examples/jacquard_data_sets.py +129 -0
  109. examples/output_formats_example.py +193 -0
  110. examples/test_jacquard_data_sets.py +54 -0
  111. examples/test_jacquard_data_sets_scenarios.py +94 -0
  112. md_processing/__init__.py +90 -0
  113. md_processing/command_dispatcher.py +33 -0
  114. md_processing/command_mapping.py +221 -0
  115. md_processing/data/commands/commands_data_designer.json +537 -0
  116. md_processing/data/commands/commands_external_reference.json +733 -0
  117. md_processing/data/commands/commands_feedback.json +155 -0
  118. md_processing/data/commands/commands_general.json +204 -0
  119. md_processing/data/commands/commands_glossary.json +218 -0
  120. md_processing/data/commands/commands_governance.json +3678 -0
  121. md_processing/data/commands/commands_product_manager.json +865 -0
  122. md_processing/data/commands/commands_project.json +642 -0
  123. md_processing/data/commands/commands_solution_architect.json +366 -0
  124. md_processing/data/commands.json +17568 -0
  125. md_processing/data/commands_working.json +30641 -0
  126. md_processing/data/gened_report_specs.py +6584 -0
  127. md_processing/data/generated_format_sets.json +6533 -0
  128. md_processing/data/generated_format_sets_old.json +4137 -0
  129. md_processing/data/generated_format_sets_old.py +45 -0
  130. md_processing/dr_egeria.py +182 -0
  131. md_processing/md_commands/__init__.py +3 -0
  132. md_processing/md_commands/data_designer_commands.py +1276 -0
  133. md_processing/md_commands/ext_ref_commands.py +530 -0
  134. md_processing/md_commands/feedback_commands.py +726 -0
  135. md_processing/md_commands/glossary_commands.py +684 -0
  136. md_processing/md_commands/governance_officer_commands.py +600 -0
  137. md_processing/md_commands/product_manager_commands.py +1266 -0
  138. md_processing/md_commands/project_commands.py +383 -0
  139. md_processing/md_commands/solution_architect_commands.py +1184 -0
  140. md_processing/md_commands/view_commands.py +295 -0
  141. md_processing/md_processing_utils/__init__.py +4 -0
  142. md_processing/md_processing_utils/common_md_proc_utils.py +1249 -0
  143. md_processing/md_processing_utils/common_md_utils.py +578 -0
  144. md_processing/md_processing_utils/determine_width.py +103 -0
  145. md_processing/md_processing_utils/extraction_utils.py +547 -0
  146. md_processing/md_processing_utils/gen_report_specs.py +643 -0
  147. md_processing/md_processing_utils/generate_dr_help.py +193 -0
  148. md_processing/md_processing_utils/generate_md_cmd_templates.py +144 -0
  149. md_processing/md_processing_utils/generate_md_templates.py +83 -0
  150. md_processing/md_processing_utils/md_processing_constants.py +1228 -0
  151. md_processing/md_processing_utils/message_constants.py +19 -0
  152. pyegeria/__init__.py +201 -443
  153. pyegeria/core/__init__.py +40 -0
  154. pyegeria/core/_base_platform_client.py +574 -0
  155. pyegeria/core/_base_server_client.py +573 -0
  156. pyegeria/core/_exceptions.py +457 -0
  157. pyegeria/core/_globals.py +60 -0
  158. pyegeria/core/_server_client.py +6073 -0
  159. pyegeria/core/_validators.py +257 -0
  160. pyegeria/core/config.py +654 -0
  161. pyegeria/{create_tech_guid_lists.py → core/create_tech_guid_lists.py} +0 -1
  162. pyegeria/core/load_config.py +37 -0
  163. pyegeria/core/logging_configuration.py +207 -0
  164. pyegeria/core/mcp_adapter.py +144 -0
  165. pyegeria/core/mcp_server.py +212 -0
  166. pyegeria/core/utils.py +405 -0
  167. pyegeria/deprecated/__init__.py +0 -0
  168. pyegeria/{_client.py → deprecated/_client.py} +62 -24
  169. pyegeria/{_deprecated_gov_engine.py → deprecated/_deprecated_gov_engine.py} +16 -16
  170. pyegeria/{classification_manager_omvs.py → deprecated/classification_manager_omvs.py} +1988 -1878
  171. pyegeria/deprecated/output_formatter_with_machine_keys.py +1127 -0
  172. pyegeria/{runtime_manager_omvs.py → deprecated/runtime_manager_omvs.py} +216 -229
  173. pyegeria/{valid_metadata_omvs.py → deprecated/valid_metadata_omvs.py} +93 -93
  174. pyegeria/{x_action_author_omvs.py → deprecated/x_action_author_omvs.py} +2 -3
  175. pyegeria/egeria_cat_client.py +25 -51
  176. pyegeria/egeria_client.py +140 -98
  177. pyegeria/egeria_config_client.py +48 -24
  178. pyegeria/egeria_tech_client.py +170 -83
  179. pyegeria/models/__init__.py +150 -0
  180. pyegeria/models/collection_models.py +168 -0
  181. pyegeria/models/models.py +654 -0
  182. pyegeria/omvs/__init__.py +84 -0
  183. pyegeria/omvs/action_author.py +342 -0
  184. pyegeria/omvs/actor_manager.py +5980 -0
  185. pyegeria/omvs/asset_catalog.py +842 -0
  186. pyegeria/omvs/asset_maker.py +2736 -0
  187. pyegeria/omvs/automated_curation.py +4403 -0
  188. pyegeria/omvs/classification_manager.py +11213 -0
  189. pyegeria/omvs/collection_manager.py +5780 -0
  190. pyegeria/omvs/community_matters_omvs.py +468 -0
  191. pyegeria/{core_omag_server_config.py → omvs/core_omag_server_config.py} +157 -157
  192. pyegeria/{data_designer_omvs.py → omvs/data_designer.py} +1991 -1691
  193. pyegeria/omvs/data_discovery.py +869 -0
  194. pyegeria/omvs/data_engineer.py +372 -0
  195. pyegeria/omvs/digital_business.py +1133 -0
  196. pyegeria/omvs/external_links.py +1752 -0
  197. pyegeria/omvs/feedback_manager.py +834 -0
  198. pyegeria/{full_omag_server_config.py → omvs/full_omag_server_config.py} +73 -69
  199. pyegeria/omvs/glossary_manager.py +3231 -0
  200. pyegeria/omvs/governance_officer.py +3009 -0
  201. pyegeria/omvs/lineage_linker.py +314 -0
  202. pyegeria/omvs/location_arena.py +1525 -0
  203. pyegeria/omvs/metadata_expert.py +668 -0
  204. pyegeria/omvs/metadata_explorer_omvs.py +2943 -0
  205. pyegeria/omvs/my_profile.py +1042 -0
  206. pyegeria/omvs/notification_manager.py +358 -0
  207. pyegeria/omvs/people_organizer.py +394 -0
  208. pyegeria/{platform_services.py → omvs/platform_services.py} +113 -193
  209. pyegeria/omvs/product_manager.py +1825 -0
  210. pyegeria/omvs/project_manager.py +1907 -0
  211. pyegeria/omvs/reference_data.py +1140 -0
  212. pyegeria/omvs/registered_info.py +334 -0
  213. pyegeria/omvs/runtime_manager.py +2817 -0
  214. pyegeria/omvs/schema_maker.py +446 -0
  215. pyegeria/{server_operations.py → omvs/server_operations.py} +27 -26
  216. pyegeria/omvs/solution_architect.py +6490 -0
  217. pyegeria/omvs/specification_properties.py +37 -0
  218. pyegeria/omvs/subject_area.py +1042 -0
  219. pyegeria/omvs/template_manager_omvs.py +236 -0
  220. pyegeria/omvs/time_keeper.py +1761 -0
  221. pyegeria/omvs/valid_metadata.py +3221 -0
  222. pyegeria/omvs/valid_metadata_lists.py +37 -0
  223. pyegeria/omvs/valid_type_lists.py +37 -0
  224. pyegeria/view/__init__.py +28 -0
  225. pyegeria/view/_output_format_models.py +514 -0
  226. pyegeria/view/_output_formats.py +14 -0
  227. pyegeria/view/base_report_formats.py +2719 -0
  228. pyegeria/view/dr_egeria_reports.py +56 -0
  229. pyegeria/view/format_set_executor.py +397 -0
  230. pyegeria/{md_processing_utils.py → view/md_processing_utils.py} +5 -5
  231. pyegeria/{mermaid_utilities.py → view/mermaid_utilities.py} +2 -154
  232. pyegeria/view/output_formatter.py +1297 -0
  233. pyegeria-5.5.3.3.dist-info/METADATA +218 -0
  234. pyegeria-5.5.3.3.dist-info/RECORD +241 -0
  235. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info}/WHEEL +2 -1
  236. pyegeria-5.5.3.3.dist-info/entry_points.txt +103 -0
  237. pyegeria-5.5.3.3.dist-info/top_level.txt +4 -0
  238. commands/cat/.DS_Store +0 -0
  239. commands/cat/README.md +0 -16
  240. commands/cli/txt_custom_v2.tcss +0 -19
  241. commands/my/README.md +0 -17
  242. commands/ops/README.md +0 -24
  243. commands/ops/monitor_asset_events.py +0 -108
  244. commands/tech/README.md +0 -24
  245. pyegeria/.DS_Store +0 -0
  246. pyegeria/README.md +0 -35
  247. pyegeria/_globals.py +0 -47
  248. pyegeria/_validators.py +0 -385
  249. pyegeria/asset_catalog_omvs.py +0 -864
  250. pyegeria/automated_curation_omvs.py +0 -3765
  251. pyegeria/collection_manager_omvs.py +0 -2744
  252. pyegeria/dr.egeria spec.md +0 -9
  253. pyegeria/egeria_my_client.py +0 -56
  254. pyegeria/feedback_manager_omvs.py +0 -4573
  255. pyegeria/glossary_browser_omvs.py +0 -3728
  256. pyegeria/glossary_manager_omvs.py +0 -2440
  257. pyegeria/m_test.py +0 -118
  258. pyegeria/md_processing_helpers.py +0 -58
  259. pyegeria/md_processing_utils_orig.py +0 -1103
  260. pyegeria/metadata_explorer_omvs.py +0 -2326
  261. pyegeria/my_profile_omvs.py +0 -1022
  262. pyegeria/output_formatter.py +0 -389
  263. pyegeria/project_manager_omvs.py +0 -1933
  264. pyegeria/registered_info.py +0 -167
  265. pyegeria/solution_architect_omvs.py +0 -2156
  266. pyegeria/template_manager_omvs.py +0 -1414
  267. pyegeria/utils.py +0 -197
  268. pyegeria-5.3.9.9.3.dist-info/METADATA +0 -72
  269. pyegeria-5.3.9.9.3.dist-info/RECORD +0 -143
  270. pyegeria-5.3.9.9.3.dist-info/entry_points.txt +0 -99
  271. /pyegeria/{_exceptions.py → deprecated/_exceptions.py} +0 -0
  272. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info/licenses}/LICENSE +0 -0
@@ -2,27 +2,19 @@
2
2
  This is an ongoing experiment in parsing and playing with Freddie docs
3
3
  """
4
4
  import os
5
- from datetime import datetime
5
+ import sys
6
6
 
7
- import click
8
- from rich import print
9
- from rich.console import Console
7
+ from loguru import logger
10
8
 
11
- from md_processing import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
12
- process_category_upsert_command, process_provenance_command, get_current_datetime_string,
13
- process_per_proj_upsert_command, command_list, process_blueprint_upsert_command,
14
- process_solution_component_upsert_command, process_term_list_command,
15
- process_category_list_command, process_glossary_list_command, process_term_history_command,
16
- process_glossary_structure_command, process_term_revision_history_command,
17
- process_create_term_term_relationship_command, process_term_details_command,
18
- )
19
- from md_processing.md_commands.data_designer_commands import (process_data_spec_upsert_command,
20
- process_data_dict_upsert_command,
21
- process_data_dict_list_command,
22
- process_data_field_upsert_command,
23
- process_data_structure_upsert_command)
9
+ log_format = "{time} | {level} | {function} | {line} | {message} | {extra}"
10
+ logger.remove()
11
+ logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
12
+ logger.add("debug_log.log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
13
+ colorize=True)
14
+ import click
24
15
 
25
- from pyegeria import EgeriaTech
16
+ from pyegeria.core._exceptions import PyegeriaException
17
+ from md_processing.dr_egeria import process_md_file
26
18
 
27
19
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
28
20
  EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
@@ -39,180 +31,33 @@ EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
39
31
  EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
40
32
  EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
41
33
  EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
42
- EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../../")
34
+ EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../..")
43
35
  EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "md_processing/dr_egeria_inbox")
44
36
  EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_egeria_outbox")
45
37
 
46
-
47
38
  @click.command("process_markdown_file", help="Process a markdown file and return the output as a string.")
48
- @click.option("--file-path", help="File path to markdown file", default="glossary_test1.md", required=True,
39
+ @click.option("--input-file", help="Markdown file to process.", default="dr_egeria_intro_part1.md", required=True,
49
40
  prompt=False)
50
- @click.option("--directive", default="display", help="How to process the file",
51
- type=click.Choice(["display", "validate", "process"], case_sensitive=False), prompt=False, )
41
+ @click.option("--output-folder", help="Output folder.", default="", required=False)
42
+ @click.option("--directive", default="process", help="How to process the file",
43
+ type = click.Choice(["display", "validate", "process"], case_sensitive=False), prompt=False, )
52
44
  @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use.")
53
45
  @click.option("--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to")
54
46
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
55
47
  @click.option("--user_pass", default=EGERIA_USER_PASSWORD, help="Egeria user password")
56
- def process_markdown_file(file_path: str, directive: str, server: str, url: str, userid: str, user_pass: str, ) -> None:
48
+ @logger.catch
49
+ def process_markdown_file(input_file: str, output_folder:str, directive: str, server: str, url: str, userid: str,
50
+ user_pass: str ) -> None:
57
51
  """
58
52
  Process a markdown file by parsing and executing Dr. Egeria md_commands. Write output to a new file.
59
53
  """
60
- cmd_list = command_list
61
- console = Console(width=int(EGERIA_WIDTH))
62
- client = EgeriaTech(server, url, user_id=userid)
63
- token = client.create_egeria_bearer_token(userid, user_pass)
64
-
65
- updated = False
66
- full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, file_path)
67
- print(f"Processing Markdown File: {full_file_path}")
68
54
  try:
69
- with open(full_file_path, 'r') as f:
70
- lines = f.readlines()
71
- except FileNotFoundError:
72
- print(f"Error: File not found at path: {full_file_path}")
73
- return {} # Return empty dict if file not found
74
-
75
- final_output = []
76
- prov_found = False
77
- prov_output = (f"\n# Provenance\n\n* Results from processing file {file_path} on "
78
- f"{datetime.now().strftime("%Y-%m-%d %H:%M")}\n")
79
- h1_blocks = []
80
- current_block = ""
81
- in_h1_block = False
82
-
83
- # Helper function to process the current block
84
- def process_current_block(current_block):
85
- nonlocal updated, final_output, prov_found, prov_output, h1_blocks, in_h1_block
86
-
87
- if not current_block:
88
- return # No block to process
89
-
90
- potential_command = extract_command(current_block) # Extract object_action
91
- if potential_command in cmd_list:
92
- # Process the block based on the object_action
93
- if potential_command == "Provenance":
94
- result = process_provenance_command(file_path, current_block)
95
- prov_found = True
96
-
97
- elif potential_command in ["Create Glossary", "Update Glossary"]:
98
- result = process_glossary_upsert_command(client, current_block, directive)
99
- elif potential_command in ["Create Category", "Update Category"]:
100
- result = process_category_upsert_command(client, current_block, directive)
101
- elif potential_command in ["Create Term", "Update Term"]:
102
- result = process_term_upsert_command(client, current_block, directive)
103
- elif potential_command in ["Create Term-Term Relationship", "Update Term-Term Relationship"]:
104
- result = process_create_term_term_relationship_command(client, current_block, directive)
105
- elif potential_command in ["List Term History", "Term History"]:
106
- result = process_term_history_command(client, current_block, directive)
107
- elif potential_command in ["List Term Details"]:
108
- result = process_term_details_command(client, current_block, directive)
109
- elif potential_command in ["List Term Update History", "List Term Revision History"]:
110
- result = process_term_revision_history_command(client, current_block, directive)
111
- elif potential_command in ["List Terms", "List Glossary Terms"]:
112
- result = process_term_list_command(client, current_block, directive)
113
- elif potential_command in ["List Categories", "List Glossary Categories"]:
114
- result = process_category_list_command(client, current_block, directive)
115
- elif potential_command in ["List Glossary Structure"]:
116
- result = process_glossary_structure_command(client, current_block, directive)
117
- elif potential_command in ["List Glossaries"]:
118
- result = process_glossary_list_command(client, current_block, directive)
119
- elif potential_command in ["Create Personal Project", "Update Personal Project"]:
120
- result = process_per_proj_upsert_command(client, current_block, directive)
121
- elif potential_command in ["Create Blueprint", "Update Blueprint", "Create Solution Blueprint",
122
- "Update Solution Blueprint"]:
123
- result = process_blueprint_upsert_command(client, current_block, directive)
124
- elif potential_command in ["Create Solution Component", "Update Solution Component"]:
125
- result = process_solution_component_upsert_command(client, current_block, directive)
126
- elif potential_command in ["Create Data Spec", "Create Data Specification", "Update Data Spec",
127
- "Update Data Specification"]:
128
- result = process_data_spec_upsert_command(client, current_block, directive)
129
- elif potential_command in ["Create Data Dict", "Create Data Dictionary", "Update Data Spec",
130
- "Update Data Dictionary"]:
131
- result = process_data_dict_upsert_command(client, current_block, directive)
132
- elif potential_command in ["Create Data Field", "Update Data Field"]:
133
- result = process_data_field_upsert_command(client, current_block, directive)
134
- elif potential_command in ["Create Data Structure", "Update Data Structure"]:
135
- result = process_data_structure_upsert_command(client, current_block, directive)
136
- elif potential_command in ["View Data Dictionaries", "View Data Dictionary"]:
137
- result = process_data_dict_list_command(client, current_block, directive)
138
-
139
-
140
- else:
141
- # If object_action is not recognized, keep the block as-is
142
- result = None
143
- # print(json.dumps(dr_egeria_state.get_element_dictionary(), indent=4))
144
- if result:
145
- if directive == "process":
146
- updated = True
147
- final_output.append(result) # print(json.dumps(dr_egeria_state.get_element_dictionary(), indent=4))
148
- elif directive == "validate":
149
- pass # print(json.dumps(dr_egeria_state.get_element_dictionary(), indent=4))
150
- elif directive == "process":
151
- # Handle errors (skip this block but notify the user)
152
- print(f"\n==>\tErrors found while processing command: \'{potential_command}\'\n"
153
- f"\tPlease correct and try again. \n")
154
- final_output.append(current_block)
155
- final_output.append('\n___\n')
156
- else:
157
- # If there is no object_action, append the block as-is
158
- final_output.append(current_block)
159
-
160
- # Main parsing loop
161
- for line in lines:
162
- line = line.strip() # Remove leading/trailing whitespace
163
-
164
- # Handle a new H1 block (starting with `# `)
165
- if line.startswith("# "):
166
- if in_h1_block:
167
- # Process the current block before starting a new one
168
- process_current_block(current_block)
169
-
170
- # Start a new H1 block
171
- current_block = line
172
- in_h1_block = True
173
-
174
- # Handle the end of a block (line starts with `---`)
175
- elif line.startswith("___"):
176
- if in_h1_block:
177
- # Process the current block when it ends with `---`
178
- current_block += f"\n{line}"
179
- process_current_block(current_block)
180
- current_block = "" # Clear the block
181
- in_h1_block = False
182
-
183
- # Add lines to the current H1 block
184
- elif in_h1_block:
185
- current_block += f"\n{line}"
186
-
187
- # Append non-H1 content directly to the output
188
- else:
189
- final_output.append(line)
190
-
191
- # Ensure the final H1 block is processed if the file doesn't end with `---`
192
- if in_h1_block:
193
- process_current_block(current_block)
194
-
195
- # Join the final output list into a single string
196
- final_output = "\n".join(final_output)
197
-
198
- try:
199
- if updated:
200
- path, filename = os.path.split(file_path) # Get both parts
201
- new_filename = f"processed-{get_current_datetime_string()}-{filename}" # Create the new filename
202
- new_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_OUTBOX_PATH, new_filename) # Construct the new path
203
- os.makedirs(os.path.dirname(new_file_path), exist_ok=True)
204
-
205
- with open(new_file_path, 'w') as f2:
206
- f2.write(final_output)
207
- if not prov_found:
208
- f2.write(prov_output)
209
- click.echo(f"\n==> Output written to {new_file_path}")
210
- else:
211
- if directive != 'display':
212
- click.echo("\nNo updates detected. New File not created.")
213
-
214
- except (Exception):
215
- console.print_exception(show_locals=True)
55
+ process_md_file(input_file, output_folder, directive, server, url, userid, user_pass)
56
+ logger.info(f"Called process_markdown_file with input file {input_file}")
57
+ except PyegeriaException as e:
58
+ logger.error(f"Error processing markdown file {input_file}: {e}")
59
+ except Exception as e:
60
+ logger.error(f"Unexpected error processing markdown file {input_file}: {e}")
216
61
 
217
62
 
218
63
  # def main():
@@ -231,11 +76,11 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
231
76
  # user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
232
77
  # time_out = args.time_out if args.time_out is not None else 60
233
78
  # try:
234
- # file_path = Prompt.ask("Markdown File name to process:", default="")
79
+ # input_file = Prompt.ask("Markdown File name to process:", default="")
235
80
  # directive = Prompt.ask("Processing Directive:", choices=[ "display", "validate", "process"],
236
81
  # default="validate")
237
82
  #
238
- # process_markdown_file(file_path, directive, server, url, userid, user_pass)
83
+ # process_markdown_file(input_file, directive, server, url, userid, user_pass)
239
84
  # except KeyboardInterrupt:
240
85
  # pass
241
86
  #
@@ -244,4 +89,4 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
244
89
  # main()
245
90
 
246
91
  if __name__ == "__main__":
247
- process_markdown_file()
92
+ process_markdown_file()
@@ -19,14 +19,11 @@ from rich.markdown import Markdown
19
19
  from rich.prompt import Prompt
20
20
  from rich.table import Table
21
21
  from rich.text import Text
22
- from rich_pixels import Pixels
22
+
23
23
 
24
24
  from pyegeria import (
25
25
  EgeriaTech,
26
- InvalidParameterException,
27
- PropertyServerException,
28
- UserNotAuthorizedException,
29
- print_exception_response,
26
+ PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table
30
27
  )
31
28
 
32
29
  disable_ssl_warnings = True
@@ -99,16 +96,17 @@ def display_glossaries(
99
96
  glossaries = m_client.find_glossaries(search_string)
100
97
  if type(glossaries) is list:
101
98
  sorted_glossary_list = sorted(
102
- glossaries, key=lambda k: k["glossaryProperties"]["displayName"]
99
+ glossaries, key=lambda k: k["properties"]["qualifiedName"]
103
100
  )
104
101
  for glossary in sorted_glossary_list:
105
- display_name = glossary["glossaryProperties"]["displayName"]
106
- qualified_name = glossary["glossaryProperties"]["qualifiedName"]
102
+
103
+ display_name = glossary["properties"].get("displayName","---")
104
+ qualified_name = glossary["properties"].get("qualifiedName","---")
107
105
  guid = glossary["elementHeader"]["guid"]
108
106
  q_name = Text(f"{qualified_name}\n&\n{guid}", justify="center")
109
- language = glossary["glossaryProperties"]["language"]
110
- description = glossary["glossaryProperties"]["description"]
111
- usage = glossary["glossaryProperties"]["usage"]
107
+ language = glossary["properties"].get("language","---")
108
+ description = glossary["properties"].get("description","---")
109
+ usage = glossary["properties"].get("usage","---")
112
110
  text = "http://100.83.199.62:8088/superset/dashboard/p/xOgE56dLNaY/"
113
111
 
114
112
  table.add_row(display_name, q_name, language, text)
@@ -118,10 +116,9 @@ def display_glossaries(
118
116
  force_terminal=not jupyter,
119
117
  )
120
118
  console.print(table)
121
- print("Visit my [link=https://www.willmcgugan.com]blog[/link]!")
122
119
 
123
- except (InvalidParameterException, PropertyServerException) as e:
124
- print_exception_response(e)
120
+ except (PyegeriaAPIException, PyegeriaClientException) as e:
121
+ print_basic_exception(e)
125
122
  finally:
126
123
  m_client.close_session()
127
124
 
@@ -3,293 +3,60 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
5
5
 
6
- Display the status of cataloged platforms and servers.
6
+ Display Asset Graph Information using generic functions.
7
7
  """
8
+ from __future__ import annotations
8
9
  import argparse
9
10
  import os
10
- import sys
11
11
 
12
- from rich import print
13
12
  from rich.console import Console
14
- from rich.markdown import Markdown
15
- from rich.panel import Panel
16
13
  from rich.prompt import Prompt
17
- from rich.tree import Tree
18
14
 
15
+ from commands.cat.run_report import list_generic
16
+ from pyegeria.core.config import settings
19
17
  from pyegeria import (
20
- AssetCatalog,
21
- InvalidParameterException,
22
- PropertyServerException,
23
- UserNotAuthorizedException,
18
+ PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table, PyegeriaException
24
19
  )
25
20
 
26
- EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
27
- EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
28
- EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
29
- EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
30
- EGERIA_VIEW_SERVER_URL = os.environ.get(
31
- "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
32
- )
33
- EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
34
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
35
- "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
36
- )
37
- EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
38
- EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
39
21
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
40
22
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
41
- EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
42
- EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
43
23
 
44
- disable_ssl_warnings = True
24
+
25
+ app_config = settings.Environment
45
26
 
46
27
  guid_list = []
47
28
 
48
- console = Console(width=EGERIA_WIDTH, force_terminal=(not EGERIA_JUPYTER))
29
+ console = Console(width=app_config.console_width, force_terminal=(not app_config.egeria_jupyter))
49
30
 
50
31
 
51
32
  def asset_viewer(
52
- asset_guid: str,
53
- server_name: str,
54
- platform_url: str,
55
- user: str,
56
- user_pass: str,
57
- jupyter: bool = EGERIA_JUPYTER,
58
- width: int = EGERIA_WIDTH,
33
+ output_format: str = "TABLE",
34
+ asset_guid: str = None,
35
+ view_server: str = app_config.egeria_view_server,
36
+ view_url: str = app_config.egeria_view_server_url,
37
+ user: str = EGERIA_USER,
38
+ user_pass: str = EGERIA_USER_PASSWORD,
39
+ jupyter: bool = app_config.egeria_jupyter,
40
+ width: int = app_config.console_width,
41
+ prompt_missing: bool = False,
42
+ write_file: bool = False,
43
+ render_table: bool = False,
44
+ table_caption: str | None = None,
45
+ use_pager: bool = True,
59
46
  ):
60
- def build_classifications(classification: dict) -> Markdown:
61
- class_md = ""
62
- for c in classification:
63
- c_type = c["classificationName"]
64
- if c_type == "Anchors":
65
- continue
66
- class_md += f"\n* Classification: {c_type}\n"
67
- class_props = c.get("classificationProperties", "---")
68
- if type(class_props) is dict:
69
- for prop in class_props.keys():
70
- class_md += f"\t* {prop}: {class_props[prop]}\n"
71
- if class_md == "":
72
- output = None
73
- else:
74
- output = class_md
75
- return output
76
-
77
- def build_nested_elements(nested_element: dict) -> Markdown:
78
- ne_md = " "
79
- ne_header = nested_element["elementHeader"]
80
- ne_created_by = ne_header["versions"]["createdBy"]
81
- ne_created_at = ne_header["versions"]["createTime"]
82
- ne_guid = ne_header["guid"]
83
- guid_list.append(ne_guid)
84
-
85
- ne_type = ne_header["type"]["typeName"]
86
- ne_classifications = ne_header["classifications"]
87
- ne_class_md = build_classifications(ne_classifications)
88
- # ne_class_md = " " if ne_class_md is None else ne_class_md
89
- ne_props = nested_element.get("properties", "---")
90
- ne_prop_md = "\n"
91
- if type(ne_props) is dict:
92
- for prop in ne_props.keys():
93
- ne_prop_md += f"\t* {prop}: {ne_props[prop]}\n"
94
- ne_md = (
95
- f"Nested Element of Type: {ne_type} with GUID: {ne_guid} \n "
96
- f"* created by {ne_created_by} at time {ne_created_at}\n"
97
- f"\n* Properties:\n{ne_prop_md}\n"
98
- )
99
-
100
- if ne_class_md is not None:
101
- ne_md += f"* {ne_class_md}"
102
-
103
- output = Markdown(ne_md)
104
- return output
105
-
106
47
  try:
107
- a_client = AssetCatalog(server_name, platform_url, user_id=user)
108
-
109
- token = a_client.create_egeria_bearer_token(user, user_pass)
110
- # asset_info = a_client.find_assets_in_domain(asset_name)
111
- # if type(asset_info) is str:
112
- # print("\n No Assets Found - Exiting\n")
113
- # sys.exit(1)
114
- #
115
- # asset_guid = asset_info[0]['guid']
116
-
117
- guid_list.append(asset_guid)
118
-
119
- asset_graph = a_client.get_asset_graph(asset_guid)
120
- if type(asset_graph) is not dict:
121
- print(f"\n No Asset found for {asset_guid}")
122
- sys.exit(1)
123
-
124
- # print(f"\n{json.dumps(asset_graph, indent =2)}\n")
125
-
126
- asset_display_name = asset_graph["properties"].get("displayName", "---")
127
- asset_display_description = asset_graph["properties"].get(
128
- "displayDescription", "---"
129
- )
130
- asset_name = asset_graph["properties"].get("name", "---")
131
- asset_resource_name = asset_graph["properties"].get("resourceName", "---")
132
- asset_resource_description = asset_graph["properties"].get(
133
- "resourceDescription", "---"
134
- )
135
- qualified_name = asset_graph["properties"].get("qualifiedName", "---")
136
-
137
- tree = Tree(
138
- f"{asset_name} ({asset_guid})",
139
- style="bold bright_white on black",
140
- guide_style="bold bright_blue",
141
- )
142
- style = ""
143
- asset_elements = asset_graph["elementHeader"]
144
- asset_type = asset_elements["type"]["typeName"]
145
- asset_deployed_imp_type = asset_graph["properties"].get(
146
- "deployedImplementationType", "---"
147
- )
148
-
149
- asset_origin = asset_elements["origin"]["homeMetadataCollectionName"]
150
- asset_creation = asset_elements["versions"]["createTime"]
151
- asset_created_by = asset_elements["versions"]["createdBy"]
152
- asset_classifications = asset_elements["classifications"]
153
- asset_nested_elements = asset_graph.get("anchoredElements", "----")
154
- asset_relationships = asset_graph["relationships"]
155
- asset_class_md = build_classifications(asset_classifications)
48
+ list_generic(report_spec="Asset-Graph", output_format=output_format, view_server=view_server,
49
+ view_url=view_url, user=user, user_pass=user_pass, params={"asset_guid": asset_guid},
50
+ render_table=render_table, write_file = write_file, table_caption=table_caption, use_pager=use_pager,
51
+ width=width, jupyter=jupyter, prompt_missing=prompt_missing)
156
52
 
157
- additional_properties = asset_graph["properties"].get(
158
- "additionalProperties", None
159
- )
160
- if additional_properties is not None:
161
- add_prop_md = "\n* Additional Properties:\n"
162
- for prop in additional_properties:
163
- add_prop_md = (
164
- f"{add_prop_md}\n\t* {prop}: {additional_properties[prop]}\n"
165
- )
166
- else:
167
- add_prop_md = ""
53
+ except PyegeriaAPIException as e:
54
+ if e.response_egeria_msg_id == "OMAG-REPOSITORY-HANDLER-404-001":
55
+ print(e.response_egeria_msg)
56
+ return
168
57
 
169
- extended_properties = asset_graph["properties"].get("extendedProperties", None)
170
- if extended_properties is not None:
171
- prop_md = "\n* Extended Properties:\n"
172
- for prop in extended_properties:
173
- prop_md = f"{prop_md}\n\t* {prop}: {extended_properties[prop]}\n"
174
- else:
175
- prop_md = ""
176
- core_md = (
177
- f"**Type: {asset_type} Created by: {asset_created_by} on {asset_creation}**\n"
178
- f"* Deployed Implementation Type: {asset_deployed_imp_type}\n"
179
- f"* Name: {asset_name}\n "
180
- f"* Asset Resource Name: {asset_resource_name}\n"
181
- f"* Asset Resource Description: {asset_resource_description}\n "
182
- f"* Asset Display Name: {asset_display_name}\n"
183
- f"* Asset Display Description: {asset_display_description}\n "
184
- f"* Qualified Name: {qualified_name}\n "
185
- f"* Asset Origin: {asset_origin}\n"
186
- f" {prop_md}\n"
187
- f" {add_prop_md}\n"
188
- )
189
- core_md = Markdown(core_md)
190
-
191
- p1 = Panel.fit(core_md, style="bold bright_white")
192
- l2 = tree.add(p1)
193
- if asset_class_md is not None:
194
- p2 = Panel.fit(
195
- Markdown(asset_class_md),
196
- style="bold bright_white",
197
- title="Classifications",
198
- )
199
- l2 = tree.add(p2)
200
-
201
- #
202
- # Nested Assets
203
- #
204
- if type(asset_nested_elements) is list:
205
- l2 = tree.add("Nested Elements", style="bold white")
206
- for el in asset_nested_elements:
207
- asset_ne_md = build_nested_elements(el)
208
- p3 = Panel.fit(
209
- asset_ne_md, style="bold bright_white", title="Nested Elements"
210
- )
211
- l2.add(p3)
212
-
213
- #
214
- # Now work on the Relationships
215
- #
216
- for relationship in asset_relationships:
217
- # Find the end guids - if one isn't in our list then display
218
- rel_end1 = relationship["end1"]
219
- rel_end1_type = rel_end1["type"]["typeName"]
220
- rel_end1_guid = rel_end1["guid"]
221
- rel_end1_unique_name = rel_end1.get("uniqueName", "---")
222
-
223
- rel_end2 = relationship["end2"]
224
- rel_end2_type = rel_end2["type"]["typeName"]
225
- rel_end2_guid = rel_end2["guid"]
226
- rel_end2_unique_name = rel_end2.get("uniqueName", "---")
227
-
228
- if (rel_end1_guid not in guid_list) or (rel_end2_guid not in guid_list):
229
- # rel_end1_class_md = build_classifications(rel_end1["classifications"])
230
- # rel_end2_class_md = build_classifications(rel_end2["classifications"])
231
-
232
- relationship_guid = relationship["guid"]
233
- relationship_type = relationship["type"]["typeName"]
234
- relationship_created_by = relationship["versions"]["createdBy"]
235
- relationship_creation_time = relationship["versions"]["createTime"]
236
- relationship_properties = relationship.get("properties", "--- ")
237
- relationship_md = (
238
- f"Relationship Type {relationship_type}\n"
239
- f"* GUID: {relationship_guid}\n* Created by: {relationship_created_by} \n"
240
- f"* Creation Time: {relationship_creation_time}\n"
241
- f"* Properties: {relationship_properties}\n"
242
- )
243
-
244
- rel_md = (
245
- f"* Relationship Type: {relationship_type}\n"
246
- f"* Relationship GUID: {relationship_guid}\n"
247
- f"* Created by: {relationship_created_by} at time {relationship_creation_time}\n"
248
- )
249
- rel_end1_md = (
250
- f"* End1:\n"
251
- f"\t* Type: {rel_end1_type}\n"
252
- f"\t* GUID: {rel_end1_guid}\n"
253
- f"\t* Unique Name: {rel_end1_unique_name}\n"
254
- )
255
-
256
- # if rel_end1_class_md is not None:
257
- # rel_end1_md = rel_end1_class_md + rel_end1_md
258
-
259
- rel_end2_md = (
260
- f"* End2:\n"
261
- f"\t* Type: {rel_end2_type}\n"
262
- f"\t* GUID: {rel_end2_guid}\n"
263
- f"\t* Unique Name: {rel_end2_unique_name}\n"
264
- )
265
-
266
- # if rel_end2_class_md is not None:
267
- # rel_end1_md = rel_end2_class_md + rel_end1_md
268
- #
269
- # for prop in relationship_properties.keys():
270
- # relationship_md += f"* {prop}: {relationship_properties[prop]}\n"
271
-
272
- relationship_md += rel_end1_md + rel_end2_md
273
-
274
- relationship_panel = Panel.fit(
275
- Markdown(relationship_md),
276
- style="bold bright_white",
277
- title="Asset Relationships",
278
- )
279
- tree.add(relationship_panel)
280
- with console.screen():
281
- print("\n\n")
282
- print(tree)
283
-
284
- except (
285
- InvalidParameterException,
286
- PropertyServerException,
287
- UserNotAuthorizedException,
288
- ) as e:
289
- console.print_exception()
290
- console.print(
291
- "\n\n ======> Most likely the GUID you provided is either incorrect or not an asset\n[red bold]"
292
- )
58
+ except (PyegeriaException, PyegeriaClientException) as e:
59
+ print_basic_exception(e)
293
60
 
294
61
 
295
62
  def main():
@@ -301,13 +68,16 @@ def main():
301
68
  parser.add_argument("--password", help="User Password")
302
69
  args = parser.parse_args()
303
70
 
304
- server = args.server if args.server is not None else EGERIA_VIEW_SERVER
305
- url = args.url if args.url is not None else EGERIA_PLATFORM_URL
71
+ server = args.server if args.server is not None else app_config.egeria_view_server
72
+ url = args.url if args.url is not None else app_config.egeria_view_server_url
306
73
  userid = args.userid if args.userid is not None else EGERIA_USER
307
74
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
308
75
  try:
309
76
  asset_guid = Prompt.ask("Enter the Asset GUID to view:", default="")
310
- asset_viewer(asset_guid, server, url, userid, user_pass)
77
+ output_format = Prompt.ask("Enter the output format:", default="TABLE")
78
+ asset_viewer(output_format, asset_guid, server, url, userid,
79
+ user_pass, prompt_missing=True, write_file=True, render_table=True,
80
+ table_caption="Asset Graph")
311
81
  except KeyboardInterrupt as e:
312
82
  # console.print_exception()
313
83
  pass