pyegeria 5.4.3.3__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-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 +5314 -4140
- 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 +4 -4
- md_processing/dr_egeria.py +6 -9
- md_processing/dr_egeria_inbox/data_spec_test.md +38 -364
- md_processing/dr_egeria_inbox/gov_def.md +3 -3
- md_processing/dr_egeria_inbox/product.md +10 -2
- md_processing/md_commands/data_designer_commands.py +90 -425
- md_processing/md_processing_utils/common_md_utils.py +50 -1
- 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 +2943 -2955
- 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 +166 -117
- 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.3.dist-info → pyegeria-5.4.3.4.dist-info}/METADATA +1 -1
- {pyegeria-5.4.3.3.dist-info → pyegeria-5.4.3.4.dist-info}/RECORD +37 -39
- md_processing/dr_egeria_outbox/tuesday/processed-2025-09-02 13:07-gov_def.md +0 -492
- md_processing/dr_egeria_outbox/tuesday/processed-2025-09-02 13:25-gov_def.md +0 -520
- md_processing/dr_egeria_outbox/tuesday/processed-2025-09-02 16:43-gov_def.md +0 -636
- md_processing/dr_egeria_outbox/tuesday/processed-2025-09-02 16:46-gov_def.md +0 -636
- {pyegeria-5.4.3.3.dist-info → pyegeria-5.4.3.4.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.3.3.dist-info → pyegeria-5.4.3.4.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.3.3.dist-info → pyegeria-5.4.3.4.dist-info}/entry_points.txt +0 -0
@@ -12,9 +12,21 @@ 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 (
|
16
|
-
|
17
|
-
|
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
|
18
30
|
from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
|
19
31
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
20
32
|
from pyegeria import DEBUG_LEVEL, body_slimmer
|
@@ -419,6 +431,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
419
431
|
"""
|
420
432
|
|
421
433
|
command, object_type, object_action = extract_command_plus(txt)
|
434
|
+
print(Markdown(f"# {command}\n"))
|
422
435
|
|
423
436
|
parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
|
424
437
|
|
@@ -428,13 +441,12 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
428
441
|
qualified_name = parsed_output.get('qualified_name', None)
|
429
442
|
guid = parsed_output.get('guid', None)
|
430
443
|
|
431
|
-
print(Markdown(parsed_output['display']))
|
432
|
-
|
433
444
|
logger.debug(json.dumps(parsed_output, indent=4))
|
434
445
|
|
435
446
|
attributes = parsed_output['attributes']
|
436
447
|
display_name = attributes.get('Display Name', {}).get('value', "None Found")
|
437
448
|
status = attributes.get('Status', {}).get('value', None)
|
449
|
+
print(Markdown(parsed_output['display']))
|
438
450
|
|
439
451
|
in_data_spec_list = attributes.get('In Data Specification', {}).get('value', None)
|
440
452
|
in_data_spec_valid = attributes.get('In Data Specification', {}).get('valid', None)
|
@@ -531,7 +543,9 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
531
543
|
:return: A string summarizing the outcome of the processing.
|
532
544
|
"""
|
533
545
|
|
546
|
+
|
534
547
|
command, object_type, object_action = extract_command_plus(txt)
|
548
|
+
print(Markdown(f"# {command}\n"))
|
535
549
|
|
536
550
|
parsed_output = parse_upsert_command(egeria_client, object_type, object_action, txt, directive)
|
537
551
|
|
@@ -542,31 +556,15 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
542
556
|
guid = parsed_output.get('guid', None)
|
543
557
|
|
544
558
|
print(Markdown(parsed_output['display']))
|
559
|
+
|
545
560
|
logger.debug(json.dumps(parsed_output, indent=4))
|
546
561
|
|
547
562
|
attributes = parsed_output['attributes']
|
548
|
-
description = attributes['Description'].get('value', None)
|
549
563
|
display_name = attributes.get('Display Name', {}).get('value', "None Found")
|
550
|
-
|
551
|
-
anchor_guid = attributes.get('Anchor ID', {}).get('guid', None)
|
552
|
-
parent_guid = attributes.get('Parent ID', {}).get('guid', None)
|
553
|
-
parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value',
|
554
|
-
"CollectionMembership")
|
555
|
-
parent_at_end1 = attributes.get('Parent at End1', {}).get('value', True)
|
556
|
-
|
557
|
-
anchor_scope_guid = attributes.get('Anchor Scope GUID', {}).get('value', None)
|
558
|
-
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', True)
|
559
|
-
if parent_guid is None:
|
560
|
-
is_own_anchor = True
|
561
|
-
collection_type = attributes.get('Collection Type', {}).get('value', None)
|
562
|
-
replace_all_props = not attributes.get('Merge Update', {}).get('value', True)
|
563
|
-
|
564
|
-
additional_prop = attributes.get('Additional Properties', {}).get('value', None)
|
565
|
-
additional_properties = json.loads(additional_prop) if additional_prop is not None else None
|
566
|
-
extended_prop = attributes.get('Extended Properties', {}).get('value', None)
|
567
|
-
extended_properties = json.loads(extended_prop) if extended_prop is not None else None
|
564
|
+
status = attributes.get('Status', {}).get('value', None)
|
568
565
|
|
569
566
|
if directive == "display":
|
567
|
+
|
570
568
|
return None
|
571
569
|
elif directive == "validate":
|
572
570
|
if valid:
|
@@ -579,54 +577,65 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
579
577
|
|
580
578
|
try:
|
581
579
|
if object_action == "Update":
|
582
|
-
|
583
580
|
if not exists:
|
584
|
-
|
585
|
-
|
581
|
+
msg = (f" Element `{display_name}` does not exist! Updating result document with Create "
|
582
|
+
f"object_action\n")
|
583
|
+
logger.error(msg)
|
586
584
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
587
585
|
elif not valid:
|
588
|
-
logger.error(f"Element `{display_name}` does not have a valid specification? Review..\n\n___ ")
|
589
586
|
return None
|
590
587
|
else:
|
591
588
|
print(Markdown(
|
592
|
-
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)
|
593
597
|
|
594
|
-
egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
|
595
|
-
additional_properties,
|
596
|
-
extended_properties, replace_all_props)
|
597
598
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
598
599
|
update_element_dictionary(qualified_name, {
|
599
600
|
'guid': guid, 'display_name': display_name
|
600
|
-
|
601
|
-
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')
|
602
604
|
|
603
605
|
elif object_action == "Create":
|
604
606
|
if valid is False and exists:
|
605
|
-
|
606
|
-
|
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)
|
607
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
|
608
615
|
else:
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
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)
|
615
624
|
if guid:
|
616
625
|
update_element_dictionary(qualified_name, {
|
617
626
|
'guid': guid, 'display_name': display_name
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
return egeria_client.get_collection_by_guid(guid,
|
622
|
-
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')
|
623
631
|
else:
|
624
|
-
|
632
|
+
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
633
|
+
logger.error(msg)
|
625
634
|
return None
|
626
635
|
|
636
|
+
|
627
637
|
except Exception as e:
|
628
|
-
logger.error(f"
|
629
|
-
Console().print_exception(show_locals=True)
|
638
|
+
logger.error(f"Error performing {command}: {e}")
|
630
639
|
return None
|
631
640
|
else:
|
632
641
|
return None
|
@@ -657,7 +666,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
657
666
|
qualified_name = parsed_output.get('qualified_name', None)
|
658
667
|
guid = parsed_output.get('guid', None)
|
659
668
|
|
660
|
-
|
669
|
+
|
661
670
|
|
662
671
|
if directive == "display":
|
663
672
|
return None
|
@@ -817,38 +826,6 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
817
826
|
elif directive == "process":
|
818
827
|
logger.debug(json.dumps(parsed_output, indent=4))
|
819
828
|
|
820
|
-
external_source_guid = attributes.get('External Source Name', {}).get('guid', None)
|
821
|
-
external_source_name = attributes.get('External Source Name', {}).get('value', None)
|
822
|
-
effective_time = attributes.get('Effective Time', {}).get('value', None)
|
823
|
-
for_lineage = attributes.get('For Lineage', {}).get('value', None)
|
824
|
-
for_duplicate_processing = attributes.get('For Duplicate Processing', {}).get('value', None)
|
825
|
-
anchor_guid = attributes.get('Anchor ID', {}).get('guid', None)
|
826
|
-
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', None)
|
827
|
-
# parent_id = attributes.get('Parent ID', {}).get('value', None)
|
828
|
-
# parent_guid = attributes['Parent ID'].get('guid', None)
|
829
|
-
# parent_relationship_type_name = attributes.get('Parent Relationship Type Name', {}).get('value', None)
|
830
|
-
# parent_relationship_properties = attributes.get('Parent Relationship Properties',{}).get('value', None)
|
831
|
-
# parent_at_end1 = attributes.get('Parent at End1', {}).get('value', None)
|
832
|
-
|
833
|
-
namespace = attributes.get('Namespace', {}).get('value', None)
|
834
|
-
description = attributes.get('Description', {}).get('value', None)
|
835
|
-
version_id = attributes.get('Version Identifier', {}).get('value', None)
|
836
|
-
aliases = attributes.get('Aliases', {}).get('value', None)
|
837
|
-
name_patterns = attributes.get('Name Patterns', {}).get('value', None)
|
838
|
-
is_nullable = attributes.get('Is Nullable', {}).get('value', None)
|
839
|
-
default_value = attributes.get('Default Value', {}).get('value', None)
|
840
|
-
data_type = attributes.get('Data Type', {}).get('value', None)
|
841
|
-
min_length = attributes.get('Minimum Length', {}).get('value', None)
|
842
|
-
length = attributes.get('Length', {}).get('value', None)
|
843
|
-
precision = attributes.get('Precision', {}).get('value', None)
|
844
|
-
ordered_values = attributes.get('Ordered Values', {}).get('value', None)
|
845
|
-
sort_order = attributes.get('Sort Order', {}).get('value', None)
|
846
|
-
additional_properties = attributes.get('Additional Properties', {}).get('value', None)
|
847
|
-
effective_from = attributes.get('Effective From', {}).get('value', None)
|
848
|
-
effective_to = attributes.get('Effective To', {}).get('value', None)
|
849
|
-
|
850
|
-
glossary_term = attributes['Glossary Term'].get('value', None)
|
851
|
-
glossary_term_guid = attributes['Glossary Term'].get('guid', None)
|
852
829
|
|
853
830
|
merge_update = attributes.get('Merge Update', {}).get('value', None)
|
854
831
|
|
@@ -862,13 +839,11 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
862
839
|
|
863
840
|
data_class = attributes.get('Data Class', {}).get('value', None)
|
864
841
|
data_class_guid = attributes.get('Data Class', {}).get('guid', None)
|
865
|
-
|
842
|
+
glossary_term = attributes.get('Glossary Term', {}).get('value', None)
|
866
843
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
867
844
|
if glossary_term_guid:
|
868
845
|
glossary_term_guid = [glossary_term_guid]
|
869
846
|
|
870
|
-
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
871
|
-
|
872
847
|
# name_details_list = attributes.get("dict_list", None)
|
873
848
|
|
874
849
|
in_data_spec = attributes.get("In Data Specification", {}).get("value", None) # this is a [dict]
|
@@ -900,6 +875,8 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
900
875
|
else:
|
901
876
|
print(Markdown(f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
902
877
|
|
878
|
+
props_body = set_data_field_body(object_type, qualified_name, attributes)
|
879
|
+
|
903
880
|
try:
|
904
881
|
if object_action == "Update":
|
905
882
|
if not exists:
|
@@ -908,29 +885,15 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
908
885
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
909
886
|
|
910
887
|
# first update the base data field
|
911
|
-
body =
|
912
|
-
|
913
|
-
|
914
|
-
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing, "properties": {
|
915
|
-
"class": "DataFieldProperties", "qualifiedName": qualified_name, "displayName": display_name,
|
916
|
-
"namespace": namespace, "description": description, "versionIdentifier": version_id,
|
917
|
-
"aliases": aliases, "namePatterns": name_patterns, "isDeprecated": False,
|
918
|
-
"isNullable": is_nullable, "defaultValue": default_value, "dataType": data_type,
|
919
|
-
"minimumLength": min_length, "length": length, "precision": precision,
|
920
|
-
"orderedValues": ordered_values, "sortOrder": sort_order,
|
921
|
-
"additionalProperties": additional_properties, "effectiveFrom": effective_from,
|
922
|
-
"effectiveTo": effective_to
|
923
|
-
}
|
924
|
-
}
|
925
|
-
|
926
|
-
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)
|
927
891
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}")
|
928
892
|
# Update data dictionary membership
|
929
893
|
update_element_dictionary(qualified_name, {
|
930
894
|
'guid': guid, 'display_name': display_name
|
931
895
|
})
|
932
|
-
core_props = egeria_client.
|
933
|
-
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?
|
934
897
|
|
935
898
|
# existing_data_field = egeria_client.get_data_field_by_guid(guid, output_format='JSON')
|
936
899
|
|
@@ -961,17 +924,10 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
961
924
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
962
925
|
else:
|
963
926
|
# First lets create the data field
|
964
|
-
body =
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
"versionIdentifier": version_id, "aliases": aliases, "namePatterns": name_patterns,
|
969
|
-
"isDeprecated": False, "isNullable": is_nullable, "defaultValue": default_value,
|
970
|
-
"dataType": data_type, "minimumLength": min_length, "length": length,
|
971
|
-
"precision": precision, "orderedValues": ordered_values, "sortOrder": sort_order,
|
972
|
-
"additionalProperties": additional_properties
|
973
|
-
}
|
974
|
-
}
|
927
|
+
body = set_create_body(object_type, attributes)
|
928
|
+
body['properties'] = props_body
|
929
|
+
parent_guid = body.get('parentGuid', None)
|
930
|
+
|
975
931
|
guid = egeria_client.create_data_field(body)
|
976
932
|
if guid:
|
977
933
|
# Now update our element dictionary with the new information
|
@@ -979,7 +935,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
979
935
|
'guid': guid, 'display_name': display_name
|
980
936
|
})
|
981
937
|
# Start assembling the information we will present back out
|
982
|
-
core_props = egeria_client.get_data_field_by_guid(guid,
|
938
|
+
core_props = egeria_client.get_data_field_by_guid(guid, 'MD')
|
983
939
|
|
984
940
|
# Add the field to any data dictionaries
|
985
941
|
if in_data_dictionary:
|
@@ -992,27 +948,27 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
992
948
|
core_props += f"\n\n## In Data Structure\n\n{in_data_structure_names}\n\n"
|
993
949
|
for ds_guid in data_structure_guid_list:
|
994
950
|
# todo This is too naive? - need to better accommodate the relationship
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
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
|
1001
958
|
|
1002
959
|
msg = f"Adding field to structure {ds_guid}"
|
1003
960
|
logger.info(msg)
|
1004
|
-
egeria_client.link_member_data_field(ds_guid, guid,
|
961
|
+
egeria_client.link_member_data_field(ds_guid, guid, body)
|
1005
962
|
core_props += f"\n\n## In Data Structure {in_data_structure_names}\n\n"
|
1006
963
|
|
1007
964
|
if glossary_term:
|
1008
965
|
if glossary_term_guid:
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
}
|
966
|
+
term_body = set_rel_prop_body("GlossaryTermProperties", attributes)
|
967
|
+
body = set_rel_request_body(object_type, attributes)
|
968
|
+
body['properties'] = term_body
|
969
|
+
|
1014
970
|
core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
|
1015
|
-
egeria_client.link_semantic_definition(guid, glossary_term_guid,
|
971
|
+
egeria_client.link_semantic_definition(guid, glossary_term_guid, term_body)
|
1016
972
|
|
1017
973
|
if parent_data_field_guids:
|
1018
974
|
# parent_df_body = {
|
@@ -1028,11 +984,11 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1028
984
|
|
1029
985
|
# Link data class
|
1030
986
|
if data_class:
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
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"
|
1036
992
|
egeria_client.link_data_class_definition(guid, data_class_guid, body)
|
1037
993
|
msg = f"Adding data class `{data_class}` to data field {display_name}"
|
1038
994
|
logger.info(msg)
|
@@ -1305,294 +1261,3 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1305
1261
|
else:
|
1306
1262
|
return None
|
1307
1263
|
|
1308
|
-
|
1309
|
-
@logger.catch
|
1310
|
-
def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1311
|
-
str]:
|
1312
|
-
"""
|
1313
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1314
|
-
search string from the given text.
|
1315
|
-
|
1316
|
-
:param txt: A string representing the input cell to be processed for
|
1317
|
-
extracting term-related attributes.
|
1318
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1319
|
-
:return: A string summarizing the outcome of the processing.
|
1320
|
-
"""
|
1321
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1322
|
-
print(Markdown(f"# {command}\n"))
|
1323
|
-
if object_type in ["Data Dictionary", "Data Dictionaries", "DataDict", "DataDictionary"]:
|
1324
|
-
col_type = "DataDictionary"
|
1325
|
-
elif object_type in ["Data Specification", "Data Specifications", "Data Specs"]:
|
1326
|
-
col_type = "DataSpec"
|
1327
|
-
else:
|
1328
|
-
col_type = "Collection"
|
1329
|
-
|
1330
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
valid = parsed_output['valid']
|
1335
|
-
print(Markdown(f"Performing {command}"))
|
1336
|
-
print(Markdown(parsed_output['display']))
|
1337
|
-
|
1338
|
-
attr = parsed_output.get('attributes',{})
|
1339
|
-
effective_time = attr.get('effectiveTime', {}).get('value', None)
|
1340
|
-
as_of_time = attr.get('asOfTime', {}).get('value', None)
|
1341
|
-
for_duplicate_processing = attr.get('forDuplicateProcessing', {}).get('value', False)
|
1342
|
-
for_lineage = attr.get('forLineage',{}).get('value', False)
|
1343
|
-
limit_result_by_status = attr.get('limitResultsByStatus',{}).get('value', ['ACTIVE'])
|
1344
|
-
sequencing_property = attr.get('sequencingProperty',{}).get('value',"qualifiedName" )
|
1345
|
-
sequencing_order = attr.get('sequencingOrder',{}).get('value', "PROPERTY_ASCENDING")
|
1346
|
-
search_string = attr.get('Search String', {}).get('value', '*')
|
1347
|
-
output_format = attr.get('Output Format', {}).get('value', 'LIST')
|
1348
|
-
detailed = attr.get('Detailed', {}).get('value', False)
|
1349
|
-
|
1350
|
-
if directive == "display":
|
1351
|
-
return None
|
1352
|
-
elif directive == "validate":
|
1353
|
-
if valid:
|
1354
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1355
|
-
else:
|
1356
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1357
|
-
logger.error(msg)
|
1358
|
-
return valid
|
1359
|
-
|
1360
|
-
elif directive == "process":
|
1361
|
-
try:
|
1362
|
-
if not valid: # First validate the command before we process it
|
1363
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1364
|
-
logger.error(msg)
|
1365
|
-
return None
|
1366
|
-
|
1367
|
-
list_md = f"\n# `{col_type}` with filter: `{search_string}`\n\n"
|
1368
|
-
body = {
|
1369
|
-
"class": "FilterRequestBody",
|
1370
|
-
"asOfTime": as_of_time,
|
1371
|
-
"effectiveTime": effective_time,
|
1372
|
-
"forLineage": for_lineage,
|
1373
|
-
"forDuplicateProcessing": for_duplicate_processing,
|
1374
|
-
"limitResultsByStatus": limit_result_by_status,
|
1375
|
-
"sequencingOrder": sequencing_order,
|
1376
|
-
"sequencingProperty": sequencing_property,
|
1377
|
-
"filter": search_string,
|
1378
|
-
}
|
1379
|
-
|
1380
|
-
struct = egeria_client.find_collections_w_body(body, col_type, output_format=output_format)
|
1381
|
-
if output_format == "DICT":
|
1382
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1383
|
-
else:
|
1384
|
-
list_md += struct
|
1385
|
-
logger.info(f"Wrote `{col_type}` for search string: `{search_string}`")
|
1386
|
-
|
1387
|
-
return list_md
|
1388
|
-
|
1389
|
-
except Exception as e:
|
1390
|
-
logger.error(f"Error performing {command}: {e}")
|
1391
|
-
console.print_exception(show_locals=True)
|
1392
|
-
return None
|
1393
|
-
else:
|
1394
|
-
return None
|
1395
|
-
|
1396
|
-
|
1397
|
-
def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str,
|
1398
|
-
directive: str = "display") -> Optional[
|
1399
|
-
str]:
|
1400
|
-
"""
|
1401
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1402
|
-
search string from the given text.
|
1403
|
-
|
1404
|
-
:param txt: A string representing the input cell to be processed for
|
1405
|
-
extracting term-related attributes.
|
1406
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1407
|
-
:return: A string summarizing the outcome of the processing.
|
1408
|
-
"""
|
1409
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1410
|
-
print(Markdown(f"# {command}\n"))
|
1411
|
-
|
1412
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1413
|
-
|
1414
|
-
attributes = parsed_output['attributes']
|
1415
|
-
|
1416
|
-
valid = parsed_output['valid']
|
1417
|
-
print(Markdown(f"Performing {command}"))
|
1418
|
-
print(Markdown(parsed_output['display']))
|
1419
|
-
|
1420
|
-
if directive == "display":
|
1421
|
-
return None
|
1422
|
-
elif directive == "validate":
|
1423
|
-
if valid:
|
1424
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1425
|
-
else:
|
1426
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1427
|
-
logger.error(msg)
|
1428
|
-
return valid
|
1429
|
-
|
1430
|
-
elif directive == "process":
|
1431
|
-
attributes = parsed_output['attributes']
|
1432
|
-
body = set_find_body(object_type, attributes)
|
1433
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1434
|
-
output_format_set = attributes.get('Output Format Set', {}).get('value', 'Data Structure')
|
1435
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1436
|
-
|
1437
|
-
try:
|
1438
|
-
if not valid: # First validate the command before we process it
|
1439
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1440
|
-
logger.error(msg)
|
1441
|
-
return None
|
1442
|
-
|
1443
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1444
|
-
struct = egeria_client.find_data_structures(search_string, body = body, output_format=output_format, output_format_set=output_format_set )
|
1445
|
-
|
1446
|
-
if output_format == "DICT":
|
1447
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1448
|
-
else:
|
1449
|
-
list_md += struct
|
1450
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1451
|
-
|
1452
|
-
return list_md
|
1453
|
-
|
1454
|
-
except Exception as e:
|
1455
|
-
logger.error(f"Error performing {command}: {e}")
|
1456
|
-
console.print_exception(show_locals=True)
|
1457
|
-
return None
|
1458
|
-
else:
|
1459
|
-
return None
|
1460
|
-
|
1461
|
-
|
1462
|
-
def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1463
|
-
"""
|
1464
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1465
|
-
search string from the given text.
|
1466
|
-
|
1467
|
-
:param txt: A string representing the input cell to be processed for
|
1468
|
-
extracting term-related attributes.
|
1469
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1470
|
-
:return: A string summarizing the outcome of the processing.
|
1471
|
-
"""
|
1472
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1473
|
-
print(Markdown(f"# {command}\n"))
|
1474
|
-
|
1475
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1476
|
-
|
1477
|
-
attributes = parsed_output['attributes']
|
1478
|
-
|
1479
|
-
valid = parsed_output['valid']
|
1480
|
-
print(Markdown(f"Performing {command}"))
|
1481
|
-
print(Markdown(parsed_output['display']))
|
1482
|
-
|
1483
|
-
if directive == "display":
|
1484
|
-
return None
|
1485
|
-
elif directive == "validate":
|
1486
|
-
if valid:
|
1487
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1488
|
-
else:
|
1489
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1490
|
-
logger.error(msg)
|
1491
|
-
return valid
|
1492
|
-
|
1493
|
-
elif directive == "process":
|
1494
|
-
attributes = parsed_output['attributes']
|
1495
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1496
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1497
|
-
detailed = attributes.get('Detailed', {}).get('value', False)
|
1498
|
-
as_of_time = attributes.get('AsOfTime', {}).get('value', None)
|
1499
|
-
effective_time = attributes.get('Effective Time', {}).get('value', None)
|
1500
|
-
sort_order = attributes.get('Sort Order', {}).get('value', None)
|
1501
|
-
order_property = attributes.get('Order Property', {}).get('value', None)
|
1502
|
-
starts_with = attributes.get('Start With', {}).get('value', True)
|
1503
|
-
ends_with = attributes.get('End With', {}).get('value', False)
|
1504
|
-
ignore_case = attributes.get('Ignore Case', {}).get('value', False)
|
1505
|
-
start_from = attributes.get('Start From', {}).get('value', 0)
|
1506
|
-
page_size = attributes.get('Page Size', {}).get('value', None)
|
1507
|
-
|
1508
|
-
try:
|
1509
|
-
if not valid: # First validate the command before we process it
|
1510
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1511
|
-
logger.error(msg)
|
1512
|
-
return None
|
1513
|
-
|
1514
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1515
|
-
body = {
|
1516
|
-
"class": "FilterRequestBody", "asOfTime": as_of_time, "effectiveTime": effective_time,
|
1517
|
-
"forLineage": False, "forDuplicateProcessing": False, "limitResultsByStatus": ["ACTIVE"],
|
1518
|
-
"sequencingOrder": sort_order, "sequencingProperty": order_property, "filter": search_string,
|
1519
|
-
}
|
1520
|
-
struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with, ends_with,
|
1521
|
-
ignore_case, output_format)
|
1522
|
-
|
1523
|
-
if output_format == "DICT":
|
1524
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1525
|
-
else:
|
1526
|
-
list_md += struct
|
1527
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1528
|
-
|
1529
|
-
return list_md
|
1530
|
-
|
1531
|
-
except Exception as e:
|
1532
|
-
logger.error(f"Error performing {command}: {e}")
|
1533
|
-
console.print_exception(show_locals=True)
|
1534
|
-
return None
|
1535
|
-
else:
|
1536
|
-
return None
|
1537
|
-
|
1538
|
-
|
1539
|
-
def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1540
|
-
"""
|
1541
|
-
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1542
|
-
search string from the given text.
|
1543
|
-
|
1544
|
-
:param txt: A string representing the input cell to be processed for
|
1545
|
-
extracting term-related attributes.
|
1546
|
-
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1547
|
-
:return: A string summarizing the outcome of the processing.
|
1548
|
-
"""
|
1549
|
-
command, object_type, object_action = extract_command_plus(txt)
|
1550
|
-
print(Markdown(f"# {command}\n"))
|
1551
|
-
|
1552
|
-
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1553
|
-
|
1554
|
-
attributes = parsed_output['attributes']
|
1555
|
-
|
1556
|
-
valid = parsed_output['valid']
|
1557
|
-
print(Markdown(f"Performing {command}"))
|
1558
|
-
print(Markdown(parsed_output['display']))
|
1559
|
-
|
1560
|
-
if directive == "display":
|
1561
|
-
return None
|
1562
|
-
elif directive == "validate":
|
1563
|
-
if valid:
|
1564
|
-
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1565
|
-
else:
|
1566
|
-
msg = f"Validation failed for object_action `{command}`\n"
|
1567
|
-
logger.error(msg)
|
1568
|
-
return valid
|
1569
|
-
|
1570
|
-
elif directive == "process":
|
1571
|
-
attributes = parsed_output['attributes']
|
1572
|
-
search_string = attributes.get('Search String', {}).get('value', '*')
|
1573
|
-
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1574
|
-
detailed = attributes.get('Detailed', {}).get('value', False)
|
1575
|
-
|
1576
|
-
try:
|
1577
|
-
if not valid: # First validate the command before we process it
|
1578
|
-
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1579
|
-
logger.error(msg)
|
1580
|
-
return None
|
1581
|
-
|
1582
|
-
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1583
|
-
struct = egeria_client.find_data_classes(search_string, output_format=output_format)
|
1584
|
-
|
1585
|
-
if output_format == "DICT":
|
1586
|
-
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1587
|
-
else:
|
1588
|
-
list_md += struct
|
1589
|
-
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1590
|
-
|
1591
|
-
return list_md
|
1592
|
-
|
1593
|
-
except Exception as e:
|
1594
|
-
logger.error(f"Error performing {command}: {e}")
|
1595
|
-
console.print_exception(show_locals=True)
|
1596
|
-
return None
|
1597
|
-
else:
|
1598
|
-
return None
|