pyegeria 5.3.3.10.dev10__py3-none-any.whl → 5.3.3.12__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.
- pyegeria/__init__.py +4 -3
- pyegeria/commands/{cat/get_information_supply_chains.py → tech/list_information_supply_chains.py} +26 -88
- pyegeria/commands/tech/list_isolution_blueprints.py +166 -0
- pyegeria/commands/tech/list_isolution_blueprints2.py +164 -0
- pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Subject Onboarding.mmd +49 -0
- pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Treatment Validation.mmd +129 -0
- pyegeria/commands/tech/work/mermaid_graphs/Employee Expense Payment.mmd +40 -0
- pyegeria/commands/tech/work/mermaid_graphs/New Drug Product Information Distribution.mmd +55 -0
- pyegeria/commands/tech/work/mermaid_graphs/New Employee Onboarding.mmd +52 -0
- pyegeria/commands/tech/work/mermaid_graphs/Personalized Treatment Ordering.mmd +57 -0
- pyegeria/commands/tech/work/mermaid_graphs/Physical Inventory Tracking.mmd +92 -0
- pyegeria/commands/tech/work/mermaid_graphs/Sustainability Reporting.mmd +117 -0
- pyegeria/commands/tech/work/mermaid_graphs/{{displayName}}.mmd +29 -0
- pyegeria/egeria_client.py +5 -0
- pyegeria/egeria_tech_client.py +5 -5
- pyegeria/mermaid_utilities.py +31 -1
- pyegeria/solution_architect_omvs.py +8 -0
- {pyegeria-5.3.3.10.dev10.dist-info → pyegeria-5.3.3.12.dist-info}/METADATA +1 -1
- {pyegeria-5.3.3.10.dev10.dist-info → pyegeria-5.3.3.12.dist-info}/RECORD +22 -11
- {pyegeria-5.3.3.10.dev10.dist-info → pyegeria-5.3.3.12.dist-info}/entry_points.txt +1 -1
- {pyegeria-5.3.3.10.dev10.dist-info → pyegeria-5.3.3.12.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.3.10.dev10.dist-info → pyegeria-5.3.3.12.dist-info}/WHEEL +0 -0
pyegeria/__init__.py
CHANGED
@@ -68,14 +68,15 @@ from .create_tech_guid_lists import build_global_guid_lists
|
|
68
68
|
from .classification_manager_omvs import ClassificationManager
|
69
69
|
from .feedback_manager_omvs import FeedbackManager
|
70
70
|
from .metadata_explorer_omvs import MetadataExplorer
|
71
|
-
from .mermaid_utilities import load_mermaid, render_mermaid, generate_process_graph
|
71
|
+
from .mermaid_utilities import load_mermaid, render_mermaid, generate_process_graph, save_mermaid_graph
|
72
72
|
from .egeria_my_client import EgeriaMy
|
73
|
+
|
74
|
+
from .solution_architect_omvs import SolutionArchitect
|
75
|
+
|
73
76
|
from .egeria_cat_client import EgeriaCat
|
74
77
|
from .egeria_tech_client import EgeriaTech
|
75
78
|
from .egeria_config_client import EgeriaConfig
|
76
79
|
from .egeria_client import Egeria
|
77
|
-
from .solution_architect_omvs import SolutionArchitect
|
78
|
-
|
79
80
|
|
80
81
|
#
|
81
82
|
# The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
|
pyegeria/commands/{cat/get_information_supply_chains.py → tech/list_information_supply_chains.py}
RENAMED
@@ -24,7 +24,7 @@ from pyegeria import (
|
|
24
24
|
ProjectManager,
|
25
25
|
UserNotAuthorizedException,
|
26
26
|
PropertyServerException,
|
27
|
-
InvalidParameterException,
|
27
|
+
InvalidParameterException, save_mermaid_graph,
|
28
28
|
)
|
29
29
|
|
30
30
|
from pyegeria._exceptions import (
|
@@ -45,8 +45,8 @@ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
|
45
45
|
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
46
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
47
|
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
-
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "
|
49
|
-
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
|
49
|
+
EGERIA_MERMAID_FOLDER = os.environ.get("EGERIA_MERMAID_FOLDER", "./work/mermaid_graphs")
|
50
50
|
|
51
51
|
def supply_chain_viewer(
|
52
52
|
search_string: str,
|
@@ -59,8 +59,10 @@ def supply_chain_viewer(
|
|
59
59
|
timeout: int = 30,
|
60
60
|
):
|
61
61
|
"""A Supply Chain viewer"""
|
62
|
+
client = SolutionArchitect(server_name, platform_url, user, user_password)
|
63
|
+
token = client.create_egeria_bearer_token()
|
62
64
|
|
63
|
-
def
|
65
|
+
def generate_table() -> Table | str:
|
64
66
|
table = Table(
|
65
67
|
title=f"Supply Chains matching {search_string} @ {time.asctime()}",
|
66
68
|
style="bright_white on black",
|
@@ -73,110 +75,46 @@ def supply_chain_viewer(
|
|
73
75
|
expand=True,
|
74
76
|
)
|
75
77
|
table.add_column("Supply Chain Name")
|
76
|
-
table.add_column("Qualified Name
|
77
|
-
table.add_column("
|
78
|
-
table.add_column("Scope")
|
78
|
+
table.add_column("Qualified Name \n/\n GUID", width=38, no_wrap=False)
|
79
|
+
table.add_column("Purposes")
|
80
|
+
table.add_column("Scope\n/\n Mermaid Link")
|
79
81
|
table.add_column("Description")
|
80
82
|
|
83
|
+
supply_chains = client.find_information_supply_chains(search_string)
|
84
|
+
if isinstance(supply_chains, list) is False:
|
85
|
+
return "No Supply Chains found"
|
86
|
+
|
81
87
|
for sc in supply_chains:
|
82
88
|
sc_name = sc["properties"].get("displayName", '---')
|
83
89
|
sc_qname = sc["properties"].get("qualifiedName", '---')
|
84
90
|
sc_guid = sc["elementHeader"]["guid"]
|
85
91
|
sc_purpose = sc["properties"].get("purposes",'---')
|
86
92
|
if isinstance(sc_purpose, list):
|
87
|
-
sc_purpose_str = "\n".join(sc_purpose)
|
93
|
+
sc_purpose_str = "\n* ".join(sc_purpose)
|
88
94
|
else:
|
89
95
|
sc_purpose_str = sc_purpose
|
90
96
|
sc_scope = sc["properties"].get("scope",'---')
|
91
97
|
sc_desc = sc["properties"].get("description",'---')
|
92
|
-
sc_unique_name =
|
98
|
+
sc_unique_name = f"{sc_qname}\n\n\t\t/\n\n{sc_guid}"
|
99
|
+
sc_mermaid = sc.get("mermaidGraph",'---')
|
100
|
+
if sc_mermaid != '---':
|
101
|
+
link = save_mermaid_graph(sc_name, sc_mermaid, EGERIA_MERMAID_FOLDER )
|
102
|
+
sc_mermaid_link = f"[link=file://:{link}]file://:{link}[/link])"
|
103
|
+
# sc_scope = Text(f"{sc_scope}\n\t\t/\n{sc_mermaid_link}")
|
104
|
+
sc_scope = Text(f"{sc_scope}\n\t\t/\n{sc_mermaid_link}", style="underline")
|
105
|
+
sc_scope.stylize("link " + sc_mermaid_link)
|
106
|
+
|
93
107
|
table.add_row(sc_name, sc_unique_name, sc_purpose_str, sc_scope, sc_desc)
|
94
108
|
|
95
109
|
return table
|
96
110
|
|
97
111
|
|
98
|
-
|
99
|
-
project_client: ProjectManager,
|
100
|
-
project_name: str,
|
101
|
-
tree: Tree,
|
102
|
-
root: bool = False,
|
103
|
-
) -> None:
|
104
|
-
"""Recursively build a Tree with collection contents."""
|
105
|
-
t = None
|
106
|
-
style = "bright_white on black"
|
107
|
-
|
108
|
-
project = project_client.get_projects_by_name(project_name)
|
109
|
-
if type(project) is list:
|
110
|
-
proj_guid = project[0]["elementHeader"]["guid"]
|
111
|
-
proj_props = project[0]["properties"]
|
112
|
-
|
113
|
-
proj_type = proj_props.get("typeName", "---")
|
114
|
-
proj_unique = proj_props.get("qualifiedName", "---")
|
115
|
-
proj_identifier = proj_props.get("identifier", "---")
|
116
|
-
proj_name = proj_props.get("name", "---")
|
117
|
-
proj_desc = proj_props.get("description", "---")
|
118
|
-
proj_status = proj_props.get("projectStatus", "---")
|
119
|
-
proj_priority = proj_props.get("priority", "---")
|
120
|
-
proj_start = proj_props.get("startDate", "---")[:-10]
|
121
|
-
proj_props_md = (
|
122
|
-
f"* Name: {proj_name}\n"
|
123
|
-
f"* Identifier: {proj_identifier}\n"
|
124
|
-
f"* Type: {proj_type}\n"
|
125
|
-
f"* Status: {proj_status}\n"
|
126
|
-
f"* priority: {proj_priority}\n"
|
127
|
-
f"* Start: {proj_start}\n"
|
128
|
-
f"* Description: {proj_desc}\n"
|
129
|
-
f"* GUID: {proj_guid}"
|
130
|
-
)
|
131
|
-
else:
|
132
|
-
return
|
133
|
-
|
134
|
-
team = project_client.get_project_team(proj_guid)
|
135
|
-
member_md = ""
|
136
|
-
if type(team) is list:
|
137
|
-
for member in team:
|
138
|
-
member_guid = member["member"]["guid"]
|
139
|
-
member_unique = member["member"]["uniqueName"]
|
140
|
-
member_md += f"* Member Unique Name: {member_unique}\n* Member GUID: {member_guid}"
|
141
|
-
proj_props_md += f"\n### Team Members\n {member_md}"
|
142
|
-
|
143
|
-
proj_props_out = Markdown(proj_props_md)
|
144
|
-
p = Panel.fit(proj_props_out, style=style, title=project_name)
|
145
|
-
t = tree.add(p)
|
146
|
-
|
147
|
-
linked_projects = project_client.get_linked_projects(proj_guid)
|
148
|
-
if type(linked_projects) is list:
|
149
|
-
for proj in linked_projects:
|
150
|
-
child_md = ""
|
151
|
-
child_guid = proj["elementHeader"]["guid"]
|
152
|
-
child_name = proj["properties"]["name"]
|
153
|
-
relationship = proj["relatedElement"]["relationshipHeader"]["type"][
|
154
|
-
"typeName"
|
155
|
-
]
|
156
|
-
if relationship != "ProjectDependency":
|
157
|
-
continue
|
158
|
-
walk_project_hierarchy(project_client, child_name, t)
|
159
|
-
|
160
|
-
else:
|
161
|
-
return t
|
112
|
+
|
162
113
|
|
163
114
|
try:
|
164
115
|
console = Console(width=width, force_terminal=not jupyter)
|
165
|
-
|
166
|
-
|
167
|
-
)
|
168
|
-
client = SolutionArchitect(server_name, platform_url, user, user_password)
|
169
|
-
|
170
|
-
token = client.create_egeria_bearer_token()
|
171
|
-
|
172
|
-
sc = client.find_information_supply_chains(search_string, start_from=0)
|
173
|
-
|
174
|
-
if (isinstance(sc, list)):
|
175
|
-
t = tree.add(display_supply_chains(sc))
|
176
|
-
else:
|
177
|
-
t = tree.add(type(sc))
|
178
|
-
# walk_project_hierarchy(p_client, root, tree, root=True)
|
179
|
-
print(tree)
|
116
|
+
with console.pager():
|
117
|
+
console.print(generate_table())
|
180
118
|
|
181
119
|
except (
|
182
120
|
InvalidParameterException,
|
@@ -0,0 +1,166 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for Information Supply Chains
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
import time
|
13
|
+
|
14
|
+
from rich import print, box
|
15
|
+
from rich.console import Console
|
16
|
+
from rich.markdown import Markdown
|
17
|
+
from rich.panel import Panel
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
from rich.text import Text
|
21
|
+
from rich.tree import Tree
|
22
|
+
from pyegeria.solution_architect_omvs import SolutionArchitect
|
23
|
+
from pyegeria import (
|
24
|
+
ProjectManager,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
PropertyServerException,
|
27
|
+
InvalidParameterException,
|
28
|
+
)
|
29
|
+
|
30
|
+
from pyegeria._exceptions import (
|
31
|
+
print_exception_response,
|
32
|
+
)
|
33
|
+
|
34
|
+
disable_ssl_warnings = True
|
35
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
36
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
37
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
38
|
+
EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "qs-view-server")
|
39
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
40
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
41
|
+
)
|
42
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
43
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
44
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
45
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
|
49
|
+
|
50
|
+
|
51
|
+
def blueprint_list(
|
52
|
+
search_string: str,
|
53
|
+
server_name: str,
|
54
|
+
platform_url: str,
|
55
|
+
user: str,
|
56
|
+
user_password: str,
|
57
|
+
jupyter: bool = EGERIA_JUPYTER,
|
58
|
+
width: int = EGERIA_WIDTH,
|
59
|
+
timeout: int = 30,
|
60
|
+
):
|
61
|
+
"""A Supply Chain viewer"""
|
62
|
+
client = SolutionArchitect(server_name, platform_url, user, user_password)
|
63
|
+
token = client.create_egeria_bearer_token()
|
64
|
+
|
65
|
+
def generate_table() -> Table | str:
|
66
|
+
table = Table(
|
67
|
+
title=f"Blueprints matching {search_string} @ {time.asctime()}",
|
68
|
+
style="bright_white on black",
|
69
|
+
header_style="bright_white on dark_blue",
|
70
|
+
title_style="bold white on black",
|
71
|
+
caption_style="white on black",
|
72
|
+
show_lines=True,
|
73
|
+
box=box.ROUNDED,
|
74
|
+
caption=f"View Server '{server_name}' @ Platform - {platform_url}",
|
75
|
+
expand=True,
|
76
|
+
)
|
77
|
+
table.add_column("Blueprint Name")
|
78
|
+
table.add_column("Qualified Name \n/\n GUID\n/\nVersion", width=38, no_wrap=False)
|
79
|
+
table.add_column("Description")
|
80
|
+
table.add_column("Solution Components")
|
81
|
+
|
82
|
+
blueprints = client.find_solution_blueprints(search_string)
|
83
|
+
if isinstance(blueprints, list) is False:
|
84
|
+
return "No Blueprints found"
|
85
|
+
|
86
|
+
for bp in blueprints:
|
87
|
+
bp_name = bp["properties"].get("displayName", '---')
|
88
|
+
bp_qname = bp["properties"].get("qualifiedName", '---')
|
89
|
+
bp_guid = bp["elementHeader"]["guid"]
|
90
|
+
bp_desc = bp["properties"].get("description",'---')
|
91
|
+
bp_unique_name = f"{bp_qname}\n\n\t\t/\n\n{bp_guid}"
|
92
|
+
bp_mermaid = bp.get("mermaid",'---')
|
93
|
+
|
94
|
+
bp_components = bp.get("solutionComponents",[])
|
95
|
+
comp_table = Table(title="No Solution Components")
|
96
|
+
for component in bp_components:
|
97
|
+
comp = component.get("solutionComponent","")
|
98
|
+
if isinstance(comp,dict) is False:
|
99
|
+
continue
|
100
|
+
comp_props = comp.get("properties",{})
|
101
|
+
comp_name = comp_props.get("displayName",'---')
|
102
|
+
comp_description = comp_props.get("description",'---')
|
103
|
+
comp_planned = comp_props['extendedProperties'].get("plannedDeployedImplementationType",'---')
|
104
|
+
comp_type = comp_props.get('solutionComponentType','---')
|
105
|
+
comp_actors = comp_props.get('actors', [])
|
106
|
+
comp_actors_list = ""
|
107
|
+
for actor in comp_actors:
|
108
|
+
comp_actor_role = actor['relationshipProperties'].get('role','---')
|
109
|
+
comp_actor_props = actor['relatedElement'].get('properties',{})
|
110
|
+
comp_actor_props_md = f"* Role: {comp_actor_role}\n"
|
111
|
+
for prop in comp_actor_props.keys():
|
112
|
+
comp_actor_props_md += f"* {prop}: {comp_actor_props[prop]}\n"
|
113
|
+
comp_actors_list += comp_actor_props_md
|
114
|
+
|
115
|
+
comp_table = Table(title=f"Solution Component {comp_name}")
|
116
|
+
comp_table.add_column("Comp Type")
|
117
|
+
comp_table.add_column("Description")
|
118
|
+
comp_table.add_column("Planned Deployment")
|
119
|
+
comp_table.add_column("Actors")
|
120
|
+
comp_table.add_row(comp_type, comp_description, comp_planned, comp_actors_list)
|
121
|
+
|
122
|
+
table.add_row(bp_name, bp_unique_name, bp_desc, comp_table)
|
123
|
+
|
124
|
+
return table
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
try:
|
130
|
+
console = Console(width=width, force_terminal=not jupyter)
|
131
|
+
with console.pager():
|
132
|
+
console.print(generate_table())
|
133
|
+
|
134
|
+
except (
|
135
|
+
InvalidParameterException,
|
136
|
+
PropertyServerException,
|
137
|
+
UserNotAuthorizedException,
|
138
|
+
) as e:
|
139
|
+
print_exception_response(e)
|
140
|
+
|
141
|
+
|
142
|
+
def main():
|
143
|
+
parser = argparse.ArgumentParser()
|
144
|
+
|
145
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
146
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
147
|
+
parser.add_argument("--userid", help="User Id")
|
148
|
+
parser.add_argument("--password", help="User Password")
|
149
|
+
args = parser.parse_args()
|
150
|
+
|
151
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
152
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
153
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
154
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
155
|
+
|
156
|
+
try:
|
157
|
+
search_string = Prompt.ask(
|
158
|
+
"Enter a search string:", default="*"
|
159
|
+
)
|
160
|
+
blueprint_list(search_string, server, url, userid, user_pass)
|
161
|
+
except KeyboardInterrupt:
|
162
|
+
pass
|
163
|
+
|
164
|
+
|
165
|
+
if __name__ == "__main__":
|
166
|
+
main()
|
@@ -0,0 +1,164 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for Information Supply Chains
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
import time
|
13
|
+
|
14
|
+
from rich import print, box
|
15
|
+
from rich.console import Console
|
16
|
+
from rich.markdown import Markdown
|
17
|
+
from rich.panel import Panel
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
from rich.text import Text
|
21
|
+
from rich.tree import Tree
|
22
|
+
from pyegeria.solution_architect_omvs import SolutionArchitect
|
23
|
+
from pyegeria import (
|
24
|
+
ProjectManager,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
PropertyServerException,
|
27
|
+
InvalidParameterException,
|
28
|
+
)
|
29
|
+
|
30
|
+
from pyegeria._exceptions import (
|
31
|
+
print_exception_response,
|
32
|
+
)
|
33
|
+
|
34
|
+
disable_ssl_warnings = True
|
35
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
36
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
37
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
38
|
+
EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "qs-view-server")
|
39
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
40
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
41
|
+
)
|
42
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
43
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
44
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
45
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
|
49
|
+
|
50
|
+
|
51
|
+
def blueprint_list(
|
52
|
+
search_string: str,
|
53
|
+
server_name: str,
|
54
|
+
platform_url: str,
|
55
|
+
user: str,
|
56
|
+
user_password: str,
|
57
|
+
jupyter: bool = EGERIA_JUPYTER,
|
58
|
+
width: int = EGERIA_WIDTH,
|
59
|
+
timeout: int = 30,
|
60
|
+
):
|
61
|
+
"""A Supply Chain viewer"""
|
62
|
+
client = SolutionArchitect(server_name, platform_url, user, user_password)
|
63
|
+
token = client.create_egeria_bearer_token()
|
64
|
+
|
65
|
+
def generate_table() -> Table | str:
|
66
|
+
table = Table(
|
67
|
+
title=f"Blueprints matching {search_string} @ {time.asctime()}",
|
68
|
+
style="bright_white on black",
|
69
|
+
header_style="bright_white on dark_blue",
|
70
|
+
title_style="bold white on black",
|
71
|
+
caption_style="white on black",
|
72
|
+
show_lines=True,
|
73
|
+
box=box.ROUNDED,
|
74
|
+
caption=f"View Server '{server_name}' @ Platform - {platform_url}",
|
75
|
+
expand=True,
|
76
|
+
)
|
77
|
+
table.add_column("Blueprint Name")
|
78
|
+
table.add_column("Qualified Name \n/\n GUID\n/\nVersion", width=38, no_wrap=False)
|
79
|
+
table.add_column("Description")
|
80
|
+
table.add_column("Solution Components")
|
81
|
+
|
82
|
+
blueprints = client.find_solution_blueprints(search_string)
|
83
|
+
if isinstance(blueprints, list) is False:
|
84
|
+
return "No Blueprints found"
|
85
|
+
|
86
|
+
for bp in blueprints:
|
87
|
+
bp_name = bp["properties"].get("displayName", '---')
|
88
|
+
bp_qname = bp["properties"].get("qualifiedName", '---')
|
89
|
+
bp_guid = bp["elementHeader"]["guid"]
|
90
|
+
bp_desc = bp["properties"].get("description",'---')
|
91
|
+
bp_unique_name = f"{bp_qname}\n\n\t\t/\n\n{bp_guid}"
|
92
|
+
bp_mermaid = bp.get("mermaid",'---')
|
93
|
+
|
94
|
+
bp_components = bp.get("solutionComponents",[])
|
95
|
+
comp_md=""
|
96
|
+
for component in bp_components:
|
97
|
+
comp = component.get("solutionComponent","")
|
98
|
+
if isinstance(comp,dict) is False:
|
99
|
+
continue
|
100
|
+
comp_props = comp.get("properties",{})
|
101
|
+
comp_name = comp_props.get("displayName",'---')
|
102
|
+
comp_description = comp_props.get("description",'---')
|
103
|
+
comp_planned = comp_props['extendedProperties'].get("plannedDeployedImplementationType",'---')
|
104
|
+
comp_type = comp_props.get('solutionComponentType','---')
|
105
|
+
comp_actors = comp_props.get('actors', [])
|
106
|
+
comp_actors_list = ""
|
107
|
+
for actor in comp_actors:
|
108
|
+
comp_actor_role = actor['relationshipProperties'].get('role','---')
|
109
|
+
comp_actor_props = actor['relatedElement'].get('properties',{})
|
110
|
+
comp_actor_props_md = f"* Role: {comp_actor_role}\n"
|
111
|
+
for prop in comp_actor_props.keys():
|
112
|
+
comp_actor_props_md += f"* {prop}: {comp_actor_props[prop]}\n"
|
113
|
+
comp_actors_list += comp_actor_props_md
|
114
|
+
|
115
|
+
comp_md = f"Solution Component {comp_name}\n\n"
|
116
|
+
comp_md += f"* Description: {comp_description}\n"
|
117
|
+
comp_md += f"* Planned Deployment: {comp_planned}\n"
|
118
|
+
comp_md += f"* Actors: {comp_actors_list}\n---\n"
|
119
|
+
comp_out = Markdown(comp_md)
|
120
|
+
table.add_row(bp_name, bp_unique_name, bp_desc, comp_out)
|
121
|
+
|
122
|
+
return table
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
try:
|
128
|
+
console = Console(width=width, force_terminal=not jupyter)
|
129
|
+
with console.pager():
|
130
|
+
console.print(generate_table())
|
131
|
+
|
132
|
+
except (
|
133
|
+
InvalidParameterException,
|
134
|
+
PropertyServerException,
|
135
|
+
UserNotAuthorizedException,
|
136
|
+
) as e:
|
137
|
+
print_exception_response(e)
|
138
|
+
|
139
|
+
|
140
|
+
def main():
|
141
|
+
parser = argparse.ArgumentParser()
|
142
|
+
|
143
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
144
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
145
|
+
parser.add_argument("--userid", help="User Id")
|
146
|
+
parser.add_argument("--password", help="User Password")
|
147
|
+
args = parser.parse_args()
|
148
|
+
|
149
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
150
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
151
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
152
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
153
|
+
|
154
|
+
try:
|
155
|
+
search_string = Prompt.ask(
|
156
|
+
"Enter a search string:", default="*"
|
157
|
+
)
|
158
|
+
blueprint_list(search_string, server, url, userid, user_pass)
|
159
|
+
except KeyboardInterrupt:
|
160
|
+
pass
|
161
|
+
|
162
|
+
|
163
|
+
if __name__ == "__main__":
|
164
|
+
main()
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div class="mermaid">
|
9
|
+
---
|
10
|
+
title: Information Supply Chain - Clinical Trial Subject Onboarding [39a035f0-3b2b-45fe-adb8-ee8a19581f6a]
|
11
|
+
---
|
12
|
+
flowchart TD
|
13
|
+
%%{init: {"flowchart": {"htmlLabels": false}} }%%
|
14
|
+
|
15
|
+
39a035f0-3b2b-45fe-adb8-ee8a19581f6a@{ shape: flip-tri, label: "*Information Supply Chain*
|
16
|
+
**Clinical Trial Subject Onboarding**"}
|
17
|
+
a02292f3-6333-42de-a102-d97c21532561@{ shape: text, label: "*Description*
|
18
|
+
**Delivering the data necessary to add a person as a subject in a clinical trial.**"}
|
19
|
+
39a035f0-3b2b-45fe-adb8-ee8a19581f6a~~~a02292f3-6333-42de-a102-d97c21532561
|
20
|
+
5c45e887-11e0-41fe-baec-ed25f831e36d@{ shape: text, label: "*Purpose*
|
21
|
+
**Ensure patient subject is aware of the process and potential risks in participation.**"}
|
22
|
+
a02292f3-6333-42de-a102-d97c21532561~~~5c45e887-11e0-41fe-baec-ed25f831e36d
|
23
|
+
e4329c56-3ebd-4ebb-a7f1-0949a788dab1@{ shape: text, label: "*Purpose*
|
24
|
+
**Ensure patient subject has given permission for Coco Pharmaceuticals to acquire, store and process their personal data needed for the clinical trial.**"}
|
25
|
+
5c45e887-11e0-41fe-baec-ed25f831e36d~~~e4329c56-3ebd-4ebb-a7f1-0949a788dab1
|
26
|
+
7cd6c004-cb55-4126-8fe9-9d10f871c1d7@{ shape: text, label: "*Purpose*
|
27
|
+
**Ensure incoming data is validated and catalogued.**"}
|
28
|
+
e4329c56-3ebd-4ebb-a7f1-0949a788dab1~~~7cd6c004-cb55-4126-8fe9-9d10f871c1d7
|
29
|
+
68187078-26f4-4ccf-9bea-310fcbd6562f@{ shape: text, label: "*Purpose*
|
30
|
+
**Ensure data and process owners are informed of key milestones and issues requiring attention.**"}
|
31
|
+
7cd6c004-cb55-4126-8fe9-9d10f871c1d7~~~68187078-26f4-4ccf-9bea-310fcbd6562f
|
32
|
+
f0957b39-1f6c-4362-bf8a-ec0c4b537560@{ shape: text, label: "*Purpose*
|
33
|
+
**Ensure the process of data capture and validation is transparent and auditable.**"}
|
34
|
+
68187078-26f4-4ccf-9bea-310fcbd6562f~~~f0957b39-1f6c-4362-bf8a-ec0c4b537560
|
35
|
+
style 39a035f0-3b2b-45fe-adb8-ee8a19581f6a color:#FFFFFF, fill:#004563, stroke:#b7c0c7
|
36
|
+
style 68187078-26f4-4ccf-9bea-310fcbd6562f color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
37
|
+
style 5c45e887-11e0-41fe-baec-ed25f831e36d color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
38
|
+
style f0957b39-1f6c-4362-bf8a-ec0c4b537560 color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
39
|
+
style e4329c56-3ebd-4ebb-a7f1-0949a788dab1 color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
40
|
+
style a02292f3-6333-42de-a102-d97c21532561 color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
41
|
+
style 7cd6c004-cb55-4126-8fe9-9d10f871c1d7 color:#000000, fill:#F9F7ED, stroke:#b7c0c7
|
42
|
+
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<script>
|
46
|
+
mermaid.initialize({startOnLoad:true});
|
47
|
+
</script>
|
48
|
+
</body>
|
49
|
+
</html>
|