pyegeria 5.4.3.2__py3-none-any.whl → 5.4.3.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commands/cat/debug_log.2025-09-01_07-02-58_818650.log.zip +0 -0
- commands/cat/debug_log.2025-09-02_07-44-39_567276.log.zip +0 -0
- commands/cat/debug_log.2025-09-03_07-45-21_986388.log.zip +0 -0
- commands/cat/debug_log.log +5379 -8107
- commands/cat/list_format_set.py +2 -2
- commands/tech/list_information_supply_chains.py +1 -1
- commands/tech/list_solution_blueprints.py +1 -1
- commands/tech/list_solution_components.py +1 -1
- commands/tech/list_solution_roles.py +1 -1
- md_processing/__init__.py +0 -4
- md_processing/data/commands.json +1258 -615
- md_processing/dr_egeria.py +6 -9
- md_processing/dr_egeria_inbox/data_spec_test.md +44 -418
- md_processing/dr_egeria_inbox/gov_def.md +239 -3
- md_processing/dr_egeria_inbox/product.md +13 -5
- md_processing/dr_egeria_outbox/monday/processed-2025-09-01 14:03-product.md +209 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-01 14:24-product.md +263 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-01 16:03-data_spec_test.md +2374 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-01 16:05-data_spec_test.md +2374 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-02 08:28-data_spec_test.md +2321 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-02 08:37-data_spec_test.md +2304 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-02 08:56-data_spec_test.md +2324 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-02 09:00-data_spec_test.md +2324 -0
- md_processing/md_commands/data_designer_commands.py +170 -570
- md_processing/md_commands/product_manager_commands.py +1 -1
- md_processing/md_processing_utils/common_md_utils.py +55 -13
- md_processing/md_processing_utils/extraction_utils.py +14 -7
- md_processing/md_processing_utils/md_processing_constants.py +1 -1
- pyegeria/___external_references.py +3255 -0
- pyegeria/__init__.py +1 -1
- pyegeria/_client_new.py +9 -7
- pyegeria/_output_formats.py +124 -3
- pyegeria/collection_manager.py +17 -56
- pyegeria/config.py +10 -1
- pyegeria/data_designer.py +172 -124
- pyegeria/egeria_client.py +1 -1
- pyegeria/egeria_tech_client.py +1 -1
- pyegeria/glossary_manager.py +71 -85
- pyegeria/governance_officer.py +26 -29
- pyegeria/output_formatter.py +127 -1
- pyegeria/project_manager.py +33 -36
- pyegeria/{solution_architect_omvs.py → solution_architect.py} +443 -388
- {pyegeria-5.4.3.2.dist-info → pyegeria-5.4.3.4.dist-info}/METADATA +1 -1
- {pyegeria-5.4.3.2.dist-info → pyegeria-5.4.3.4.dist-info}/RECORD +47 -41
- md_processing/dr_egeria_outbox/friday/processed-2025-08-29 16:30-output_tests.md +0 -103
- md_processing/dr_egeria_outbox/friday/processed-2025-08-29 16:40-output_tests.md +0 -115
- md_processing/dr_egeria_outbox/friday/processed-2025-08-30 21:15-glossary_test1.md +0 -326
- md_processing/dr_egeria_outbox/friday/processed-2025-08-31 13:27-glossary_test1.md +0 -369
- md_processing/dr_egeria_outbox/friday/processed-2025-08-31 13:33-glossary_test1.md +0 -392
- md_processing/dr_egeria_outbox/friday/processed-2025-08-31 20:57-glossary_test1.md +0 -400
- {pyegeria-5.4.3.2.dist-info → pyegeria-5.4.3.4.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.3.2.dist-info → pyegeria-5.4.3.4.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.3.2.dist-info → pyegeria-5.4.3.4.dist-info}/entry_points.txt +0 -0
@@ -11,8 +11,22 @@ from rich import print
|
|
11
11
|
from rich.console import Console
|
12
12
|
from rich.markdown import Markdown
|
13
13
|
|
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
|
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 (
|
16
|
+
update_element_dictionary,
|
17
|
+
set_find_body,
|
18
|
+
set_create_body,
|
19
|
+
set_element_prop_body,
|
20
|
+
set_update_body,
|
21
|
+
set_rel_request_body,
|
22
|
+
set_update_status_body,
|
23
|
+
set_rel_prop_body,
|
24
|
+
set_data_field_body,
|
25
|
+
)
|
26
|
+
# Developer note: Request bodies follow a two-layer pattern:
|
27
|
+
# - Outer: action wrapper (NewElementRequestBody/UpdateElementRequestBody/...)
|
28
|
+
# - Inner: element-specific Properties dict placed under the outer["properties"] key
|
29
|
+
# Always build inner bodies via helpers (set_element_prop_body, set_data_field_body, etc.) and assign to the outer
|
16
30
|
from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
|
17
31
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
18
32
|
from pyegeria import DEBUG_LEVEL, body_slimmer
|
@@ -53,7 +67,7 @@ def add_member_to_data_collections(egeria_client: EgeriaTech, collection_list: l
|
|
53
67
|
Add member to data dictionaries and data specifications.
|
54
68
|
"""
|
55
69
|
body = {
|
56
|
-
"class": "
|
70
|
+
"class": "NewRelationshipRequestBody", "properties": {
|
57
71
|
"class": "CollectionMembershipProperties", "membershipRationale": "User Specified",
|
58
72
|
"notes": "Added by Dr.Egeria"
|
59
73
|
}
|
@@ -417,6 +431,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
417
431
|
"""
|
418
432
|
|
419
433
|
command, object_type, object_action = extract_command_plus(txt)
|
434
|
+
print(Markdown(f"# {command}\n"))
|
420
435
|
|
421
436
|
parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
|
422
437
|
|
@@ -426,34 +441,13 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
426
441
|
qualified_name = parsed_output.get('qualified_name', None)
|
427
442
|
guid = parsed_output.get('guid', None)
|
428
443
|
|
429
|
-
print(Markdown(parsed_output['display']))
|
430
|
-
|
431
444
|
logger.debug(json.dumps(parsed_output, indent=4))
|
432
445
|
|
433
446
|
attributes = parsed_output['attributes']
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
parent_guid = attributes.get('Parent ID', {}).get('guid', None)
|
438
|
-
parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value',
|
439
|
-
"CollectionMembership")
|
440
|
-
parent_at_end1 = attributes.get('Parent at End1', {}).get('value', True)
|
441
|
-
|
442
|
-
anchor_scope_guid = attributes.get('Anchor Scope GUID', {}).get('value', None)
|
443
|
-
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', True)
|
444
|
-
if parent_guid is None:
|
445
|
-
is_own_anchor = True
|
446
|
-
|
447
|
-
collection_type = attributes.get('Collection Type', {}).get('value', None)
|
448
|
-
|
449
|
-
replace_all_props = not attributes.get('Merge Update', {}).get('value', True)
|
450
|
-
|
451
|
-
additional_prop = attributes.get('Additional Properties', {}).get('value', None)
|
452
|
-
additional_properties = json.loads(additional_prop) if additional_prop is not None else None
|
453
|
-
extended_prop = attributes.get('Extended Properties', {}).get('value', None)
|
454
|
-
extended_properties = json.loads(extended_prop) if extended_prop is not None else None
|
447
|
+
display_name = attributes.get('Display Name', {}).get('value', "None Found")
|
448
|
+
status = attributes.get('Status', {}).get('value', None)
|
449
|
+
print(Markdown(parsed_output['display']))
|
455
450
|
|
456
|
-
replace_all_props = not attributes.get('Merge Update', {}).get('value', True)
|
457
451
|
in_data_spec_list = attributes.get('In Data Specification', {}).get('value', None)
|
458
452
|
in_data_spec_valid = attributes.get('In Data Specification', {}).get('valid', None)
|
459
453
|
in_data_spec_exists = attributes.get('In Data Specification', {}).get('exists', None)
|
@@ -469,6 +463,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
469
463
|
return valid
|
470
464
|
|
471
465
|
elif directive == "process":
|
466
|
+
|
472
467
|
try:
|
473
468
|
if object_action == "Update":
|
474
469
|
if not exists:
|
@@ -482,17 +477,20 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
482
477
|
print(Markdown(
|
483
478
|
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
484
479
|
|
485
|
-
|
486
|
-
|
487
|
-
|
480
|
+
body = set_update_body(object_type, attributes)
|
481
|
+
body['properties'] = set_element_prop_body("Data Spec", qualified_name, attributes)
|
482
|
+
|
483
|
+
egeria_client.update_collection(guid, body)
|
484
|
+
if status:
|
485
|
+
egeria_client.update_collection_status(guid, status)
|
486
|
+
|
488
487
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
489
488
|
update_element_dictionary(qualified_name, {
|
490
489
|
'guid': guid, 'display_name': display_name
|
491
|
-
|
492
|
-
return egeria_client.get_collection_by_guid(guid,
|
490
|
+
})
|
491
|
+
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
493
492
|
output_format='MD')
|
494
493
|
|
495
|
-
|
496
494
|
elif object_action == "Create":
|
497
495
|
if valid is False and exists:
|
498
496
|
msg = (f" Data Specification `{display_name}` already exists and result document updated changing "
|
@@ -505,24 +503,27 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
505
503
|
logger.error(msg)
|
506
504
|
return None
|
507
505
|
else:
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
506
|
+
body = set_create_body(object_type, attributes)
|
507
|
+
body["properties"] = set_element_prop_body(object_type, qualified_name, attributes)
|
508
|
+
parent_guid = body.get('parentGuid', None)
|
509
|
+
if parent_guid:
|
510
|
+
body['parentRelationshipTypeName'] = "CollectionMembership"
|
511
|
+
body['parentAtEnd1'] = True
|
512
|
+
|
513
|
+
guid = egeria_client.create_collection(body=body)
|
513
514
|
if guid:
|
514
515
|
update_element_dictionary(qualified_name, {
|
515
516
|
'guid': guid, 'display_name': display_name
|
516
|
-
|
517
|
+
})
|
517
518
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
518
519
|
logger.success(msg)
|
519
|
-
return egeria_client.get_collection_by_guid(guid,
|
520
|
-
output_format='MD')
|
520
|
+
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD')
|
521
521
|
else:
|
522
522
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
523
523
|
logger.error(msg)
|
524
524
|
return None
|
525
525
|
|
526
|
+
|
526
527
|
except Exception as e:
|
527
528
|
logger.error(f"Error performing {command}: {e}")
|
528
529
|
return None
|
@@ -542,7 +543,9 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
542
543
|
:return: A string summarizing the outcome of the processing.
|
543
544
|
"""
|
544
545
|
|
546
|
+
|
545
547
|
command, object_type, object_action = extract_command_plus(txt)
|
548
|
+
print(Markdown(f"# {command}\n"))
|
546
549
|
|
547
550
|
parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
|
548
551
|
|
@@ -553,31 +556,15 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
553
556
|
guid = parsed_output.get('guid', None)
|
554
557
|
|
555
558
|
print(Markdown(parsed_output['display']))
|
559
|
+
|
556
560
|
logger.debug(json.dumps(parsed_output, indent=4))
|
557
561
|
|
558
562
|
attributes = parsed_output['attributes']
|
559
|
-
description = attributes['Description'].get('value', None)
|
560
563
|
display_name = attributes.get('Display Name', {}).get('value', "None Found")
|
561
|
-
|
562
|
-
anchor_guid = attributes.get('Anchor ID', {}).get('guid', None)
|
563
|
-
parent_guid = attributes.get('Parent ID', {}).get('guid', None)
|
564
|
-
parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value',
|
565
|
-
"CollectionMembership")
|
566
|
-
parent_at_end1 = attributes.get('Parent at End1', {}).get('value', True)
|
567
|
-
|
568
|
-
anchor_scope_guid = attributes.get('Anchor Scope GUID', {}).get('value', None)
|
569
|
-
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', True)
|
570
|
-
if parent_guid is None:
|
571
|
-
is_own_anchor = True
|
572
|
-
collection_type = attributes.get('Collection Type', {}).get('value', None)
|
573
|
-
replace_all_props = not attributes.get('Merge Update', {}).get('value', True)
|
574
|
-
|
575
|
-
additional_prop = attributes.get('Additional Properties', {}).get('value', None)
|
576
|
-
additional_properties = json.loads(additional_prop) if additional_prop is not None else None
|
577
|
-
extended_prop = attributes.get('Extended Properties', {}).get('value', None)
|
578
|
-
extended_properties = json.loads(extended_prop) if extended_prop is not None else None
|
564
|
+
status = attributes.get('Status', {}).get('value', None)
|
579
565
|
|
580
566
|
if directive == "display":
|
567
|
+
|
581
568
|
return None
|
582
569
|
elif directive == "validate":
|
583
570
|
if valid:
|
@@ -590,62 +577,73 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
590
577
|
|
591
578
|
try:
|
592
579
|
if object_action == "Update":
|
593
|
-
|
594
580
|
if not exists:
|
595
|
-
|
596
|
-
|
581
|
+
msg = (f" Element `{display_name}` does not exist! Updating result document with Create "
|
582
|
+
f"object_action\n")
|
583
|
+
logger.error(msg)
|
597
584
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
598
585
|
elif not valid:
|
599
|
-
logger.error(f"Element `{display_name}` does not have a valid specification? Review..\n\n___ ")
|
600
586
|
return None
|
601
587
|
else:
|
602
588
|
print(Markdown(
|
603
|
-
f"==> Validation of {command} completed successfully! Proceeding to apply the changes
|
589
|
+
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
590
|
+
|
591
|
+
body = set_update_body(object_type, attributes)
|
592
|
+
body['properties'] = set_element_prop_body("Data Spec", qualified_name, attributes)
|
593
|
+
|
594
|
+
egeria_client.update_collection(guid, body)
|
595
|
+
if status:
|
596
|
+
egeria_client.update_collection_status(guid, status)
|
604
597
|
|
605
|
-
egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
|
606
|
-
additional_properties,
|
607
|
-
extended_properties, replace_all_props)
|
608
598
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
609
599
|
update_element_dictionary(qualified_name, {
|
610
600
|
'guid': guid, 'display_name': display_name
|
611
|
-
|
612
|
-
return egeria_client.get_collection_by_guid(guid,
|
601
|
+
})
|
602
|
+
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
603
|
+
output_format='MD')
|
613
604
|
|
614
605
|
elif object_action == "Create":
|
615
606
|
if valid is False and exists:
|
616
|
-
|
617
|
-
|
607
|
+
msg = (f" Data Specification `{display_name}` already exists and result document updated changing "
|
608
|
+
f"`Create` to `Update` in processed output\n\n___")
|
609
|
+
logger.error(msg)
|
618
610
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
611
|
+
elif valid is False :
|
612
|
+
msg = f" invalid data? - Correct and try again\n\n___"
|
613
|
+
logger.error(msg)
|
614
|
+
return None
|
619
615
|
else:
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
616
|
+
body = set_create_body(object_type, attributes)
|
617
|
+
body["properties"] = set_element_prop_body(object_type, qualified_name, attributes)
|
618
|
+
parent_guid = body.get('parentGuid', None)
|
619
|
+
if parent_guid:
|
620
|
+
body['parentRelationshipTypeName'] = "CollectionMembership"
|
621
|
+
body['parentAtEnd1'] = True
|
622
|
+
|
623
|
+
guid = egeria_client.create_collection(body=body)
|
626
624
|
if guid:
|
627
625
|
update_element_dictionary(qualified_name, {
|
628
626
|
'guid': guid, 'display_name': display_name
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
return egeria_client.get_collection_by_guid(guid,
|
633
|
-
output_format='MD')
|
627
|
+
})
|
628
|
+
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
629
|
+
logger.success(msg)
|
630
|
+
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD')
|
634
631
|
else:
|
635
|
-
|
632
|
+
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
633
|
+
logger.error(msg)
|
636
634
|
return None
|
637
635
|
|
636
|
+
|
638
637
|
except Exception as e:
|
639
|
-
logger.error(f"
|
640
|
-
Console().print_exception(show_locals=True)
|
638
|
+
logger.error(f"Error performing {command}: {e}")
|
641
639
|
return None
|
642
640
|
else:
|
643
641
|
return None
|
644
642
|
|
645
643
|
|
646
644
|
@logger.catch
|
647
|
-
def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
648
|
-
|
645
|
+
def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
646
|
+
directive: str = "display") -> Optional[str]:
|
649
647
|
"""
|
650
648
|
Processes a data structure create or update object_action by extracting key attributes such as
|
651
649
|
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
@@ -655,9 +653,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
655
653
|
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
656
654
|
:return: A string summarizing the outcome of the processing.
|
657
655
|
"""
|
658
|
-
from md_processing.md_processing_utils.common_md_utils import set_debug_level
|
659
656
|
|
660
|
-
set_debug_level(directive)
|
661
657
|
|
662
658
|
command, object_type, object_action = extract_command_plus(txt)
|
663
659
|
print(Markdown(f"# {command}\n"))
|
@@ -670,7 +666,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
670
666
|
qualified_name = parsed_output.get('qualified_name', None)
|
671
667
|
guid = parsed_output.get('guid', None)
|
672
668
|
|
673
|
-
|
669
|
+
|
674
670
|
|
675
671
|
if directive == "display":
|
676
672
|
return None
|
@@ -685,48 +681,16 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
685
681
|
elif directive == "process":
|
686
682
|
logger.debug(json.dumps(parsed_output, indent=4))
|
687
683
|
attributes = parsed_output['attributes']
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value', None)
|
699
|
-
parent_relationship_properties = attributes.get('Parent Relationship Properties', {}).get('value', None)
|
700
|
-
parent_at_end1 = attributes.get('Parent at End1', {}).get('value', None)
|
701
|
-
|
702
|
-
display_name = attributes['Display Name'].get('value', None)
|
703
|
-
|
704
|
-
namespace = attributes.get('Namespace', {}).get('value', None)
|
705
|
-
description = attributes.get('Description', {}).get('value', None)
|
706
|
-
version_id = attributes.get('Version Identifier', {}).get('value', None)
|
707
|
-
aliases = attributes.get('Aliases', {}).get('value', None)
|
708
|
-
name_patterns = attributes.get('Name Patterns', {}).get('value', None)
|
709
|
-
is_nullable = attributes.get('Is Nullable', {}).get('value', None)
|
710
|
-
default_value = attributes.get('Default Value', {}).get('value', None)
|
711
|
-
data_type = attributes.get('Data Type', {}).get('value', None)
|
712
|
-
min_length = attributes.get('Minimum Length', {}).get('value', None)
|
713
|
-
length = attributes.get('Length', {}).get('value', None)
|
714
|
-
precision = attributes.get('Precision', {}).get('value', None)
|
715
|
-
ordered_values = attributes.get('Ordered Values', {}).get('value', None)
|
716
|
-
sort_order = attributes.get('Sort Order', {}).get('value', None)
|
717
|
-
additional_properties = attributes.get('Additional Properties', {}).get('value', None)
|
718
|
-
effective_from = attributes.get('Effective From', {}).get('value', None)
|
719
|
-
effective_to = attributes.get('Effective To', {}).get('value', None)
|
720
|
-
|
721
|
-
position = attributes.get('Position', {}).get('value', None)
|
722
|
-
min_cardinality = attributes.get('Minimum Cardinality', {}).get('value', None)
|
723
|
-
max_cardinality = attributes.get('Maximum Cardinality', {}).get('value', None)
|
724
|
-
in_data_structure = attributes.get('In Data Structure', {}).get('value', None)
|
725
|
-
data_class = attributes.get('Data Class', {}).get('value', None)
|
726
|
-
glossary_term = attributes.get('Glossary Term', {}).get('value', None)
|
727
|
-
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
728
|
-
|
729
|
-
# name_details_list = attributes.get("dict_list", None)
|
684
|
+
display_name = attributes.get('Display Name', {}).get('value', None)
|
685
|
+
qualified_name = attributes.get('Qualified Name',{}).get('value', None)
|
686
|
+
if qualified_name is None:
|
687
|
+
qualified_name = attributes.get('Display Name',{}).get('qualified_name', None)
|
688
|
+
if qualified_name is None:
|
689
|
+
logger.error(f"Element `{display_name}` does not have a valid specification? No qualified name..Review..\n\n___ ")
|
690
|
+
return None
|
691
|
+
prop_body = set_element_prop_body(object_type, qualified_name, attributes)
|
692
|
+
prop_body['namespace'] = attributes.get('Namespace', {}).get('value', None)
|
693
|
+
display_name = attributes.get('Display Name',{}).get('value', None)
|
730
694
|
|
731
695
|
data_spec_name_list = attributes.get("In Data Specification", {}).get("name_list", "")
|
732
696
|
data_spec_value = attributes.get("In Data Specification", {}).get("value", None)
|
@@ -736,79 +700,58 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
736
700
|
data_dict_name_list = attributes.get('In Data Dictionary', {}).get('name_list', "")
|
737
701
|
data_dict_value_list = attributes.get('In Data Dictionary', {}).get('value', None)
|
738
702
|
data_dict_guid_list = attributes.get("In Data Dictionary", {}).get("guid_list", None)
|
739
|
-
|
740
|
-
parent_data_field = attributes.get('Parent Data Field', {}).get('value', None)
|
741
|
-
parent_data_field_guid = attributes.get('Parent Data Field', {}).get('guid', None)
|
742
|
-
|
743
|
-
anchor_scope_guid = attributes.get('Anchor Scope GUID', {}).get('value', None)
|
744
|
-
|
745
|
-
collection_type = object_type
|
746
|
-
replace_all_props = True
|
747
|
-
if not valid:
|
748
|
-
if exists and object_action == "Create":
|
749
|
-
msg = (f"Create failed because Element `{display_name}` exists - changing `Create` to `Update` in "
|
750
|
-
f"processed output \n\n___")
|
751
|
-
logger.error(msg)
|
752
|
-
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
753
|
-
else:
|
754
|
-
return None
|
755
|
-
elif object_action == "Update" and not exists:
|
756
|
-
logger.error(f"Element `{display_name}` does not exist! Updating result document with Create "
|
757
|
-
f"object_action\n\n___")
|
758
|
-
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
759
|
-
|
760
|
-
else:
|
761
|
-
print(Markdown(f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
703
|
+
merge_update = attributes.get('Merge Update', {}).get('value', True)
|
762
704
|
|
763
705
|
try:
|
764
706
|
if object_action == "Update":
|
765
|
-
|
766
|
-
"
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
707
|
+
if not exists:
|
708
|
+
logger.error(f"Element `{qualified_name}` does not exist! Updating result document with Create "
|
709
|
+
f"object_action\n\n___")
|
710
|
+
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
711
|
+
elif not valid:
|
712
|
+
logger.error(f"Element `{qualified_name}` does not have a valid specification? Review..\n\n___ ")
|
713
|
+
return None
|
714
|
+
else:
|
715
|
+
update_body = set_update_body(object_type,attributes)
|
716
|
+
update_body['properties'] = prop_body
|
717
|
+
egeria_client.update_data_structure(guid, update_body)
|
718
|
+
update_element_dictionary(qualified_name, {
|
719
|
+
'guid': guid, 'display_name': display_name
|
720
|
+
})
|
721
|
+
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
722
|
+
|
723
|
+
core_props = egeria_client.get_data_structure_by_guid(guid, output_format='MD')
|
724
|
+
|
725
|
+
update_element_dictionary(qualified_name, {
|
726
|
+
'guid': guid, 'display_name': display_name
|
781
727
|
})
|
782
728
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
729
|
+
update_data_collection_memberships(egeria_client, object_type, data_spec_guid_list, "DataSpec", guid,
|
730
|
+
display_name, merge_update)
|
731
|
+
core_props += f"## In Data Dictionary\n\n{data_dict_name_list}\n\n"
|
732
|
+
core_props += f"## In Data Specification\n\n{data_spec_name_list}\n\n"
|
733
|
+
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
734
|
+
return core_props
|
735
|
+
|
736
|
+
|
737
|
+
if not valid:
|
738
|
+
if exists and object_action == "Create":
|
739
|
+
msg = (f"Create failed because Element `{display_name}` exists - changing `Create` to `Update` in "
|
740
|
+
f"processed output \n\n___")
|
741
|
+
logger.error(msg)
|
742
|
+
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
743
|
+
else:
|
744
|
+
return None
|
745
|
+
|
789
746
|
|
790
747
|
elif object_action == "Create":
|
791
748
|
if exists:
|
792
749
|
logger.warning(f"\nTerm `{display_name}` already exists and result document updated\n\n___")
|
793
750
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
794
751
|
else:
|
795
|
-
|
796
|
-
body =
|
797
|
-
|
798
|
-
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
799
|
-
"forLineage": False, "forDuplicateProcessing": False, "anchorGUID": anchor_guid,
|
800
|
-
"isOwnAnchor": is_own_anchor, "parentGUID": parent_guid,
|
801
|
-
"parentRelationshipTypeName": parent_relationship_type_name,
|
802
|
-
"parentRelationshipProperties": parent_relationship_properties, "parentAtEnd1": parent_at_end1,
|
803
|
-
"properties": {
|
804
|
-
"class": "DataStructureProperties", "qualifiedName": qualified_name,
|
805
|
-
"displayName": display_name, "description": description, "namespace": namespace,
|
806
|
-
"versionIdentifier": version_id, "additionalProperties": additional_properties,
|
807
|
-
"effectiveFrom": effective_from, "effectiveTo": effective_to
|
808
|
-
}
|
809
|
-
}
|
810
|
-
|
811
|
-
guid = egeria_client.create_data_structure_w_body(body_slimmer(body))
|
752
|
+
body = set_create_body(object_type, attributes)
|
753
|
+
body['properties'] = prop_body
|
754
|
+
guid = egeria_client.create_data_structure(body_slimmer(body))
|
812
755
|
if guid:
|
813
756
|
update_element_dictionary(qualified_name, {
|
814
757
|
'guid': guid, 'display_name': display_name
|
@@ -834,12 +777,11 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
834
777
|
logger.error(f"Failed to create Data Structure `{display_name}`\n\n___")
|
835
778
|
return None
|
836
779
|
|
837
|
-
|
838
780
|
except Exception as e:
|
839
781
|
logger.error(f"Error performing {object_action}: {e}\n\n___")
|
840
782
|
return None
|
841
|
-
|
842
|
-
|
783
|
+
else:
|
784
|
+
return None
|
843
785
|
|
844
786
|
|
845
787
|
@logger.catch
|
@@ -884,38 +826,6 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
884
826
|
elif directive == "process":
|
885
827
|
logger.debug(json.dumps(parsed_output, indent=4))
|
886
828
|
|
887
|
-
external_source_guid = attributes.get('External Source Name', {}).get('guid', None)
|
888
|
-
external_source_name = attributes.get('External Source Name', {}).get('value', None)
|
889
|
-
effective_time = attributes.get('Effective Time', {}).get('value', None)
|
890
|
-
for_lineage = attributes.get('For Lineage', {}).get('value', None)
|
891
|
-
for_duplicate_processing = attributes.get('For Duplicate Processing', {}).get('value', None)
|
892
|
-
anchor_guid = attributes.get('Anchor ID', {}).get('guid', None)
|
893
|
-
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', None)
|
894
|
-
# parent_id = attributes.get('Parent ID', {}).get('value', None)
|
895
|
-
# parent_guid = attributes['Parent ID'].get('guid', None)
|
896
|
-
# parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value', None)
|
897
|
-
# parent_relationship_properties = attributes.get('Parent Relationship Properties',{}).get('value', None)
|
898
|
-
# parent_at_end1 = attributes.get('Parent at End1', {}).get('value', None)
|
899
|
-
|
900
|
-
namespace = attributes.get('Namespace', {}).get('value', None)
|
901
|
-
description = attributes.get('Description', {}).get('value', None)
|
902
|
-
version_id = attributes.get('Version Identifier', {}).get('value', None)
|
903
|
-
aliases = attributes.get('Aliases', {}).get('value', None)
|
904
|
-
name_patterns = attributes.get('Name Patterns', {}).get('value', None)
|
905
|
-
is_nullable = attributes.get('Is Nullable', {}).get('value', None)
|
906
|
-
default_value = attributes.get('Default Value', {}).get('value', None)
|
907
|
-
data_type = attributes.get('Data Type', {}).get('value', None)
|
908
|
-
min_length = attributes.get('Minimum Length', {}).get('value', None)
|
909
|
-
length = attributes.get('Length', {}).get('value', None)
|
910
|
-
precision = attributes.get('Precision', {}).get('value', None)
|
911
|
-
ordered_values = attributes.get('Ordered Values', {}).get('value', None)
|
912
|
-
sort_order = attributes.get('Sort Order', {}).get('value', None)
|
913
|
-
additional_properties = attributes.get('Additional Properties', {}).get('value', None)
|
914
|
-
effective_from = attributes.get('Effective From', {}).get('value', None)
|
915
|
-
effective_to = attributes.get('Effective To', {}).get('value', None)
|
916
|
-
|
917
|
-
glossary_term = attributes['Glossary Term'].get('value', None)
|
918
|
-
glossary_term_guid = attributes['Glossary Term'].get('guid', None)
|
919
829
|
|
920
830
|
merge_update = attributes.get('Merge Update', {}).get('value', None)
|
921
831
|
|
@@ -929,13 +839,11 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
929
839
|
|
930
840
|
data_class = attributes.get('Data Class', {}).get('value', None)
|
931
841
|
data_class_guid = attributes.get('Data Class', {}).get('guid', None)
|
932
|
-
|
842
|
+
glossary_term = attributes.get('Glossary Term', {}).get('value', None)
|
933
843
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
934
844
|
if glossary_term_guid:
|
935
845
|
glossary_term_guid = [glossary_term_guid]
|
936
846
|
|
937
|
-
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
938
|
-
|
939
847
|
# name_details_list = attributes.get("dict_list", None)
|
940
848
|
|
941
849
|
in_data_spec = attributes.get("In Data Specification", {}).get("value", None) # this is a [dict]
|
@@ -967,6 +875,8 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
967
875
|
else:
|
968
876
|
print(Markdown(f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
969
877
|
|
878
|
+
props_body = set_data_field_body(object_type, qualified_name, attributes)
|
879
|
+
|
970
880
|
try:
|
971
881
|
if object_action == "Update":
|
972
882
|
if not exists:
|
@@ -975,29 +885,15 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
975
885
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
976
886
|
|
977
887
|
# first update the base data field
|
978
|
-
body =
|
979
|
-
|
980
|
-
|
981
|
-
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing, "properties": {
|
982
|
-
"class": "DataFieldProperties", "qualifiedName": qualified_name, "displayName": display_name,
|
983
|
-
"namespace": namespace, "description": description, "versionIdentifier": version_id,
|
984
|
-
"aliases": aliases, "namePatterns": name_patterns, "isDeprecated": False,
|
985
|
-
"isNullable": is_nullable, "defaultValue": default_value, "dataType": data_type,
|
986
|
-
"minimumLength": min_length, "length": length, "precision": precision,
|
987
|
-
"orderedValues": ordered_values, "sortOrder": sort_order,
|
988
|
-
"additionalProperties": additional_properties, "effectiveFrom": effective_from,
|
989
|
-
"effectiveTo": effective_to
|
990
|
-
}
|
991
|
-
}
|
992
|
-
|
993
|
-
egeria_client.update_data_field(guid, body, not merge_update)
|
888
|
+
body = set_update_body(object_type, attributes)
|
889
|
+
body['properties'] = props_body
|
890
|
+
egeria_client.update_data_field(guid, body)
|
994
891
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}")
|
995
892
|
# Update data dictionary membership
|
996
893
|
update_element_dictionary(qualified_name, {
|
997
894
|
'guid': guid, 'display_name': display_name
|
998
895
|
})
|
999
|
-
core_props = egeria_client.
|
1000
|
-
output_format='MD') ## update back to by_guid?
|
896
|
+
core_props = egeria_client.get_data_field_by_guid(guid, output_format='MD') ## update back to by_guid?
|
1001
897
|
|
1002
898
|
# existing_data_field = egeria_client.get_data_field_by_guid(guid, output_format='JSON')
|
1003
899
|
|
@@ -1028,17 +924,10 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1028
924
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
1029
925
|
else:
|
1030
926
|
# First lets create the data field
|
1031
|
-
body =
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
"versionIdentifier": version_id, "aliases": aliases, "namePatterns": name_patterns,
|
1036
|
-
"isDeprecated": False, "isNullable": is_nullable, "defaultValue": default_value,
|
1037
|
-
"dataType": data_type, "minimumLength": min_length, "length": length,
|
1038
|
-
"precision": precision, "orderedValues": ordered_values, "sortOrder": sort_order,
|
1039
|
-
"additionalProperties": additional_properties
|
1040
|
-
}
|
1041
|
-
}
|
927
|
+
body = set_create_body(object_type, attributes)
|
928
|
+
body['properties'] = props_body
|
929
|
+
parent_guid = body.get('parentGuid', None)
|
930
|
+
|
1042
931
|
guid = egeria_client.create_data_field(body)
|
1043
932
|
if guid:
|
1044
933
|
# Now update our element dictionary with the new information
|
@@ -1046,7 +935,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1046
935
|
'guid': guid, 'display_name': display_name
|
1047
936
|
})
|
1048
937
|
# Start assembling the information we will present back out
|
1049
|
-
core_props = egeria_client.get_data_field_by_guid(guid,
|
938
|
+
core_props = egeria_client.get_data_field_by_guid(guid, 'MD')
|
1050
939
|
|
1051
940
|
# Add the field to any data dictionaries
|
1052
941
|
if in_data_dictionary:
|
@@ -1059,27 +948,27 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1059
948
|
core_props += f"\n\n## In Data Structure\n\n{in_data_structure_names}\n\n"
|
1060
949
|
for ds_guid in data_structure_guid_list:
|
1061
950
|
# todo This is too naive? - need to better accommodate the relationship
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
951
|
+
prop_body = set_rel_prop_body("MemberDataFieldProperties", attributes)
|
952
|
+
prop_body["position"] = position
|
953
|
+
prop_body["minimumCardinality"] = min_cardinality
|
954
|
+
prop_body["maximumCardinality"] = max_cardinality
|
955
|
+
|
956
|
+
body = set_rel_request_body(object_type, attributes)
|
957
|
+
body['properties'] = prop_body
|
1068
958
|
|
1069
959
|
msg = f"Adding field to structure {ds_guid}"
|
1070
960
|
logger.info(msg)
|
1071
|
-
egeria_client.link_member_data_field(ds_guid, guid,
|
961
|
+
egeria_client.link_member_data_field(ds_guid, guid, body)
|
1072
962
|
core_props += f"\n\n## In Data Structure {in_data_structure_names}\n\n"
|
1073
963
|
|
1074
964
|
if glossary_term:
|
1075
965
|
if glossary_term_guid:
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
}
|
966
|
+
term_body = set_rel_prop_body("GlossaryTermProperties", attributes)
|
967
|
+
body = set_rel_request_body(object_type, attributes)
|
968
|
+
body['properties'] = term_body
|
969
|
+
|
1081
970
|
core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
|
1082
|
-
egeria_client.link_semantic_definition(guid, glossary_term_guid,
|
971
|
+
egeria_client.link_semantic_definition(guid, glossary_term_guid, term_body)
|
1083
972
|
|
1084
973
|
if parent_data_field_guids:
|
1085
974
|
# parent_df_body = {
|
@@ -1095,11 +984,11 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1095
984
|
|
1096
985
|
# Link data class
|
1097
986
|
if data_class:
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
987
|
+
prop_body = set_rel_prop_body("DataClassProperties", attributes)
|
988
|
+
body = set_rel_request_body(object_type, attributes)
|
989
|
+
body['properties'] = prop_body
|
990
|
+
|
991
|
+
core_props += f"\n\n## Data Class\n\n{data_class}\n\n"
|
1103
992
|
egeria_client.link_data_class_definition(guid, data_class_guid, body)
|
1104
993
|
msg = f"Adding data class `{data_class}` to data field {display_name}"
|
1105
994
|
logger.info(msg)
|
@@ -1372,292 +1261,3 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1372
1261
|
else:
|
1373
1262
|
return None
|
1374
1263
|
|
1375
|
-
|
1376
|
-
@logger.catch
|
1377
|
-
def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1378
|
-
str]:
|
1379
|
-
"""
|
1380
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1381
|
-
search string from the given text.
|
1382
|
-
|
1383
|
-
:param txt: A string representing the input cell to be processed for
|
1384
|
-
extracting term-related attributes.
|
1385
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1386
|
-
:return: A string summarizing the outcome of the processing.
|
1387
|
-
"""
|
1388
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1389
|
-
print(Markdown(f"# {command}\n"))
|
1390
|
-
if object_type in ["Data Dictionary", "Data Dictionaries", "DataDict", "DataDictionary"]:
|
1391
|
-
col_type = "DataDictionary"
|
1392
|
-
elif object_type in ["Data Specification", "Data Specifications", "Data Specs"]:
|
1393
|
-
col_type = "DataSpec"
|
1394
|
-
else:
|
1395
|
-
col_type = "Collection"
|
1396
|
-
|
1397
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
valid = parsed_output['valid']
|
1402
|
-
print(Markdown(f"Performing {command}"))
|
1403
|
-
print(Markdown(parsed_output['display']))
|
1404
|
-
|
1405
|
-
attr = parsed_output.get('attributes',{})
|
1406
|
-
effective_time = attr.get('effectiveTime', {}).get('value', None)
|
1407
|
-
as_of_time = attr.get('asOfTime', {}).get('value', None)
|
1408
|
-
for_duplicate_processing = attr.get('forDuplicateProcessing', {}).get('value', False)
|
1409
|
-
for_lineage = attr.get('forLineage',{}).get('value', False)
|
1410
|
-
limit_result_by_status = attr.get('limitResultsByStatus',{}).get('value', ['ACTIVE'])
|
1411
|
-
sequencing_property = attr.get('sequencingProperty',{}).get('value',"qualifiedName" )
|
1412
|
-
sequencing_order = attr.get('sequencingOrder',{}).get('value', "PROPERTY_ASCENDING")
|
1413
|
-
search_string = attr.get('Search String', {}).get('value', '*')
|
1414
|
-
output_format = attr.get('Output Format', {}).get('value', 'LIST')
|
1415
|
-
detailed = attr.get('Detailed', {}).get('value', False)
|
1416
|
-
|
1417
|
-
if directive == "display":
|
1418
|
-
return None
|
1419
|
-
elif directive == "validate":
|
1420
|
-
if valid:
|
1421
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1422
|
-
else:
|
1423
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1424
|
-
logger.error(msg)
|
1425
|
-
return valid
|
1426
|
-
|
1427
|
-
elif directive == "process":
|
1428
|
-
try:
|
1429
|
-
if not valid: # First validate the command before we process it
|
1430
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1431
|
-
logger.error(msg)
|
1432
|
-
return None
|
1433
|
-
|
1434
|
-
list_md = f"\n# `{col_type}` with filter: `{search_string}`\n\n"
|
1435
|
-
body = {
|
1436
|
-
"class": "FilterRequestBody",
|
1437
|
-
"asOfTime": as_of_time,
|
1438
|
-
"effectiveTime": effective_time,
|
1439
|
-
"forLineage": for_lineage,
|
1440
|
-
"forDuplicateProcessing": for_duplicate_processing,
|
1441
|
-
"limitResultsByStatus": limit_result_by_status,
|
1442
|
-
"sequencingOrder": sequencing_order,
|
1443
|
-
"sequencingProperty": sequencing_property,
|
1444
|
-
"filter": search_string,
|
1445
|
-
}
|
1446
|
-
|
1447
|
-
struct = egeria_client.find_collections_w_body(body, col_type, output_format=output_format)
|
1448
|
-
if output_format == "DICT":
|
1449
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1450
|
-
else:
|
1451
|
-
list_md += struct
|
1452
|
-
logger.info(f"Wrote `{col_type}` for search string: `{search_string}`")
|
1453
|
-
|
1454
|
-
return list_md
|
1455
|
-
|
1456
|
-
except Exception as e:
|
1457
|
-
logger.error(f"Error performing {command}: {e}")
|
1458
|
-
console.print_exception(show_locals=True)
|
1459
|
-
return None
|
1460
|
-
else:
|
1461
|
-
return None
|
1462
|
-
|
1463
|
-
|
1464
|
-
def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1465
|
-
str]:
|
1466
|
-
"""
|
1467
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1468
|
-
search string from the given text.
|
1469
|
-
|
1470
|
-
:param txt: A string representing the input cell to be processed for
|
1471
|
-
extracting term-related attributes.
|
1472
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1473
|
-
:return: A string summarizing the outcome of the processing.
|
1474
|
-
"""
|
1475
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1476
|
-
print(Markdown(f"# {command}\n"))
|
1477
|
-
|
1478
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1479
|
-
|
1480
|
-
attributes = parsed_output['attributes']
|
1481
|
-
|
1482
|
-
valid = parsed_output['valid']
|
1483
|
-
print(Markdown(f"Performing {command}"))
|
1484
|
-
print(Markdown(parsed_output['display']))
|
1485
|
-
|
1486
|
-
if directive == "display":
|
1487
|
-
return None
|
1488
|
-
elif directive == "validate":
|
1489
|
-
if valid:
|
1490
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1491
|
-
else:
|
1492
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1493
|
-
logger.error(msg)
|
1494
|
-
return valid
|
1495
|
-
|
1496
|
-
elif directive == "process":
|
1497
|
-
attributes = parsed_output['attributes']
|
1498
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1499
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1500
|
-
detailed = attributes.get('Detailed', {}).get('value', False)
|
1501
|
-
|
1502
|
-
try:
|
1503
|
-
if not valid: # First validate the command before we process it
|
1504
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1505
|
-
logger.error(msg)
|
1506
|
-
return None
|
1507
|
-
|
1508
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1509
|
-
struct = egeria_client.find_data_structures(search_string, output_format=output_format)
|
1510
|
-
|
1511
|
-
if output_format == "DICT":
|
1512
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1513
|
-
else:
|
1514
|
-
list_md += struct
|
1515
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1516
|
-
|
1517
|
-
return list_md
|
1518
|
-
|
1519
|
-
except Exception as e:
|
1520
|
-
logger.error(f"Error performing {command}: {e}")
|
1521
|
-
console.print_exception(show_locals=True)
|
1522
|
-
return None
|
1523
|
-
else:
|
1524
|
-
return None
|
1525
|
-
|
1526
|
-
|
1527
|
-
def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1528
|
-
"""
|
1529
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1530
|
-
search string from the given text.
|
1531
|
-
|
1532
|
-
:param txt: A string representing the input cell to be processed for
|
1533
|
-
extracting term-related attributes.
|
1534
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1535
|
-
:return: A string summarizing the outcome of the processing.
|
1536
|
-
"""
|
1537
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1538
|
-
print(Markdown(f"# {command}\n"))
|
1539
|
-
|
1540
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1541
|
-
|
1542
|
-
attributes = parsed_output['attributes']
|
1543
|
-
|
1544
|
-
valid = parsed_output['valid']
|
1545
|
-
print(Markdown(f"Performing {command}"))
|
1546
|
-
print(Markdown(parsed_output['display']))
|
1547
|
-
|
1548
|
-
if directive == "display":
|
1549
|
-
return None
|
1550
|
-
elif directive == "validate":
|
1551
|
-
if valid:
|
1552
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1553
|
-
else:
|
1554
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1555
|
-
logger.error(msg)
|
1556
|
-
return valid
|
1557
|
-
|
1558
|
-
elif directive == "process":
|
1559
|
-
attributes = parsed_output['attributes']
|
1560
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1561
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1562
|
-
detailed = attributes.get('Detailed', {}).get('value', False)
|
1563
|
-
as_of_time = attributes.get('AsOfTime', {}).get('value', None)
|
1564
|
-
effective_time = attributes.get('Effective Time', {}).get('value', None)
|
1565
|
-
sort_order = attributes.get('Sort Order', {}).get('value', None)
|
1566
|
-
order_property = attributes.get('Order Property', {}).get('value', None)
|
1567
|
-
starts_with = attributes.get('Start With', {}).get('value', True)
|
1568
|
-
ends_with = attributes.get('End With', {}).get('value', False)
|
1569
|
-
ignore_case = attributes.get('Ignore Case', {}).get('value', False)
|
1570
|
-
start_from = attributes.get('Start From', {}).get('value', 0)
|
1571
|
-
page_size = attributes.get('Page Size', {}).get('value', None)
|
1572
|
-
|
1573
|
-
try:
|
1574
|
-
if not valid: # First validate the command before we process it
|
1575
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1576
|
-
logger.error(msg)
|
1577
|
-
return None
|
1578
|
-
|
1579
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1580
|
-
body = {
|
1581
|
-
"class": "FilterRequestBody", "asOfTime": as_of_time, "effectiveTime": effective_time,
|
1582
|
-
"forLineage": False, "forDuplicateProcessing": False, "limitResultsByStatus": ["ACTIVE"],
|
1583
|
-
"sequencingOrder": sort_order, "sequencingProperty": order_property, "filter": search_string,
|
1584
|
-
}
|
1585
|
-
struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with, ends_with,
|
1586
|
-
ignore_case, output_format)
|
1587
|
-
|
1588
|
-
if output_format == "DICT":
|
1589
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1590
|
-
else:
|
1591
|
-
list_md += struct
|
1592
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1593
|
-
|
1594
|
-
return list_md
|
1595
|
-
|
1596
|
-
except Exception as e:
|
1597
|
-
logger.error(f"Error performing {command}: {e}")
|
1598
|
-
console.print_exception(show_locals=True)
|
1599
|
-
return None
|
1600
|
-
else:
|
1601
|
-
return None
|
1602
|
-
|
1603
|
-
|
1604
|
-
def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1605
|
-
"""
|
1606
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1607
|
-
search string from the given text.
|
1608
|
-
|
1609
|
-
:param txt: A string representing the input cell to be processed for
|
1610
|
-
extracting term-related attributes.
|
1611
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1612
|
-
:return: A string summarizing the outcome of the processing.
|
1613
|
-
"""
|
1614
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1615
|
-
print(Markdown(f"# {command}\n"))
|
1616
|
-
|
1617
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1618
|
-
|
1619
|
-
attributes = parsed_output['attributes']
|
1620
|
-
|
1621
|
-
valid = parsed_output['valid']
|
1622
|
-
print(Markdown(f"Performing {command}"))
|
1623
|
-
print(Markdown(parsed_output['display']))
|
1624
|
-
|
1625
|
-
if directive == "display":
|
1626
|
-
return None
|
1627
|
-
elif directive == "validate":
|
1628
|
-
if valid:
|
1629
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1630
|
-
else:
|
1631
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1632
|
-
logger.error(msg)
|
1633
|
-
return valid
|
1634
|
-
|
1635
|
-
elif directive == "process":
|
1636
|
-
attributes = parsed_output['attributes']
|
1637
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1638
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1639
|
-
detailed = attributes.get('Detailed', {}).get('value', False)
|
1640
|
-
|
1641
|
-
try:
|
1642
|
-
if not valid: # First validate the command before we process it
|
1643
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1644
|
-
logger.error(msg)
|
1645
|
-
return None
|
1646
|
-
|
1647
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1648
|
-
struct = egeria_client.find_data_classes(search_string, output_format=output_format)
|
1649
|
-
|
1650
|
-
if output_format == "DICT":
|
1651
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1652
|
-
else:
|
1653
|
-
list_md += struct
|
1654
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1655
|
-
|
1656
|
-
return list_md
|
1657
|
-
|
1658
|
-
except Exception as e:
|
1659
|
-
logger.error(f"Error performing {command}: {e}")
|
1660
|
-
console.print_exception(show_locals=True)
|
1661
|
-
return None
|
1662
|
-
else:
|
1663
|
-
return None
|