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.
Files changed (109) hide show
  1. commands/cat/debug_log +2802 -2
  2. commands/cat/debug_log.2025-07-15_14-28-38_087378.zip +0 -0
  3. commands/cat/debug_log.2025-07-16_15-48-50_037087.zip +0 -0
  4. commands/cat/dr_egeria_md.py +30 -6
  5. md_processing/__init__.py +16 -3
  6. md_processing/data/commands.json +18541 -171
  7. md_processing/dr_egeria_outbox-pycharm/.obsidian/app.json +1 -0
  8. md_processing/dr_egeria_outbox-pycharm/.obsidian/appearance.json +1 -0
  9. md_processing/dr_egeria_outbox-pycharm/.obsidian/core-plugins.json +31 -0
  10. md_processing/dr_egeria_outbox-pycharm/.obsidian/workspace.json +177 -0
  11. md_processing/dr_egeria_outbox-pycharm/monday/processed-2025-07-14 12:38-data_designer_out.md +663 -0
  12. md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 15:00-Derive-Dr-Gov-Defs.md +719 -0
  13. md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:13-Derive-Dr-Gov-Defs.md +41 -0
  14. md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:14-Derive-Dr-Gov-Defs.md +33 -0
  15. md_processing/dr_egeria_outbox-pycharm/thursday/processed-2025-07-17 20:50-Derive-Dr-Gov-Defs.md +192 -0
  16. md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-16 19:15-gov_def2.md +527 -0
  17. md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-17 12:08-gov_def2.md +527 -0
  18. md_processing/dr_egeria_outbox-pycharm/tuesday/processed-2025-07-17 14:27-gov_def2.md +474 -0
  19. md_processing/family_docs/Data Designer/Create_Data_Class.md +164 -0
  20. md_processing/family_docs/Data Designer/Create_Data_Dictionary.md +30 -0
  21. md_processing/family_docs/Data Designer/Create_Data_Field.md +162 -0
  22. md_processing/family_docs/Data Designer/Create_Data_Specification.md +36 -0
  23. md_processing/family_docs/Data Designer/Create_Data_Structure.md +38 -0
  24. md_processing/family_docs/Data Designer/View_Data_Classes.md +78 -0
  25. md_processing/family_docs/Data Designer/View_Data_Dictionaries.md +78 -0
  26. md_processing/family_docs/Data Designer/View_Data_Fields.md +78 -0
  27. md_processing/family_docs/Data Designer/View_Data_Specifications.md +78 -0
  28. md_processing/family_docs/Data Designer/View_Data_Structures.md +78 -0
  29. md_processing/family_docs/Data Designer.md +842 -0
  30. md_processing/family_docs/Digital Product Manager/Add_Member->Collection.md +42 -0
  31. md_processing/family_docs/Digital Product Manager/Attach_Collection->Resource.md +36 -0
  32. md_processing/family_docs/Digital Product Manager/Create_Agreement.md +96 -0
  33. md_processing/family_docs/Digital Product Manager/Create_Data_Sharing_Agreement.md +72 -0
  34. md_processing/family_docs/Digital Product Manager/Create_DigitalSubscription.md +102 -0
  35. md_processing/family_docs/Digital Product Manager/Create_Digital_Product.md +134 -0
  36. md_processing/family_docs/Digital Product Manager/Link_Agreement_Items.md +60 -0
  37. md_processing/family_docs/Digital Product Manager/Link_Contracts.md +26 -0
  38. md_processing/family_docs/Digital Product Manager/Link_Digital_Product_-_Digital_Product.md +30 -0
  39. md_processing/family_docs/Digital Product Manager/Link_Subscribers.md +48 -0
  40. md_processing/family_docs/Digital Product Manager.md +668 -0
  41. md_processing/family_docs/Glossary/Attach_Category_Parent.md +18 -0
  42. md_processing/family_docs/Glossary/Attach_Term-Term_Relationship.md +26 -0
  43. md_processing/family_docs/Glossary/Create_Category.md +38 -0
  44. md_processing/family_docs/Glossary/Create_Glossary.md +42 -0
  45. md_processing/family_docs/Glossary/Create_Term.md +70 -0
  46. md_processing/family_docs/Glossary.md +206 -0
  47. md_processing/family_docs/Governance Officer/Create_Business_Imperative.md +106 -0
  48. md_processing/family_docs/Governance Officer/Create_Certification_Type.md +112 -0
  49. md_processing/family_docs/Governance Officer/Create_Governance_Approach.md +114 -0
  50. md_processing/family_docs/Governance Officer/Create_Governance_Obligation.md +114 -0
  51. md_processing/family_docs/Governance Officer/Create_Governance_Principle.md +114 -0
  52. md_processing/family_docs/Governance Officer/Create_Governance_Procedure.md +128 -0
  53. md_processing/family_docs/Governance Officer/Create_Governance_Process.md +122 -0
  54. md_processing/family_docs/Governance Officer/Create_Governance_Processing_Purpose.md +106 -0
  55. md_processing/family_docs/Governance Officer/Create_Governance_Responsibility.md +122 -0
  56. md_processing/family_docs/Governance Officer/Create_Governance_Rule.md +122 -0
  57. md_processing/family_docs/Governance Officer/Create_Governance_Strategy.md +106 -0
  58. md_processing/family_docs/Governance Officer/Create_License_Type.md +112 -0
  59. md_processing/family_docs/Governance Officer/Create_Naming_Standard_Rule.md +122 -0
  60. md_processing/family_docs/Governance Officer/Create_Regulation_Article.md +106 -0
  61. md_processing/family_docs/Governance Officer/Create_Regulation_Definition.md +118 -0
  62. md_processing/family_docs/Governance Officer/Create_Security_Access_Control.md +114 -0
  63. md_processing/family_docs/Governance Officer/Create_Security_Group.md +120 -0
  64. md_processing/family_docs/Governance Officer/Create_Service_Level_Objectives.md +122 -0
  65. md_processing/family_docs/Governance Officer/Create_Threat_Definition.md +106 -0
  66. md_processing/family_docs/Governance Officer/Link_Governance_Controls.md +32 -0
  67. md_processing/family_docs/Governance Officer/Link_Governance_Drivers.md +32 -0
  68. md_processing/family_docs/Governance Officer/Link_Governance_Policies.md +32 -0
  69. md_processing/family_docs/Governance Officer/View_Governance_Definitions.md +82 -0
  70. md_processing/family_docs/Governance Officer.md +2412 -0
  71. md_processing/family_docs/Solution Architect/Create_Information_Supply_Chain.md +70 -0
  72. md_processing/family_docs/Solution Architect/Create_Solution_Blueprint.md +44 -0
  73. md_processing/family_docs/Solution Architect/Create_Solution_Component.md +96 -0
  74. md_processing/family_docs/Solution Architect/Create_Solution_Role.md +66 -0
  75. md_processing/family_docs/Solution Architect/Link_Information_Supply_Chain_Peers.md +32 -0
  76. md_processing/family_docs/Solution Architect/Link_Solution_Component_Peers.md +32 -0
  77. md_processing/family_docs/Solution Architect/View_Information_Supply_Chains.md +32 -0
  78. md_processing/family_docs/Solution Architect/View_Solution_Blueprints.md +32 -0
  79. md_processing/family_docs/Solution Architect/View_Solution_Components.md +32 -0
  80. md_processing/family_docs/Solution Architect/View_Solution_Roles.md +32 -0
  81. md_processing/family_docs/Solution Architect.md +490 -0
  82. md_processing/md_commands/data_designer_commands.py +9 -10
  83. md_processing/md_commands/glossary_commands.py +16 -2
  84. md_processing/md_commands/governance_officer_commands.py +420 -0
  85. md_processing/md_commands/product_manager_commands.py +186 -752
  86. md_processing/md_commands/project_commands.py +5 -2
  87. md_processing/md_commands/solution_architect_commands.py +9 -8
  88. md_processing/md_processing_utils/common_md_proc_utils.py +15 -10
  89. md_processing/md_processing_utils/common_md_utils.py +194 -2
  90. md_processing/md_processing_utils/debug_log +574 -0
  91. md_processing/md_processing_utils/dr-egeria-help-2025-07-17T17:22:09.md +2065 -0
  92. md_processing/md_processing_utils/extraction_utils.py +1 -1
  93. md_processing/md_processing_utils/generate_dr_help.py +20 -5
  94. md_processing/md_processing_utils/generate_md_cmd_templates.py +143 -0
  95. md_processing/md_processing_utils/md_processing_constants.py +56 -4
  96. pyegeria/governance_officer_omvs.py +14 -99
  97. pyegeria/output_formatter.py +3 -2
  98. pyegeria/utils.py +7 -0
  99. {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/METADATA +1 -1
  100. {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/RECORD +103 -29
  101. commands/cat/debug_log.2025-07-01_15-22-20_102237.zip +0 -0
  102. commands/cat/debug_log.2025-07-04_15-43-28_460900.zip +0 -0
  103. commands/cat/debug_log.2025-07-06_20-48-04_338314.zip +0 -0
  104. commands/cat/debug_log.2025-07-09_10-17-09_526262.zip +0 -0
  105. commands/cat/debug_log.2025-07-10_10-25-47_958331.zip +0 -0
  106. pyegeria/m_test.py +0 -118
  107. {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/LICENSE +0 -0
  108. {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/WHEEL +0 -0
  109. {pyegeria-5.4.0.dev13.dist-info → pyegeria-5.4.0.dev14.dist-info}/entry_points.txt +0 -0
@@ -4,12 +4,13 @@ This file contains project-related object_action functions for processing Egeria
4
4
 
5
5
  from rich.markdown import Markdown
6
6
 
7
- from md_processing.md_processing_utils.common_md_utils import (debug_level, print_msg, is_valid_iso_date)
7
+ from md_processing.md_processing_utils.common_md_utils import (debug_level, print_msg, is_valid_iso_date, setup_log)
8
8
  from md_processing.md_processing_utils.extraction_utils import (extract_command, process_simple_attribute)
9
9
  from md_processing.md_processing_utils.md_processing_constants import ALWAYS, ERROR, INFO, pre_command
10
10
  from pyegeria._globals import NO_PROJECTS_FOUND
11
11
  from pyegeria.project_manager_omvs import ProjectManager
12
12
 
13
+ setup_log()
13
14
 
14
15
  def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, directive: str = "display") -> str | None:
15
16
  """
@@ -24,6 +25,8 @@ def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, dir
24
25
  from md_processing.md_processing_utils.common_md_utils import set_debug_level
25
26
 
26
27
  command = extract_command(txt)
28
+ print(Markdown(f"# {command}\n"))
29
+
27
30
  object = command.split()
28
31
  object_type = f"{object[1]} {object[2]}"
29
32
  object_action = object[0]
@@ -32,7 +35,7 @@ def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, dir
32
35
  project_name = process_simple_attribute(txt, ['Project Name'])
33
36
  description = process_simple_attribute(txt, ['Description'])
34
37
  project_identifier = process_simple_attribute(txt, ['Project Identifier'])
35
- project_status = process_simple_attribute(txt, ['Project Status'])
38
+ project_status = process_simple_attribute(txt, ['Status'])
36
39
  project_phase = process_simple_attribute(txt, ['Project Phase'])
37
40
  project_health = process_simple_attribute(txt, ['Project Health'])
38
41
  start_date = process_simple_attribute(txt, ['Start Date'])
@@ -12,7 +12,7 @@ from rich.console import Console
12
12
  from rich.markdown import Markdown
13
13
 
14
14
  from md_processing.md_processing_utils.common_md_proc_utils import (parse_upsert_command, parse_view_command)
15
- from md_processing.md_processing_utils.common_md_utils import update_element_dictionary
15
+ from md_processing.md_processing_utils.common_md_utils import update_element_dictionary, setup_log
16
16
  from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
17
17
  from md_processing.md_processing_utils.md_processing_constants import (load_commands)
18
18
  from pyegeria import body_slimmer, EgeriaTech
@@ -20,12 +20,8 @@ from pyegeria import body_slimmer, EgeriaTech
20
20
  load_commands('commands.json')
21
21
 
22
22
  console = Console(width=int(200))
23
+ setup_log()
23
24
 
24
- log_format = "D {time} | {level} | {function} | {line} | {message} | {extra}"
25
- logger.remove()
26
- logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
27
- logger.add("solution_architect_log.log", rotation="1 day", retention="1 week", compression="zip", level="TRACE",
28
- format=log_format, colorize=True)
29
25
 
30
26
  @logger.catch
31
27
  def sync_chain_related_elements(egeria_client: EgeriaTech, guid:str, in_supply_chain_guids:list, display_name:str,
@@ -264,7 +260,7 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, txt: str, direct
264
260
  :return: A string summarizing the outcome of the processing.
265
261
  """
266
262
  command, object_type, object_action = extract_command_plus(txt)
267
-
263
+ print(Markdown(f"# {command}\n"))
268
264
  parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
269
265
 
270
266
  valid = parsed_output['valid']
@@ -432,6 +428,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
432
428
  :return: A string summarizing the outcome of the processing.
433
429
  """
434
430
  command, object_type, object_action = extract_command_plus(txt)
431
+ print(Markdown(f"# {command}\n"))
435
432
 
436
433
  parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
437
434
 
@@ -452,7 +449,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
452
449
  version_identifier = attributes.get('Version Identifier', {}).get('value', None)
453
450
  solution_component_type = attributes.get('Solution Component Type', {}).get('value', None)
454
451
  planned_deployed_impl_type = attributes.get('Planned Deployed Implementation Type', {}).get('value', None)
455
- initial_status = attributes.get('Initial Status', {}).get('value', None)
452
+ initial_status = attributes.get('Status', {}).get('value', None)
456
453
  user_defined_status = attributes.get('User Defined Status', {}).get('value', None)
457
454
  if initial_status != "OTHER":
458
455
  user_defined_status = None
@@ -656,6 +653,7 @@ def process_component_link_unlink_command(egeria_client: EgeriaTech, txt: str,
656
653
  :return: A string summarizing the outcome of the processing.
657
654
  """
658
655
  command, object_type, object_action = extract_command_plus(txt)
656
+ print(Markdown(f"# {command}\n"))
659
657
 
660
658
  parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
661
659
 
@@ -782,6 +780,7 @@ def process_information_supply_chain_upsert_command(egeria_client: EgeriaTech, t
782
780
  :return: A string summarizing the outcome of the processing.
783
781
  """
784
782
  command, object_type, object_action = extract_command_plus(txt)
783
+ print(Markdown(f"# {command}\n"))
785
784
 
786
785
  parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
787
786
 
@@ -956,6 +955,7 @@ def process_information_supply_chain_link_unlink_command(egeria_client: EgeriaTe
956
955
  :return: A string summarizing the outcome of the processing.
957
956
  """
958
957
  command, object_type, object_action = extract_command_plus(txt)
958
+ print(Markdown(f"# {command}\n"))
959
959
 
960
960
  parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
961
961
 
@@ -1078,6 +1078,7 @@ def process_sol_arch_list_command(egeria_client: EgeriaTech, txt: str, kind:str,
1078
1078
  :return: A string summarizing the outcome of the processing.
1079
1079
  """
1080
1080
  command, object_type, object_action = extract_command_plus(txt)
1081
+ print(Markdown(f"# {command}\n"))
1081
1082
 
1082
1083
  parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
1083
1084
 
@@ -163,7 +163,7 @@ def parse_upsert_command(egeria_client: EgeriaTech, object_type: str, object_act
163
163
  elif style == 'Ordered Int':
164
164
  parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing)
165
165
  elif style == 'Simple Int':
166
- parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value)
166
+ parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value, "int")
167
167
  elif style == 'Simple List':
168
168
  parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value)
169
169
  name_list = parsed_attributes[key]['value']
@@ -187,7 +187,7 @@ def parse_upsert_command(egeria_client: EgeriaTech, object_type: str, object_act
187
187
  parsed_output['valid'] = False
188
188
  parsed_output['reason'] += msg
189
189
  else:
190
- msg = f"Unknown attribute style: {style}"
190
+ msg = f"Unknown attribute style: {style} for key `{key}`"
191
191
  logger.error(msg)
192
192
  sys.exit(1)
193
193
  parsed_attributes[key]['valid'] = False
@@ -264,7 +264,7 @@ def parse_view_command(egeria_client: EgeriaTech, object_type: str, object_actio
264
264
  parsed_output['exists'] = False
265
265
 
266
266
  labels = {}
267
- if object_action == "Unlink":
267
+ if object_action in ["Unlink","Detach"]:
268
268
  command_spec = get_command_spec(f"Link {object_type}")
269
269
  else:
270
270
  command_spec = get_command_spec(f"{object_action} {object_type}")
@@ -362,7 +362,7 @@ def parse_view_command(egeria_client: EgeriaTech, object_type: str, object_actio
362
362
  elif style == 'Ordered Int':
363
363
  parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing)
364
364
  elif style == 'Simple Int':
365
- parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value)
365
+ parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value, "int")
366
366
  elif style == 'Simple List':
367
367
  parsed_attributes[key] = proc_simple_attribute(txt, object_action, labels, if_missing, default_value)
368
368
  name_list = parsed_attributes[key]['value']
@@ -410,7 +410,8 @@ def parse_view_command(egeria_client: EgeriaTech, object_type: str, object_actio
410
410
 
411
411
 
412
412
  @logger.catch
413
- def proc_simple_attribute(txt: str, action: str, labels: set, if_missing: str = INFO, default_value=None) -> dict:
413
+ def proc_simple_attribute(txt: str, action: str, labels: set, if_missing: str = INFO, default_value=None,
414
+ simp_type: str = None) -> dict:
414
415
  """Process a simple attribute based on the provided labels and if_missing value.
415
416
  Extract the attribute value from the text and store it in a dictionary along with valid.
416
417
  If it doesn`t exist, mark the dictionary entry as invalid and print an error message with severity of if_missing.
@@ -433,14 +434,14 @@ def proc_simple_attribute(txt: str, action: str, labels: set, if_missing: str =
433
434
  logger.error(msg)
434
435
  return {"status": ERROR, "reason": msg, "value": None, "valid": False}
435
436
 
436
- attribute = extract_attribute(txt, labels)
437
-
438
437
  if default_value == "":
439
438
  default_value = None
440
- attribute = default_value if attribute is None else attribute.replace('\n','')
441
439
 
442
- if attribute is None:
440
+ attribute = extract_attribute(txt, labels)
441
+
442
+ attribute = default_value if attribute is None else attribute.replace('\n', '')
443
443
 
444
+ if attribute is None:
444
445
  if if_missing == INFO or if_missing == WARNING:
445
446
  msg = f"Optional attribute with labels: `{labels}` missing"
446
447
  valid = True
@@ -450,6 +451,10 @@ def proc_simple_attribute(txt: str, action: str, labels: set, if_missing: str =
450
451
  valid = False
451
452
  logger.error(msg)
452
453
  return {"status": if_missing, "reason": msg, "value": None, "valid": valid, "exists": False}
454
+
455
+ if attribute and simp_type == "int" :
456
+ attribute = int(attribute)
457
+
453
458
  return {"status": INFO, "OK": None, "value": attribute, "valid": valid, "exists": True}
454
459
 
455
460
 
@@ -637,7 +642,7 @@ def proc_el_id(egeria_client: EgeriaTech, element_type: str, qn_prefix: str, ele
637
642
  logger.error(msg)
638
643
  identifier_output = {"status": ERROR, "reason": msg, "value": element_name, "valid": False, "exists": False, }
639
644
 
640
- elif action == "Update" and exists:
645
+ elif action in ["Update", "View"] and exists:
641
646
  msg = f"Element {element_name} exists"
642
647
  logger.info(msg)
643
648
  identifier_output = {
@@ -3,23 +3,60 @@ This file contains general utility functions for processing Egeria Markdown
3
3
  """
4
4
  import os
5
5
  import re
6
+ import sys
7
+ import json
6
8
  from datetime import datetime
7
9
  from typing import Any
8
10
  from loguru import logger
9
11
  from rich import print
10
12
  from rich.console import Console
11
13
  from rich.markdown import Markdown
12
-
14
+ from pyegeria.utils import (camel_to_title_case)
13
15
  from pyegeria._globals import DEBUG_LEVEL
14
16
  from md_processing.md_processing_utils.message_constants import message_types
15
17
 
16
18
  # Constants
17
- EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
19
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
20
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
21
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
22
+ EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
23
+ EGERIA_VIEW_SERVER_URL = os.environ.get("EGERIA_VIEW_SERVER_URL", "https://localhost:9443")
24
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
25
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get("EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443")
26
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
27
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
28
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
29
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
30
+ EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
31
+ EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
32
+ EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
33
+ EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
34
+ EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../../")
35
+ EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "md_processing/dr_egeria_inbox")
36
+ EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_egeria_outbox")
37
+ LOG_FORMAT = "D <green> {time} </green> | {level} | {function} | {line} | {message} | {extra}"
38
+ CONSOLE_LOG_FORMAT = "<green>{time}</green> | {message}"
39
+
18
40
  console = Console(width=EGERIA_WIDTH)
41
+ GENERAL_GOVERNANCE_DEFINITIONS = ["Business Imperative", "Regulation Article", "Threat", "Governance Principle",
42
+ "Governance Obligation", "Governance Approach", "Governance Processing Purpose"]
43
+
44
+ GOVERNANCE_CONTROLS = ["Governance Rule", "Service Level Objective", "Governance Process",
45
+ "Governance Responsibility", "Governance Procedure", "Security Access Control"]
19
46
 
20
47
  debug_level = DEBUG_LEVEL
21
48
  global COMMAND_DEFINITIONS
22
49
 
50
+ def setup_log():
51
+ logger.remove()
52
+ logger.add(sys.stderr, level="SUCCESS", format=CONSOLE_LOG_FORMAT, colorize=True)
53
+ full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, "data_designer_debug.log")
54
+ # logger.add(full_file_path, rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
55
+ # colorize=True)
56
+ logger.add("debug_log", rotation="1 day", retention="1 week", compression="zip", level="INFO", format=LOG_FORMAT,
57
+ colorize=True)
58
+
59
+
23
60
  def split_tb_string(input: str)-> [Any]:
24
61
  """Split the string and trim the items"""
25
62
  l = [item.strip() for item in re.split(r'[;,\n]+',input)] if input is not None else None
@@ -177,3 +214,158 @@ def find_key_with_value(value: str) -> str | None:
177
214
  return key
178
215
 
179
216
  return None # If value not found
217
+
218
+
219
+ def set_create_body(object_type: str, attributes: dict)->dict:
220
+ prop_name = object_type.replace(" ", "")
221
+ body = {
222
+ "class": "NewGovernanceDefinitionRequestBody",
223
+ "externalSourceGUID": attributes.get('External Source GUID', {}).get('guid', None),
224
+ "externalSourceName": attributes.get('External Source Name', {}).get('value', None),
225
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
226
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
227
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False),
228
+ "anchorGUID": attributes.get('Anchor ID', {}).get('guid', None),
229
+ "isOwnAnchor": attributes.get('Is Own Anchor', {}).get('value', True),
230
+ "parentGUID": attributes.get('Parent ID', {}).get('guid', None),
231
+ "parentRelationshipTypeName": attributes.get('Parent Relationship Type Name', {}).get('value', None),
232
+ "parentRelationshipProperties": attributes.get('Parent Relationship Properties', {}).get('value', None),
233
+ "parentAtEnd1": attributes.get('Parent at End1', {}).get('value', True),
234
+ "properties": "",
235
+ "initialStatus": attributes.get('Status', {}).get('value', "ACTIVE")
236
+ }
237
+
238
+ return body
239
+
240
+
241
+
242
+
243
+ def set_update_body(object_type: str, attributes: dict)->dict:
244
+ return {
245
+ "class" : "UpdateElementRequestBody",
246
+ "externalSourceGUID": attributes.get('External Source GUID', {}).get('guid', None),
247
+ "externalSourceName": attributes.get('External Source Name', {}).get('value', None),
248
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
249
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
250
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False),
251
+ "mergeUpdate": attributes.get('Merge Update', {}).get('value', True),
252
+ "properties": "",
253
+ }
254
+
255
+ def set_prop_body(object_type: str, qualified_name: str, attributes: dict)->dict:
256
+
257
+ prop_name = object_type.replace(" ", "")
258
+
259
+ return {
260
+ "class": prop_name + "Properties",
261
+ "displayName": attributes['Display Name'].get('value', None),
262
+ "qualifiedName" : qualified_name,
263
+ "description": attributes['Description'].get('value', None),
264
+ "versionIdentifier": attributes.get('Version Identifier', {}).get('value', None),
265
+ "effectiveFrom": attributes.get('Effective From', {}).get('value', None),
266
+ "effectiveTo": attributes.get('Effective To', {}).get('value', None),
267
+ "additionalProperties": attributes.get('Additional Properties', {}).get('value', None),
268
+ "extendedProperties": attributes.get('Extended Properties', {}).get('value', None)
269
+ }
270
+
271
+ def set_gov_prop_body(object_type: str, qualified_name: str, attributes: dict)->dict:
272
+ prop_name = object_type.replace(" ", "")
273
+ prop_bod = set_prop_body(object_type, qualified_name, attributes)
274
+ prop_bod["domainIdentifier"] = attributes.get('Domain Identifier', {}).get('value', None)
275
+ # prop_bod["documentIdentifier"] = attributes.get('Document Identifier', {}).get('value', None)
276
+ prop_bod["title"]= attributes.get('Display Name', {}).get('value', None)
277
+ prop_bod['documentIdentifier'] = qualified_name
278
+ prop_bod["versionIdentifier"] = attributes.get('Version Identifier', {}).get('value', None)
279
+ prop_bod["summary"] = attributes.get('Summary', {}).get('value', None)
280
+ prop_bod["scope"] = attributes.get('Scope', {}).get('value', None)
281
+ prop_bod["importance"] = attributes.get('Importance', {}).get('value', None)
282
+ prop_bod["implications"] = attributes.get('Implication', {}).get('value', [])
283
+ prop_bod["outcomes"] = attributes.get('Outcomes', {}).get('value', [])
284
+ prop_bod["results"] = attributes.get('Results', {}).get('value', [])
285
+
286
+ body = update_body_for_type(object_type, prop_bod, attributes)
287
+ return body
288
+
289
+
290
+ def update_body_for_type(object_type: str, body: dict, attributes: dict) -> dict:
291
+ gov_def_name = object_type.replace(" ", "")
292
+ if object_type in GENERAL_GOVERNANCE_DEFINITIONS:
293
+ return body
294
+ elif object_type == "Governance Strategy":
295
+ body['businessImperatives'] = attributes.get('Business Imperatives', {}).get('value', [])
296
+ return body
297
+
298
+ elif object_type == "Regulation":
299
+ body['source'] = attributes.get('Source', {}).get('value', None)
300
+ body['regulators'] = attributes.get('Regulators', {}).get('value', [])
301
+ return body
302
+
303
+ elif object_type in GOVERNANCE_CONTROLS:
304
+ body['implementationDescription'] = attributes.get('Implementation Description', {}).get('value', None)
305
+ return body
306
+ elif object_type == "Security Group":
307
+ body['distinguishedName'] = attributes.get('Distinguished Name', {}).get('value', None)
308
+ return body
309
+ elif object_type == "Naming Standard Rule":
310
+ body['namePatterns'] = attributes.get('Name Patterns', {}).get('value', [])
311
+ return body
312
+ elif object_type in ["Certification Type", "License Type"]:
313
+ body['details'] = attributes.get('Details', {}).get('value', None)
314
+ return body
315
+
316
+
317
+ def set_rel_request_body(object_type: str, attributes: dict)->dict:
318
+ return {
319
+ "class" : "RelationshipRequestBody",
320
+ "externalSourceGUID": attributes.get('External Source GUID', {}).get('guid', None),
321
+ "externalSourceName": attributes.get('External Source Name', {}).get('value', None),
322
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
323
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
324
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False),
325
+ "properties": "",
326
+ }
327
+
328
+ def set_peer_gov_def_request_body(object_type: str, attributes: dict)->dict:
329
+ rel_body = set_rel_request_body(object_type, attributes)
330
+ rel_body["properties"] = {
331
+ "class" : "PeerDefinitionProperties",
332
+ "description": attributes.get('Description', {}).get('value', None),
333
+ "effectiveFrom": attributes.get('Effective From', {}).get('value', None),
334
+ "effectiveTo": attributes.get('Effective To', {}).get('value', None),
335
+ "label": attributes.get('Label', {}).get('value', None),
336
+ }
337
+ return rel_body
338
+
339
+ def set_metadata_source_request_body(object_type: str, attributes: dict)->dict:
340
+ return {
341
+ "class": "MetadataSourceRequestBody",
342
+ "externalSourceGUID": attributes.get('External Source GUID', {}).get('guid', None),
343
+ "externalSourceName": attributes.get('External Source Name', {}).get('value', None),
344
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
345
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
346
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False)
347
+ }
348
+
349
+ def set_filter_request_body(object_type: str, attributes: dict)->dict:
350
+ return {
351
+ "class": "FilterRequestBody",
352
+ "asOfTime": attributes.get('AsOfTime', {}).get('value', None),
353
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
354
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
355
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False),
356
+ "limitResultsByStatus": attributes.get('Limit Result by Status', {}).get('value', None),
357
+ "sequencingOrder": attributes.get('Sequencing Order', {}).get('value', None),
358
+ "sequencingProperty": attributes.get('Sequencing Property', {}).get('value', None),
359
+ "filter": attributes.get('Search String', {}).get('value', None),
360
+ }
361
+
362
+ def set_element_status_request_body(object_type: str, attributes: dict)->dict:
363
+ return {
364
+ "class": f"{camel_to_title_case(object_type)}StatusRequestBody",
365
+ "status": attributes.get('Status', {}).get('value', None),
366
+ "externalSourceGUID": attributes.get('External Source GUID', {}).get('guid', None),
367
+ "externalSourceName": attributes.get('External Source Name', {}).get('value', None),
368
+ "effectiveTime": attributes.get('Effective Time', {}).get('value', None),
369
+ "forLineage": attributes.get('For Lineage', {}).get('value', False),
370
+ "forDuplicateProcessing": attributes.get('For Duplicate Processing', {}).get('value', False)
371
+ }