pyegeria 5.3.3.11__py3-none-any.whl → 5.3.3.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. pyegeria/__init__.py +2 -1
  2. pyegeria/commands/tech/list_information_supply_chains.py +10 -7
  3. pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Subject Onboarding.html +135 -0
  4. pyegeria/commands/tech/work/mermaid_graphs/{Clinical Trial Treatment Validation.mmd → Clinical Trial Treatment Validation.html } +127 -41
  5. pyegeria/commands/tech/work/mermaid_graphs/Employee Expense Payment.html +126 -0
  6. pyegeria/commands/tech/work/mermaid_graphs/New Drug Product Information Distribution.html +141 -0
  7. pyegeria/commands/tech/work/mermaid_graphs/New Employee Onboarding.html +138 -0
  8. pyegeria/commands/tech/work/mermaid_graphs/Personalized Treatment Ordering.html +143 -0
  9. pyegeria/commands/tech/work/mermaid_graphs/{Physical Inventory Tracking.mmd → Physical Inventory Tracking.html } +114 -28
  10. pyegeria/commands/tech/work/mermaid_graphs/{Sustainability Reporting.mmd → Sustainability Reporting.html } +112 -26
  11. pyegeria/commands/tech/work/mermaid_graphs/{{displayName}}.html +115 -0
  12. pyegeria/mermaid_utilities.py +277 -72
  13. pyegeria/solution_architect_omvs.py +5 -1
  14. {pyegeria-5.3.3.11.dist-info → pyegeria-5.3.3.13.dist-info}/METADATA +1 -1
  15. {pyegeria-5.3.3.11.dist-info → pyegeria-5.3.3.13.dist-info}/RECORD +20 -95
  16. pyegeria/.DS_Store +0 -0
  17. pyegeria/commands/.DS_Store +0 -0
  18. pyegeria/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  19. pyegeria/commands/__pycache__/server_status_widget.cpython-312-pytest-7.4.4.pyc +0 -0
  20. pyegeria/commands/cat/__pycache__/__init__.cpython-312.pyc +0 -0
  21. pyegeria/commands/cat/__pycache__/get_asset_graph.cpython-312.pyc +0 -0
  22. pyegeria/commands/cat/__pycache__/get_collection.cpython-312.pyc +0 -0
  23. pyegeria/commands/cat/__pycache__/get_project_dependencies.cpython-312.pyc +0 -0
  24. pyegeria/commands/cat/__pycache__/get_project_structure.cpython-312.pyc +0 -0
  25. pyegeria/commands/cat/__pycache__/get_tech_type_elements.cpython-312.pyc +0 -0
  26. pyegeria/commands/cat/__pycache__/glossary_actions.cpython-312.pyc +0 -0
  27. pyegeria/commands/cat/__pycache__/list_assets.cpython-312.pyc +0 -0
  28. pyegeria/commands/cat/__pycache__/list_cert_types.cpython-312.pyc +0 -0
  29. pyegeria/commands/cat/__pycache__/list_collections.cpython-312.pyc +0 -0
  30. pyegeria/commands/cat/__pycache__/list_deployed_catalogs.cpython-312.pyc +0 -0
  31. pyegeria/commands/cat/__pycache__/list_deployed_database_schemas.cpython-312.pyc +0 -0
  32. pyegeria/commands/cat/__pycache__/list_deployed_databases.cpython-312.pyc +0 -0
  33. pyegeria/commands/cat/__pycache__/list_glossaries.cpython-312.pyc +0 -0
  34. pyegeria/commands/cat/__pycache__/list_projects.cpython-312.pyc +0 -0
  35. pyegeria/commands/cat/__pycache__/list_servers_deployed_imp.cpython-312.pyc +0 -0
  36. pyegeria/commands/cat/__pycache__/list_tech_type_elements.cpython-312.pyc +0 -0
  37. pyegeria/commands/cat/__pycache__/list_tech_types.cpython-312.pyc +0 -0
  38. pyegeria/commands/cat/__pycache__/list_terms.cpython-312.pyc +0 -0
  39. pyegeria/commands/cat/__pycache__/list_todos.cpython-312.pyc +0 -0
  40. pyegeria/commands/cat/__pycache__/list_user_ids.cpython-312.pyc +0 -0
  41. pyegeria/commands/cli/__pycache__/__init__.cpython-312.pyc +0 -0
  42. pyegeria/commands/cli/__pycache__/egeria_login_tui.cpython-312.pyc +0 -0
  43. pyegeria/commands/cli/__pycache__/egeria_ops.cpython-312.pyc +0 -0
  44. pyegeria/commands/cli/__pycache__/ops_config.cpython-312.pyc +0 -0
  45. pyegeria/commands/doc/.DS_Store +0 -0
  46. pyegeria/commands/doc/Visual Command Reference/.DS_Store +0 -0
  47. pyegeria/commands/doc/Visual Command Reference/cat/.DS_Store +0 -0
  48. pyegeria/commands/doc/Visual Command Reference/cat/show/.DS_Store +0 -0
  49. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/.DS_Store +0 -0
  50. pyegeria/commands/doc/glossary/.DS_Store +0 -0
  51. pyegeria/commands/doc/glossary/images/.DS_Store +0 -0
  52. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/.DS_Store +0 -0
  53. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/.DS_Store +0 -0
  54. pyegeria/commands/my/__pycache__/__init__.cpython-312.pyc +0 -0
  55. pyegeria/commands/my/__pycache__/list_my_profile.cpython-312.pyc +0 -0
  56. pyegeria/commands/my/__pycache__/list_my_roles.cpython-312.pyc +0 -0
  57. pyegeria/commands/my/__pycache__/monitor_my_todos.cpython-312.pyc +0 -0
  58. pyegeria/commands/my/__pycache__/monitor_open_todos.cpython-312.pyc +0 -0
  59. pyegeria/commands/my/__pycache__/todo_actions.cpython-312.pyc +0 -0
  60. pyegeria/commands/ops/__pycache__/__init__.cpython-312.pyc +0 -0
  61. pyegeria/commands/ops/__pycache__/gov_server_actions.cpython-312.pyc +0 -0
  62. pyegeria/commands/ops/__pycache__/list_archives.cpython-312.pyc +0 -0
  63. pyegeria/commands/ops/__pycache__/list_catalog_targets.cpython-312.pyc +0 -0
  64. pyegeria/commands/ops/__pycache__/load_archive.cpython-312.pyc +0 -0
  65. pyegeria/commands/ops/__pycache__/monitor_engine_activity.cpython-312.pyc +0 -0
  66. pyegeria/commands/ops/__pycache__/monitor_engine_activity_c.cpython-312.pyc +0 -0
  67. pyegeria/commands/ops/__pycache__/monitor_gov_eng_status.cpython-312.pyc +0 -0
  68. pyegeria/commands/ops/__pycache__/monitor_integ_daemon_status.cpython-312.pyc +0 -0
  69. pyegeria/commands/ops/__pycache__/monitor_platform_status.cpython-312.pyc +0 -0
  70. pyegeria/commands/ops/__pycache__/monitor_server_startup.cpython-312.pyc +0 -0
  71. pyegeria/commands/ops/__pycache__/monitor_server_status.cpython-312.pyc +0 -0
  72. pyegeria/commands/ops/__pycache__/refresh_integration_daemon.cpython-312.pyc +0 -0
  73. pyegeria/commands/ops/__pycache__/restart_integration_daemon.cpython-312.pyc +0 -0
  74. pyegeria/commands/ops/__pycache__/table_integ_daemon_status.cpython-312.pyc +0 -0
  75. pyegeria/commands/tech/__pycache__/__init__.cpython-312.pyc +0 -0
  76. pyegeria/commands/tech/__pycache__/get_element_info.cpython-312.pyc +0 -0
  77. pyegeria/commands/tech/__pycache__/get_guid_info.cpython-312.pyc +0 -0
  78. pyegeria/commands/tech/__pycache__/get_tech_details.cpython-312.pyc +0 -0
  79. pyegeria/commands/tech/__pycache__/get_tech_type_template.cpython-312.pyc +0 -0
  80. pyegeria/commands/tech/__pycache__/list_anchored_elements.cpython-312.pyc +0 -0
  81. pyegeria/commands/tech/__pycache__/list_asset_types.cpython-312.pyc +0 -0
  82. pyegeria/commands/tech/__pycache__/list_elements_by_property_value.cpython-312.pyc +0 -0
  83. pyegeria/commands/tech/__pycache__/list_elements_for_classification.cpython-312.pyc +0 -0
  84. pyegeria/commands/tech/__pycache__/list_gov_action_processes.cpython-312.pyc +0 -0
  85. pyegeria/commands/tech/__pycache__/list_registered_services.cpython-312.pyc +0 -0
  86. pyegeria/commands/tech/__pycache__/list_related_specification.cpython-312.pyc +0 -0
  87. pyegeria/commands/tech/__pycache__/list_relationship_types.cpython-312.pyc +0 -0
  88. pyegeria/commands/tech/__pycache__/list_relationships.cpython-312.pyc +0 -0
  89. pyegeria/commands/tech/__pycache__/list_tech_templates.cpython-312.pyc +0 -0
  90. pyegeria/commands/tech/__pycache__/list_valid_metadata_values.cpython-312.pyc +0 -0
  91. pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Subject Onboarding.mmd +0 -49
  92. pyegeria/commands/tech/work/mermaid_graphs/Employee Expense Payment.mmd +0 -40
  93. pyegeria/commands/tech/work/mermaid_graphs/New Drug Product Information Distribution.mmd +0 -55
  94. pyegeria/commands/tech/work/mermaid_graphs/New Employee Onboarding.mmd +0 -52
  95. pyegeria/commands/tech/work/mermaid_graphs/Personalized Treatment Ordering.mmd +0 -57
  96. pyegeria/commands/tech/work/mermaid_graphs/{{displayName}}.mmd +0 -29
  97. /pyegeria/commands/tech/{list_isolution_blueprints.py → list_solution_blueprints.py} +0 -0
  98. /pyegeria/commands/tech/{list_isolution_blueprints2.py → list_solution_blueprints2.py} +0 -0
  99. {pyegeria-5.3.3.11.dist-info → pyegeria-5.3.3.13.dist-info}/LICENSE +0 -0
  100. {pyegeria-5.3.3.11.dist-info → pyegeria-5.3.3.13.dist-info}/WHEEL +0 -0
  101. {pyegeria-5.3.3.11.dist-info → pyegeria-5.3.3.13.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,115 @@
1
+
2
+ <html>
3
+ <head>
4
+ <style type="text/css">
5
+ #mySvgId {
6
+ width: 100%;
7
+ height: 100%;
8
+ overflow: hidden;
9
+ border: 1px solid #ccc;
10
+ position: relative;
11
+ margin-bottom: 10px;
12
+ }
13
+ svg {
14
+ cursor: grab;
15
+ }
16
+
17
+ </style>
18
+ </head>
19
+
20
+ <body>
21
+ <div id="graphDiv"></div>
22
+ <script src="https://bumbu.me/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
23
+ <script type="module">
24
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
25
+
26
+ mermaid.initialize({startOnLoad: false});
27
+ await mermaid.run({
28
+ querySelector: '.mermaid',
29
+ postRenderCallback: (id) => {
30
+ const container = document.getElementById("diagram-container");
31
+ const svgElement = container.querySelector("svg");
32
+
33
+ // Initialize Panzoom
34
+ const panzoomInstance = Panzoom(svgElement, {
35
+ maxScale: 5,
36
+ minScale: 0.5,
37
+ step: 0.1,
38
+ });
39
+
40
+ // Add mouse wheel zoom
41
+ container.addEventListener("wheel", (event) => {
42
+ panzoomInstance.zoomWithWheel(event);
43
+ });
44
+ }
45
+ });
46
+
47
+
48
+ const drawDiagram = async function () {
49
+ const element = document.querySelector('#graphDiv');
50
+ const graphDefinition = `
51
+ flowchart TD
52
+ %%{init: {"flowchart": {"htmlLabels": false}} }%%
53
+
54
+ ba3ab0dd-3ec5-4ec5-9db9-f3dc56e3a732@{ shape: flip-tri, label: "*Information Supply Chain*
55
+ **{{displayName}}**"}
56
+ 40130bec-d839-48cc-992a-3b2a2fc82caa@{ shape: text, label: "*Description*
57
+ **{{description}}**"}
58
+ ba3ab0dd-3ec5-4ec5-9db9-f3dc56e3a732~~~40130bec-d839-48cc-992a-3b2a2fc82caa
59
+ style ba3ab0dd-3ec5-4ec5-9db9-f3dc56e3a732 color:#FFFFFF, fill:#004563, stroke:#b7c0c7
60
+ style 40130bec-d839-48cc-992a-3b2a2fc82caa color:#000000, fill:#F9F7ED, stroke:#b7c0c7`;
61
+ const {svg} = await mermaid.render('mySvgId', graphDefinition);
62
+ element.innerHTML = svg.replace(/( )*max-width:( 0-9\.)*px;/i, '');
63
+
64
+ var doPan = false;
65
+ var eventsHandler;
66
+ var panZoom;
67
+ var mousepos;
68
+
69
+ eventsHandler = {
70
+ haltEventListeners: ['mousedown', 'mousemove', 'mouseup']
71
+
72
+ , mouseDownHandler: function (ev) {
73
+ if (event.target.className == "[object SVGAnimatedString]") {
74
+ doPan = true;
75
+ mousepos = {x: ev.clientX, y: ev.clientY}
76
+ }
77
+ ;
78
+ }
79
+
80
+ , mouseMoveHandler: function (ev) {
81
+ if (doPan) {
82
+ panZoom.panBy({x: ev.clientX - mousepos.x, y: ev.clientY - mousepos.y});
83
+ mousepos = {x: ev.clientX, y: ev.clientY};
84
+ window.getSelection().removeAllRanges();
85
+ }
86
+ }
87
+
88
+ , mouseUpHandler: function (ev) {
89
+ doPan = false;
90
+ }
91
+
92
+ , init: function (options) {
93
+ options.svgElement.addEventListener('mousedown', this.mouseDownHandler, false);
94
+ options.svgElement.addEventListener('mousemove', this.mouseMoveHandler, false);
95
+ options.svgElement.addEventListener('mouseup', this.mouseUpHandler, false);
96
+ }
97
+
98
+ , destroy: function (options) {
99
+ options.svgElement.removeEventListener('mousedown', this.mouseDownHandler, false);
100
+ options.svgElement.removeEventListener('mousemove', this.mouseMoveHandler, false);
101
+ options.svgElement.removeEventListener('mouseup', this.mouseUpHandler, false);
102
+ }
103
+ }
104
+ panZoom = svgPanZoom('#mySvgId', {
105
+ zoomEnabled: true
106
+ , controlIconsEnabled: true
107
+ , fit: 1
108
+ , center: 1
109
+ , customEventsHandler: eventsHandler
110
+ })
111
+ };
112
+ await drawDiagram();
113
+ </script>
114
+ </body>
115
+
@@ -42,35 +42,7 @@ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
42
42
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
43
43
  EGERIA_MERMAID_FOLDER = os.environ.get("EGERIA_MERMAID_FOLDER", "./work/mermaid_graphs")
44
44
 
45
- # Check Mermaid.js version
46
- # def check_mermaid_version():
47
- # """Check the version of Mermaid.js loaded in Jupyter Notebook"""
48
- # display(HTML("""
49
- # <script>
50
- # function checkMermaid() {
51
- # if (window.mermaid && typeof window.mermaid.version !== "undefined") {
52
- # console.log("Mermaid.js version:", mermaid.version);
53
- # alert("Mermaid.js version: " + mermaid.version);
54
- # } else {
55
- # console.warn("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
56
- # alert("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
57
- # }
58
- # }
59
- # // Delay execution to ensure Mermaid.js has had time to load
60
- # setTimeout(checkMermaid, 1000);
61
- # </script>
62
- # """))
63
-
64
- # another site to get mermaid from is "https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.1/mermaid.min.js";
65
- # below was:
66
- #<script src="https://unpkg.com/mermaid@11.4.0/dist/mermaid.min.js"></script>
67
- # <script type="text/javascript">
68
- # if (!window.mermaid) {
69
- # var mermaidScript = document.createElement('script');
70
- # mermaidScript.src = https://unpkg.com/mermaid@11.4.1/dist/mermaid.min.js"
71
- # document.head.appendChild(mermaidScript);
72
- # }
73
- # </script>
45
+
74
46
  def load_mermaid():
75
47
  """Inject Mermaid.js library"""
76
48
  # Alternative CDN URL via unpkg
@@ -83,60 +55,293 @@ def load_mermaid():
83
55
  </script>
84
56
 
85
57
  """
86
- # mermaid_js = """
87
- # <script src="https://unpkg.com/mermaid@11.4.0/dist/mermaid.min.js"></script>
88
- # <script>
89
- # document.addEventListener('DOMContentLoaded', function() {{
90
- # mermaid.initialize({{"startOnLoad": true}});
91
- # }});
92
- # </script>
93
- #
94
- # """
58
+
95
59
  display(HTML(mermaid_js))
96
60
 
97
61
 
62
+ # def render_mermaid(mermaid_code):
63
+ # """Function to display a Mermaid diagram in a Jupyter notebook"""
64
+ # mermaid_html = f"""
65
+ # <div class="mermaid">
66
+ # {mermaid_code}
67
+ # </div>
68
+ # <script type="text/javascript">
69
+ # if (window.mermaid) {{
70
+ # mermaid.initialize({{startOnLoad: true}});
71
+ # mermaid.contentLoaded();
72
+ # }}
73
+ # </script>
74
+ # """
75
+ # display(HTML(mermaid_html))
98
76
  def render_mermaid(mermaid_code):
99
- """Function to display a Mermaid diagram in a Jupyter notebook"""
100
- mermaid_html = f"""
101
- <div class="mermaid">
102
- {mermaid_code}
103
- </div>
104
- <script type="text/javascript">
105
- if (window.mermaid) {{
106
- mermaid.initialize({{startOnLoad: true}});
107
- mermaid.contentLoaded();
108
- }}
109
- </script>
77
+ return display(HTML(construct_mermaid_html(mermaid_code)))
78
+
79
+
80
+ def parse_mermaid_code(mermaid_code):
81
+ parts = mermaid_code.split('---', maxsplit=3)
82
+ if len(parts) == 3:
83
+ title = parts[1].strip()
84
+ mermaid_code = parts[2].strip()
85
+ else:
86
+ title = "No Title"
87
+ return title, mermaid_code
88
+
89
+ def construct_mermaid_html(mermaid_str: str) -> str:
90
+ """Function to display a HTML code in a Jupyter notebook"""
91
+ title, mermaid_code = parse_mermaid_code(mermaid_str)
92
+
93
+ html_section1 = """
94
+ <html>
95
+ <head>
96
+ <style type="text/css">
97
+ #mySvgId {
98
+ width: 100%;
99
+ height: 600px;
100
+ overflow: scroll;
101
+ border: 2px solid #ccc;
102
+ position: relative;
103
+ margin-bottom: 10px;
104
+ }
105
+ svg {
106
+ cursor: grab;
107
+ }
108
+
109
+ </style>
110
+ </head>
111
+ """
112
+ html_section2 = """"
113
+ <title>{title}</title>
114
+ """
115
+ html_section3 = """
116
+ <body>
117
+
118
+ <div id="graphDiv"></div>
119
+ <script src="https://bumbu.me/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
120
+ <script type="module">
121
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
122
+
123
+ mermaid.initialize({startOnLoad: false});
124
+ await mermaid.run({
125
+ querySelector: '.mermaid',
126
+ postRenderCallback: (id) => {
127
+ const container = document.getElementById("diagram-container");
128
+ const svgElement = container.querySelector("svg");
129
+
130
+ // Initialize Panzoom
131
+ const panzoomInstance = Panzoom(svgElement, {
132
+ maxScale: 5,
133
+ minScale: 0.5,
134
+ step: 0.1,
135
+ });
136
+
137
+ // Add mouse wheel zoom
138
+ container.addEventListener("wheel", (event) => {
139
+ panzoomInstance.zoomWithWheel(event);
140
+ });
141
+ }
142
+ });
143
+
144
+
145
+ const drawDiagram = async function () {
146
+ const element = document.querySelector('#graphDiv');
147
+ const graphDefinition = `
110
148
  """
111
- display(HTML(mermaid_html))
112
149
 
113
- def save_mermaid_graph(title, mermaid_code, folder:str = EGERIA_MERMAID_FOLDER):
150
+ html_section4 = """`;
151
+ const {svg} = await mermaid.render('mySvgId', graphDefinition);
152
+ element.innerHTML = svg.replace(/( )*max-width:( 0-9\.)*px;/i, '');
153
+
154
+ var doPan = false;
155
+ var eventsHandler;
156
+ var panZoom;
157
+ var mousepos;
158
+
159
+ eventsHandler = {
160
+ haltEventListeners: ['mousedown', 'mousemove', 'mouseup']
161
+
162
+ , mouseDownHandler: function (ev) {
163
+ if (event.target.className == "[object SVGAnimatedString]") {
164
+ doPan = true;
165
+ mousepos = {x: ev.clientX, y: ev.clientY}
166
+ }
167
+ ;
168
+ }
169
+
170
+ , mouseMoveHandler: function (ev) {
171
+ if (doPan) {
172
+ panZoom.panBy({x: ev.clientX - mousepos.x, y: ev.clientY - mousepos.y});
173
+ mousepos = {x: ev.clientX, y: ev.clientY};
174
+ window.getSelection().removeAllRanges();
175
+ }
176
+ }
177
+
178
+ , mouseUpHandler: function (ev) {
179
+ doPan = false;
180
+ }
181
+
182
+ , init: function (options) {
183
+ options.svgElement.addEventListener('mousedown', this.mouseDownHandler, false);
184
+ options.svgElement.addEventListener('mousemove', this.mouseMoveHandler, false);
185
+ options.svgElement.addEventListener('mouseup', this.mouseUpHandler, false);
186
+ }
187
+
188
+ , destroy: function (options) {
189
+ options.svgElement.removeEventListener('mousedown', this.mouseDownHandler, false);
190
+ options.svgElement.removeEventListener('mousemove', this.mouseMoveHandler, false);
191
+ options.svgElement.removeEventListener('mouseup', this.mouseUpHandler, false);
192
+ }
193
+ }
194
+ panZoom = svgPanZoom('#mySvgId', {
195
+ zoomEnabled: true
196
+ , controlIconsEnabled: true
197
+ , fit: 1
198
+ , center: 1
199
+ , customEventsHandler: eventsHandler
200
+ })
201
+ };
202
+ await drawDiagram();
203
+ </script>
204
+ </body>
205
+ """
206
+
207
+ return html_section1 + html_section2 + html_section3 + mermaid_code + html_section4
208
+
209
+ def save_mermaid_html(title: str, mermaid_str: str, folder:str = EGERIA_MERMAID_FOLDER):
114
210
  """Save a Mermaid diagram to a file"""
115
211
  if not os.path.exists(folder):
116
212
  os.makedirs(folder)
117
- mermaid_file = os.path.join(folder, title + ".mmd")
118
- mermaid_code = f"""
119
- <!DOCTYPE html>
120
- <html>
121
- <head>
122
- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
123
- </head>
124
- <body>
125
- <div class="mermaid">
126
- {mermaid_code}
127
- </div>
128
- """ \
129
- + \
130
- """
131
- <script>
132
- mermaid.initialize({startOnLoad:true});
133
- </script>
134
- </body>
135
- </html>
136
- """
213
+ mermaid_file = os.path.join(folder, title + ".html")
214
+
215
+ payload = construct_mermaid_html(mermaid_str)
216
+
217
+ with open(mermaid_file, "w") as f:
218
+ f.write(payload)
219
+ return mermaid_file
220
+
221
+
222
+
223
+
224
+ def save_mermaid_graph(title, mermaid_str, folder:str = EGERIA_MERMAID_FOLDER):
225
+ """Save a Mermaid diagram to a file"""
226
+ if not os.path.exists(folder):
227
+ os.makedirs(folder)
228
+ mermaid_file = os.path.join(folder, title + ".html")
229
+
230
+ title, mermaid_code = parse_mermaid_code(mermaid_str)
231
+
232
+ html_prefix = """
233
+ <html>
234
+ <head>
235
+ <style type="text/css">
236
+ #mySvgId {
237
+ width: 100%;
238
+ height: 100%;
239
+ overflow: hidden;
240
+ border: 1px solid #ccc;
241
+ position: relative;
242
+ margin-bottom: 10px;
243
+ }
244
+ svg {
245
+ cursor: grab;
246
+ }
247
+
248
+ </style>
249
+ </head>
250
+
251
+ <body>
252
+ <div id="graphDiv"></div>
253
+ <script src="https://bumbu.me/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
254
+ <script type="module">
255
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
256
+
257
+ mermaid.initialize({startOnLoad: false});
258
+ await mermaid.run({
259
+ querySelector: '.mermaid',
260
+ postRenderCallback: (id) => {
261
+ const container = document.getElementById("diagram-container");
262
+ const svgElement = container.querySelector("svg");
263
+
264
+ // Initialize Panzoom
265
+ const panzoomInstance = Panzoom(svgElement, {
266
+ maxScale: 5,
267
+ minScale: 0.5,
268
+ step: 0.1,
269
+ });
270
+
271
+ // Add mouse wheel zoom
272
+ container.addEventListener("wheel", (event) => {
273
+ panzoomInstance.zoomWithWheel(event);
274
+ });
275
+ }
276
+ });
277
+
278
+
279
+ const drawDiagram = async function () {
280
+ const element = document.querySelector('#graphDiv');
281
+ const graphDefinition = `
282
+ """
283
+
284
+ html_postfix = """`;
285
+ const {svg} = await mermaid.render('mySvgId', graphDefinition);
286
+ element.innerHTML = svg.replace(/( )*max-width:( 0-9\.)*px;/i, '');
287
+
288
+ var doPan = false;
289
+ var eventsHandler;
290
+ var panZoom;
291
+ var mousepos;
292
+
293
+ eventsHandler = {
294
+ haltEventListeners: ['mousedown', 'mousemove', 'mouseup']
295
+
296
+ , mouseDownHandler: function (ev) {
297
+ if (event.target.className == "[object SVGAnimatedString]") {
298
+ doPan = true;
299
+ mousepos = {x: ev.clientX, y: ev.clientY}
300
+ }
301
+ ;
302
+ }
303
+
304
+ , mouseMoveHandler: function (ev) {
305
+ if (doPan) {
306
+ panZoom.panBy({x: ev.clientX - mousepos.x, y: ev.clientY - mousepos.y});
307
+ mousepos = {x: ev.clientX, y: ev.clientY};
308
+ window.getSelection().removeAllRanges();
309
+ }
310
+ }
311
+
312
+ , mouseUpHandler: function (ev) {
313
+ doPan = false;
314
+ }
315
+
316
+ , init: function (options) {
317
+ options.svgElement.addEventListener('mousedown', this.mouseDownHandler, false);
318
+ options.svgElement.addEventListener('mousemove', this.mouseMoveHandler, false);
319
+ options.svgElement.addEventListener('mouseup', this.mouseUpHandler, false);
320
+ }
321
+
322
+ , destroy: function (options) {
323
+ options.svgElement.removeEventListener('mousedown', this.mouseDownHandler, false);
324
+ options.svgElement.removeEventListener('mousemove', this.mouseMoveHandler, false);
325
+ options.svgElement.removeEventListener('mouseup', this.mouseUpHandler, false);
326
+ }
327
+ }
328
+ panZoom = svgPanZoom('#mySvgId', {
329
+ zoomEnabled: true
330
+ , controlIconsEnabled: true
331
+ , fit: 1
332
+ , center: 1
333
+ , customEventsHandler: eventsHandler
334
+ })
335
+ };
336
+ await drawDiagram();
337
+ </script>
338
+ </body>
339
+ """
340
+
341
+ payload = html_prefix + mermaid_code + html_postfix
137
342
 
138
343
  with open(mermaid_file, "w") as f:
139
- f.write(mermaid_code)
344
+ f.write(payload)
140
345
  return mermaid_file
141
346
 
142
347
 
@@ -144,12 +144,12 @@ class SolutionArchitect(Client):
144
144
 
145
145
  possible_query_params = query_string(
146
146
  [
147
+ ("addImplementation", add_implementation),
147
148
  ("startFrom", start_from),
148
149
  ("pageSize", page_size),
149
150
  ("startsWith", starts_with),
150
151
  ("endsWith", ends_with),
151
152
  ("ignoreCase", ignore_case),
152
- ("addImplementation", add_implementation),
153
153
  ]
154
154
  )
155
155
 
@@ -176,6 +176,7 @@ class SolutionArchitect(Client):
176
176
 
177
177
  def find_information_supply_chains(self,
178
178
  filter: str = "*",
179
+ add_implementation: bool = True,
179
180
  starts_with: bool = True,
180
181
  ends_with: bool = False,
181
182
  ignore_case: bool = False,
@@ -190,6 +191,8 @@ class SolutionArchitect(Client):
190
191
  ----------
191
192
  filter: str
192
193
  - search_filterstring to search for.
194
+ add_implementation : bool, [default=True], optional
195
+ - add_implementation flag to include information supply chain implementations details..
193
196
  starts_with : bool, [default=False], optional
194
197
  Starts with the supplied string.
195
198
  ends_with : bool, [default=False], optional
@@ -218,6 +221,7 @@ class SolutionArchitect(Client):
218
221
  response = loop.run_until_complete(
219
222
  self._async_find_information_supply_chains(
220
223
  filter,
224
+ add_implementation,
221
225
  starts_with,
222
226
  ends_with,
223
227
  ignore_case,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyegeria
3
- Version: 5.3.3.11
3
+ Version: 5.3.3.13
4
4
  Summary: A python client for Egeria
5
5
  License: Apache 2.0
6
6
  Keywords: egeria,metadata,governance