pyegeria 5.4.0.3__py3-none-any.whl → 5.4.0.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/list_format_set.py +411 -0
- commands/cli/debug_log +0 -0
- commands/cli/egeria.py +46 -34
- commands/cli/egeria_cat.py +46 -33
- commands/cli/ops_config.py +1 -4
- md_processing/dr-egeria-outbox/DataStruct-2025-07-29-20-49-16.py +8 -0
- md_processing/dr-egeria-outbox/Mandy-DataStruct-2025-07-29-15-54-45.md +19 -0
- pyegeria/_output_formats.py +83 -19
- pyegeria/collection_manager_omvs.py +1 -1
- pyegeria/data_designer_omvs.py +29 -23
- pyegeria/load_config.py +4 -4
- pyegeria/output_formatter.py +9 -2
- {pyegeria-5.4.0.3.dist-info → pyegeria-5.4.0.4.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.3.dist-info → pyegeria-5.4.0.4.dist-info}/RECORD +17 -13
- {pyegeria-5.4.0.3.dist-info → pyegeria-5.4.0.4.dist-info}/entry_points.txt +1 -0
- {pyegeria-5.4.0.3.dist-info → pyegeria-5.4.0.4.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.3.dist-info → pyegeria-5.4.0.4.dist-info}/WHEEL +0 -0
commands/cli/egeria_cat.py
CHANGED
@@ -13,7 +13,9 @@ import os
|
|
13
13
|
|
14
14
|
import click
|
15
15
|
from trogon import tui
|
16
|
+
from pyegeria import config_logging, get_app_config
|
16
17
|
|
18
|
+
from commands.cat.list_format_set import execute_format_set_action
|
17
19
|
from commands.cat.dr_egeria_md import process_markdown_file
|
18
20
|
from commands.cat.get_asset_graph import asset_viewer
|
19
21
|
from commands.cat.get_collection import collection_viewer
|
@@ -58,110 +60,109 @@ from commands.my.todo_actions import (
|
|
58
60
|
)
|
59
61
|
from commands.tech.list_asset_types import display_asset_types
|
60
62
|
|
63
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
64
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
65
|
+
app_settings = get_app_config()
|
66
|
+
app_config = app_settings["Environment"]
|
67
|
+
# config_logging()
|
68
|
+
|
61
69
|
|
62
70
|
# @tui
|
63
71
|
# @tui('menu','menu','A textual object_action line interface')
|
64
72
|
@tui()
|
65
|
-
@
|
73
|
+
# @tui('menu', 'menu', 'A textual object_action line interface')
|
74
|
+
@click.version_option("5.4 ", prog_name="hey_egeria")
|
66
75
|
@click.group()
|
67
76
|
@click.option(
|
68
77
|
"--server",
|
69
|
-
default=
|
78
|
+
default=app_config['Egeria Metadata Store'],
|
70
79
|
help="Egeria metadata store to work with",
|
71
80
|
)
|
72
81
|
@click.option(
|
73
82
|
"--url",
|
74
|
-
default=
|
83
|
+
default=app_config["Egeria Platform URL"],
|
75
84
|
help="URL of Egeria metadata store platform to connect to",
|
76
85
|
)
|
77
86
|
@click.option(
|
78
87
|
"--integration_daemon",
|
79
|
-
default=
|
88
|
+
default=app_config["Egeria Integration Daemon"],
|
80
89
|
help="Egeria integration daemon to work with",
|
81
90
|
)
|
82
91
|
@click.option(
|
83
92
|
"--integration_daemon_url",
|
84
|
-
default=
|
93
|
+
default=app_config['Egeria Integration Daemon URL'],
|
85
94
|
help="URL of Egeria integration daemon platform to connect to",
|
86
95
|
)
|
87
96
|
@click.option(
|
88
97
|
"--view_server",
|
89
|
-
default=
|
98
|
+
default=app_config['Egeria View Server'],
|
90
99
|
help="Egeria view server to work with",
|
91
100
|
)
|
92
101
|
@click.option(
|
93
102
|
"--view_server_url",
|
94
|
-
default=
|
103
|
+
default=app_config['Egeria View Server URL'],
|
95
104
|
help="URL of Egeria view server platform to connect to",
|
96
105
|
)
|
97
106
|
@click.option(
|
98
107
|
"--engine_host",
|
99
|
-
default=
|
108
|
+
default=app_config['Egeria Engine Host'],
|
100
109
|
help="Egeria engine host to work with",
|
101
110
|
)
|
102
111
|
@click.option(
|
103
112
|
"--engine_host_url",
|
104
|
-
default=
|
113
|
+
default=app_config['Egeria Engine Host URL'],
|
105
114
|
help="URL of Egeria engine host platform to connect to",
|
106
115
|
)
|
107
|
-
|
108
|
-
"--admin_user",
|
109
|
-
default=os.environ.get("EGERIA_ADMIN_USER", "garygeeke"),
|
110
|
-
help="Egeria admin user",
|
111
|
-
)
|
112
|
-
@click.option(
|
113
|
-
"--admin_user_password",
|
114
|
-
default=os.environ.get("EGERIA_ADMIN_PASSWORD", "secret"),
|
115
|
-
help="Egeria admin password",
|
116
|
-
)
|
116
|
+
|
117
117
|
@click.option(
|
118
118
|
"--userid",
|
119
|
-
default=
|
119
|
+
default=EGERIA_USER,
|
120
120
|
help="Egeria user",
|
121
121
|
)
|
122
122
|
@click.option(
|
123
123
|
"--password",
|
124
|
-
default=
|
124
|
+
default=EGERIA_USER_PASSWORD,
|
125
125
|
help="Egeria user password",
|
126
126
|
)
|
127
127
|
@click.option("--timeout", default=60, help="Number of seconds to wait")
|
128
128
|
@click.option(
|
129
129
|
"--jupyter",
|
130
130
|
is_flag=True,
|
131
|
-
|
131
|
+
type=bool,
|
132
|
+
default=app_config['Egeria Jupyter'],
|
132
133
|
help="Enable for rendering in a Jupyter terminal",
|
133
134
|
)
|
134
135
|
@click.option(
|
135
136
|
"--width",
|
136
|
-
default=
|
137
|
+
default=app_config['Console Width'],
|
137
138
|
type=int,
|
138
139
|
help="Screen width, in characters, to use",
|
139
140
|
)
|
140
141
|
@click.option(
|
141
142
|
"--home_glossary_guid",
|
142
|
-
default=
|
143
|
-
help="Glossary
|
143
|
+
default=app_settings['User Profile']['Egeria Home Glossary Name'],
|
144
|
+
help="Glossary name to use as the home glossary",
|
144
145
|
)
|
145
146
|
@click.option(
|
146
147
|
"--glossary_path",
|
147
|
-
default=
|
148
|
+
default=app_config['Egeria Glossary Path'],
|
148
149
|
help="Path to glossary import/export files",
|
149
150
|
)
|
150
151
|
|
151
152
|
@click.option(
|
152
153
|
"--root_path",
|
153
|
-
default=
|
154
|
+
default=app_config['Pyegeria Root'],
|
154
155
|
help="Root path to use for file operations",
|
155
156
|
)
|
156
157
|
|
157
158
|
@click.option(
|
158
159
|
"--inbox_path",
|
159
|
-
default=
|
160
|
+
default=app_config['Dr.Egeria Inbox'],
|
160
161
|
help="Path to inbox files",
|
161
162
|
)
|
162
163
|
@click.option(
|
163
164
|
"--outbox_path",
|
164
|
-
default=
|
165
|
+
default=app_config['Dr.Egeria Outbox'],
|
165
166
|
help="Path to outbox files",
|
166
167
|
)
|
167
168
|
|
@@ -176,8 +177,6 @@ def cli(
|
|
176
177
|
integration_daemon_url,
|
177
178
|
engine_host,
|
178
179
|
engine_host_url,
|
179
|
-
admin_user,
|
180
|
-
admin_user_password,
|
181
180
|
userid,
|
182
181
|
password,
|
183
182
|
timeout,
|
@@ -199,8 +198,6 @@ def cli(
|
|
199
198
|
integration_daemon_url,
|
200
199
|
engine_host,
|
201
200
|
engine_host_url,
|
202
|
-
admin_user,
|
203
|
-
admin_user_password,
|
204
201
|
userid,
|
205
202
|
password,
|
206
203
|
timeout,
|
@@ -229,6 +226,22 @@ def info(ctx):
|
|
229
226
|
pass
|
230
227
|
|
231
228
|
|
229
|
+
@info.command("list-output-set")
|
230
|
+
@click.option("--format-set", help="Format set to output")
|
231
|
+
@click.option("--output-format", default = "TABLE", help="Output format type")
|
232
|
+
@click.option('--search-string', default="*", help="Search string")
|
233
|
+
@click.pass_context
|
234
|
+
def show_format_set(ctx, format_set, output_format, search_string):
|
235
|
+
"""Dynamically generate output based on a format set"""
|
236
|
+
c = ctx.obj
|
237
|
+
|
238
|
+
execute_format_set_action(
|
239
|
+
format_set, c.view_server, c.view_server_url,
|
240
|
+
c.userid, c.password, output_format, search_string = search_string
|
241
|
+
)
|
242
|
+
|
243
|
+
|
244
|
+
|
232
245
|
@info.command("tech-types")
|
233
246
|
@click.option("--tech_type", default="*", help="Tech type to search for")
|
234
247
|
@click.pass_context
|
commands/cli/ops_config.py
CHANGED
@@ -12,8 +12,6 @@ class Config(object):
|
|
12
12
|
integration_daemon_url: str,
|
13
13
|
engine_host: str,
|
14
14
|
engine_host_url: str,
|
15
|
-
admin_user: str,
|
16
|
-
admin_user_password: str,
|
17
15
|
userid: str,
|
18
16
|
password: str,
|
19
17
|
timeout: int,
|
@@ -33,8 +31,7 @@ class Config(object):
|
|
33
31
|
self.integration_daemon_url = integration_daemon_url
|
34
32
|
self.engine_host = engine_host
|
35
33
|
self.engine_host_url = engine_host_url
|
36
|
-
|
37
|
-
self.admin_user_password = admin_user_password
|
34
|
+
|
38
35
|
self.userid = userid
|
39
36
|
self.password = password
|
40
37
|
self.timeout = timeout
|
@@ -0,0 +1,8 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"Display Name": "",
|
4
|
+
"Qualified Name": " [DataStruct::TBDF-Incoming Weekly Measurement Data](#3e4bc9a1-2661-4d24-a753-b26060c61e34) ",
|
5
|
+
"Category": "",
|
6
|
+
"Description": "This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial."
|
7
|
+
}
|
8
|
+
]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Puddy Approves
|
2
|
+
This is a tutorial on how to use a data struct description
|
3
|
+
|
4
|
+
# Data Structure Report - created at 2025-07-29 15:54
|
5
|
+
Data Structure found from the search string: `All`
|
6
|
+
|
7
|
+
<a id="3e4bc9a1-2661-4d24-a753-b26060c61e34"></a>
|
8
|
+
# Data Structure Name:
|
9
|
+
|
10
|
+
## Qualified Name
|
11
|
+
[DataStruct::TBDF-Incoming Weekly Measurement Data](#3e4bc9a1-2661-4d24-a753-b26060c61e34)
|
12
|
+
|
13
|
+
## Description
|
14
|
+
This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial.
|
15
|
+
|
16
|
+
## GUID
|
17
|
+
3e4bc9a1-2661-4d24-a753-b26060c61e34
|
18
|
+
|
19
|
+
[[Data Structure]]
|
pyegeria/_output_formats.py
CHANGED
@@ -5,18 +5,24 @@ Copyright Contributors to the ODPi Egeria project.
|
|
5
5
|
|
6
6
|
"""
|
7
7
|
# Purpose
|
8
|
+
This file manages output format sets.
|
9
|
+
|
8
10
|
pyegeria allows find and get requests to generate output in different output formats -
|
9
11
|
including DICT, MD, FORM, REPORT, LIST, MERMAID, TABLE, and perhaps additional ones in the future.
|
10
12
|
|
11
|
-
Some of the formats, such as REPORT and LIST,
|
13
|
+
Some of the formats, such as REPORT and LIST, allow the user to filter which attributes to
|
12
14
|
display, and the order in which they appear. However, many, if not most users will likely not want to customize
|
13
15
|
the column list and so we need a sensible set of defaults for each type of output. These defaults are used
|
14
16
|
by the find and get methods if the user doesn't provide a value for the columns parameter.
|
15
17
|
|
16
|
-
This file contains these defaults and a function to return the
|
17
|
-
|
18
|
+
This file contains these defaults and a function to return the right default dict for a given type.
|
18
19
|
"""
|
19
20
|
|
21
|
+
from loguru import logger
|
22
|
+
|
23
|
+
# Constants
|
24
|
+
MD_SEPARATOR = "\n---\n\n"
|
25
|
+
|
20
26
|
# Define shared elements
|
21
27
|
COMMON_COLUMNS = [
|
22
28
|
{'name': 'Display Name', 'key': 'display_name'},
|
@@ -49,6 +55,11 @@ COLLECTION_DICT = {
|
|
49
55
|
"columns": COLLECTIONS_COLUMNS,
|
50
56
|
}
|
51
57
|
|
58
|
+
COLLECTION_TABLE = {
|
59
|
+
"types": ["TABLE"],
|
60
|
+
"columns": COMMON_COLUMNS,
|
61
|
+
}
|
62
|
+
|
52
63
|
COMMON_ANNOTATIONS = {
|
53
64
|
"wikilinks": ["[[Commons]]"]
|
54
65
|
}
|
@@ -85,7 +96,11 @@ output_format_sets = {
|
|
85
96
|
"aliases": ["Collection", "RootCollection", "Folder", "ReferenceList", "HomeCollection",
|
86
97
|
"ResultSet", "RecentAccess", "WorkItemList", "Namespace"],
|
87
98
|
"annotations": COMMON_ANNOTATIONS,
|
88
|
-
"formats": [COMMON_FORMATS_ALL, COLLECTION_DICT]
|
99
|
+
"formats": [COMMON_FORMATS_ALL, COLLECTION_DICT, COLLECTION_TABLE], # Reusing common formats
|
100
|
+
"action": [{"function": "CollectionManager.find_collections",
|
101
|
+
"user_params": [ "search_string"],
|
102
|
+
"spec_params": { },
|
103
|
+
}]
|
89
104
|
},
|
90
105
|
|
91
106
|
"DigitalProducts": {
|
@@ -107,6 +122,11 @@ output_format_sets = {
|
|
107
122
|
{'name': 'Members', 'key': 'members', 'format': True},
|
108
123
|
],
|
109
124
|
}
|
125
|
+
],
|
126
|
+
"action": [{"function": "CollectionManager.find_collections",
|
127
|
+
"user_params": [ "search_string"],
|
128
|
+
"spec_params": { "classification_name":"DigitalProducts"}
|
129
|
+
}
|
110
130
|
]
|
111
131
|
},
|
112
132
|
|
@@ -115,30 +135,63 @@ output_format_sets = {
|
|
115
135
|
"description": "Attributes generic to all Agreements.",
|
116
136
|
"aliases": ["DataSharingAgreement"],
|
117
137
|
"annotations": {"wikilinks": ["[[Agreements]]", "[[Egeria]]"]},
|
118
|
-
"formats": COMMON_FORMATS_ALL
|
138
|
+
"formats": [COMMON_FORMATS_ALL] # Reusing common formats and columns
|
119
139
|
},
|
120
140
|
|
121
|
-
"
|
141
|
+
"DataDictionary": {
|
122
142
|
"heading": "Data Dictionary Information",
|
123
143
|
"description": "Attributes useful to Data Dictionary.",
|
124
|
-
"aliases": ["Data Dict"],
|
144
|
+
"aliases": ["Data Dict", "Data Dictionary"],
|
125
145
|
"annotations": {"wikilinks": ["[[Data Dictionary]]"]},
|
126
|
-
"formats": COMMON_FORMATS_ALL # Reusing common formats and columns
|
146
|
+
"formats": [COMMON_FORMATS_ALL], # Reusing common formats and columns
|
147
|
+
"action": [{"function": "CollectionManager.find_collections",
|
148
|
+
"user_params": [ "search_string"],
|
149
|
+
"spec_params": { "classification_name": "DataDictionary" },
|
150
|
+
}]
|
127
151
|
},
|
128
152
|
|
129
153
|
"Data Specification": {
|
130
154
|
"heading": "Data Specification Information",
|
131
155
|
"description": "Attributes useful to Data Specification.",
|
132
|
-
"aliases": ["Data Spec"],
|
156
|
+
"aliases": ["Data Spec", "DataSpec", "DataSpecification"],
|
133
157
|
"annotations": {"wikilinks": ["[[Data Specification]]"]},
|
134
|
-
"formats":
|
158
|
+
"formats": [{"types": ["TABLE"], "columns": COMMON_COLUMNS,}], # Reusing common formats and columns
|
159
|
+
"action": [{"function": "CollectionManager.find_collections",
|
160
|
+
"user_params": [ "search_string"],
|
161
|
+
"spec_params": { "classification_name": "DataSpec" },
|
162
|
+
}]
|
163
|
+
},
|
164
|
+
"DataStruct": {
|
165
|
+
"heading": "Data Structure Information",
|
166
|
+
"description": "Attributes useful to Data Structures.",
|
167
|
+
"aliases": ["Data Structure", "DataStructures", "Data Structures", "Data Struct", "DataStructure"],
|
168
|
+
"annotations": {"wikilinks": ["[[Data Structure]]"]},
|
169
|
+
"formats": [{"types": ["ALL"], "columns" : COMMON_COLUMNS}], # Reusing common formats and columns
|
170
|
+
"action": [{"function": "DataDesigner.find_data_structures",
|
171
|
+
"user_params": ["search_string" ],
|
172
|
+
"spec_params": { },
|
173
|
+
}]
|
135
174
|
},
|
175
|
+
"Mandy-DataStruct": {
|
176
|
+
"heading": "Puddy Approves",
|
177
|
+
"description": "This is a tutorial on how to use a data struct description",
|
178
|
+
"aliases": [],
|
179
|
+
"annotations": {"wikilinks": ["[[Data Structure]]"]},
|
180
|
+
"formats": [{"types": ["TABLE"], "columns": COMMON_COLUMNS + [{'name': 'GUID', 'key': 'GUID'}]},
|
181
|
+
{ "types": ["DICT", "LIST", "REPORT"], "columns": COMMON_COLUMNS + [{'name': 'GUID', 'key': 'GUID'}]}
|
182
|
+
],
|
183
|
+
"action": [{
|
184
|
+
"function": "DataDesigner.find_data_structures",
|
185
|
+
"user_params": ["filter"],
|
186
|
+
"spec_params": {},
|
187
|
+
}]
|
188
|
+
},
|
136
189
|
}
|
137
190
|
|
138
|
-
|
139
191
|
def select_output_format_set(kind: str, output_type: str) -> dict | None:
|
140
192
|
"""
|
141
193
|
This function retrieves the appropriate output set configuration dictionary based on the `kind` and `output_type`.
|
194
|
+
If output_type = `ANY` that indicates this is just a test to see of the output format set exists.
|
142
195
|
|
143
196
|
:param kind: The kind of output set (e.g., "Referenceable", "Collections").
|
144
197
|
:param output_type: The desired output format type (e.g., "DICT", "LIST", "REPORT").
|
@@ -147,17 +200,14 @@ def select_output_format_set(kind: str, output_type: str) -> dict | None:
|
|
147
200
|
Returns:
|
148
201
|
dict | None:
|
149
202
|
"""
|
150
|
-
from loguru import logger
|
151
|
-
# from pyegeria.logging_configuration import config_logging
|
152
|
-
|
153
|
-
# config_logging()
|
154
|
-
|
155
203
|
# Normalize the output type to uppercase for consistency
|
204
|
+
output_sets = output_format_sets
|
205
|
+
|
156
206
|
output_type = output_type.upper()
|
157
207
|
output_struct:dict = {}
|
158
208
|
|
159
209
|
# Step 1: Check if `kind` exists in the `output_format_sets` dictionary
|
160
|
-
element =
|
210
|
+
element = output_sets.get(kind)
|
161
211
|
|
162
212
|
# Step 2: If not found, attempt to match `kind` in aliases
|
163
213
|
if element is None:
|
@@ -170,7 +220,7 @@ def select_output_format_set(kind: str, output_type: str) -> dict | None:
|
|
170
220
|
|
171
221
|
# Step 3: If still not found, return None
|
172
222
|
if element is None:
|
173
|
-
msg = "No matching column set found for kind='{kind}' and output type='{output_type}'."
|
223
|
+
msg = f"No matching column set found for kind='{kind}' and output type='{output_type}'."
|
174
224
|
logger.error(msg)
|
175
225
|
return None
|
176
226
|
else:
|
@@ -178,6 +228,12 @@ def select_output_format_set(kind: str, output_type: str) -> dict | None:
|
|
178
228
|
output_struct["heading"] = element.get("heading", [])
|
179
229
|
output_struct["description"] = element.get("description", [])
|
180
230
|
output_struct["annotations"] = element.get("annotations", {})
|
231
|
+
if "action" in element:
|
232
|
+
output_struct["action"] = element.get("action", [])
|
233
|
+
|
234
|
+
# If this was just a validation that the format set could be found then the output type is ANY - so just return.
|
235
|
+
if output_type == "ANY":
|
236
|
+
return output_struct
|
181
237
|
|
182
238
|
# Step 4: Search for a matching format in the `formats` list
|
183
239
|
for format in element.get("formats", []):
|
@@ -193,4 +249,12 @@ def select_output_format_set(kind: str, output_type: str) -> dict | None:
|
|
193
249
|
|
194
250
|
# Step 6: If no match is found, return None
|
195
251
|
logger.error(f"No matching format found for kind='{kind}' with output type='{output_type}'.")
|
196
|
-
return None
|
252
|
+
return None
|
253
|
+
|
254
|
+
def output_format_set_list()->list[str]:
|
255
|
+
return list(output_format_sets.keys())
|
256
|
+
|
257
|
+
def get_output_format_set_heading(format_set: str) -> str:
|
258
|
+
return output_format_sets[format_set].get("heading")
|
259
|
+
def get_output_format_set_description(format_set: str) -> str:
|
260
|
+
return output_format_sets[format_set].get("description")
|
@@ -11,7 +11,7 @@ from typing import Dict, Union, List, Optional
|
|
11
11
|
|
12
12
|
from loguru import logger
|
13
13
|
|
14
|
-
from pyegeria import select_output_format_set
|
14
|
+
from pyegeria._output_formats import select_output_format_set
|
15
15
|
from pyegeria._client import Client
|
16
16
|
from pyegeria._globals import NO_ELEMENTS_FOUND, NO_GUID_RETURNED, NO_MEMBERS_FOUND
|
17
17
|
from pyegeria._validators import validate_guid, validate_search_string
|
pyegeria/data_designer_omvs.py
CHANGED
@@ -11,9 +11,10 @@ import asyncio
|
|
11
11
|
from os import terminal_size
|
12
12
|
|
13
13
|
from httpx import Response
|
14
|
+
from loguru import logger
|
14
15
|
from prompt_toolkit import data_structures
|
15
16
|
|
16
|
-
from pyegeria import select_output_format_set
|
17
|
+
from pyegeria._output_formats import select_output_format_set
|
17
18
|
from pyegeria._client import Client, max_paging_size
|
18
19
|
from pyegeria._globals import NO_ELEMENTS_FOUND
|
19
20
|
from pyegeria.output_formatter import (extract_mermaid_only, extract_basic_dict, generate_output,
|
@@ -1328,15 +1329,15 @@ r replace_all_properties: bool, default = False
|
|
1328
1329
|
output_format, columns_struct))
|
1329
1330
|
return response
|
1330
1331
|
|
1331
|
-
async def _async_find_data_structures(self,
|
1332
|
+
async def _async_find_data_structures(self, search_string: str, start_from: int = 0, page_size: int = max_paging_size,
|
1332
1333
|
starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True,
|
1333
|
-
output_format: str = 'JSON',
|
1334
|
+
output_format: str = 'JSON', output_format_set: str|dict = None) -> list | str:
|
1334
1335
|
""" Find the list of data structure metadata elements that contain the search string.
|
1335
1336
|
Async version.
|
1336
1337
|
|
1337
1338
|
Parameters
|
1338
1339
|
----------
|
1339
|
-
|
1340
|
+
search_string: str
|
1340
1341
|
- search string to filter on.
|
1341
1342
|
start_from: int, default = 0
|
1342
1343
|
- index of the list to start from (0 for start).
|
@@ -1350,7 +1351,7 @@ r replace_all_properties: bool, default = False
|
|
1350
1351
|
- If True, the case of the search string is ignored.
|
1351
1352
|
output_format: str, default = "DICT"
|
1352
1353
|
- one of "DICT", "MERMAID" or "JSON"
|
1353
|
-
|
1354
|
+
output_format_set: dict|str, optional, default = None
|
1354
1355
|
- The desired output columns/field options.
|
1355
1356
|
Returns
|
1356
1357
|
-------
|
@@ -1367,10 +1368,10 @@ r replace_all_properties: bool, default = False
|
|
1367
1368
|
the requesting user is not authorized to issue this request.
|
1368
1369
|
|
1369
1370
|
"""
|
1370
|
-
if
|
1371
|
-
|
1371
|
+
if search_string == "*":
|
1372
|
+
search_string = None
|
1372
1373
|
|
1373
|
-
body = {"filter":
|
1374
|
+
body = {"filter": search_string}
|
1374
1375
|
starts_with_s = str(starts_with).lower()
|
1375
1376
|
ends_with_s = str(ends_with).lower()
|
1376
1377
|
ignore_case_s = str(ignore_case).lower()
|
@@ -1379,8 +1380,6 @@ r replace_all_properties: bool, default = False
|
|
1379
1380
|
[("startFrom", start_from), ("pageSize", page_size), ("startsWith", ends_with_s), ("endsWith", ends_with_s),
|
1380
1381
|
("ignoreCase", ignore_case_s),])
|
1381
1382
|
|
1382
|
-
|
1383
|
-
|
1384
1383
|
url = (f"{base_path(self, self.view_server)}/data-structures/by-search-string"
|
1385
1384
|
f"{possible_query_params}")
|
1386
1385
|
|
@@ -1391,17 +1390,17 @@ r replace_all_properties: bool, default = False
|
|
1391
1390
|
return NO_ELEMENTS_FOUND
|
1392
1391
|
|
1393
1392
|
if output_format != 'JSON': # return a simplified markdown representation
|
1394
|
-
return self._generate_data_structure_output(elements, filter, output_format,
|
1393
|
+
return self._generate_data_structure_output(elements, filter, output_format, output_format_set)
|
1395
1394
|
return elements
|
1396
1395
|
|
1397
|
-
def find_data_structures(self,
|
1396
|
+
def find_data_structures(self, search_string: str, start_from: int = 0, page_size: int = max_paging_size,
|
1398
1397
|
starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True,
|
1399
|
-
output_format: str = 'JSON',
|
1398
|
+
output_format: str = 'JSON', output_format_set:str| dict = None) -> list | str:
|
1400
1399
|
""" Retrieve the list of data structure metadata elements that contain the search string filter.
|
1401
1400
|
|
1402
1401
|
Parameters
|
1403
1402
|
----------
|
1404
|
-
|
1403
|
+
search_string: str
|
1405
1404
|
- search string to filter on.
|
1406
1405
|
start_from: int, default = 0
|
1407
1406
|
- index of the list to start from (0 for start).
|
@@ -1416,7 +1415,7 @@ r replace_all_properties: bool, default = False
|
|
1416
1415
|
output_format: str, default = "DICT"
|
1417
1416
|
output_format: str, default = "DICT"
|
1418
1417
|
- one of "DICT", "MERMAID" or "JSON"
|
1419
|
-
|
1418
|
+
output_format_set: dict|str, optional, default = None
|
1420
1419
|
- The desired output columns/field options.
|
1421
1420
|
|
1422
1421
|
Returns
|
@@ -1438,8 +1437,8 @@ r replace_all_properties: bool, default = False
|
|
1438
1437
|
|
1439
1438
|
loop = asyncio.get_event_loop()
|
1440
1439
|
response = loop.run_until_complete(
|
1441
|
-
self._async_find_data_structures(
|
1442
|
-
output_format,
|
1440
|
+
self._async_find_data_structures(search_string, start_from, page_size, starts_with, ends_with, ignore_case,
|
1441
|
+
output_format, output_format_set))
|
1443
1442
|
return response
|
1444
1443
|
|
1445
1444
|
async def _async_get_data_structures_by_name(self, filter: str, body: dict = None, start_from: int = 0,
|
@@ -5381,7 +5380,7 @@ r replace_all_properties: bool, default = False
|
|
5381
5380
|
)
|
5382
5381
|
|
5383
5382
|
|
5384
|
-
def _generate_data_structure_output(self, elements, filter, output_format,
|
5383
|
+
def _generate_data_structure_output(self, elements, filter, output_format: str = "DICT", output_format_set: str|dict = None) -> str | list:
|
5385
5384
|
"""
|
5386
5385
|
Generate output for data structures in the specified format.
|
5387
5386
|
|
@@ -5394,17 +5393,24 @@ r replace_all_properties: bool, default = False
|
|
5394
5393
|
Formatted output as string or list of dictionaries
|
5395
5394
|
"""
|
5396
5395
|
entity_type = "Data Structure"
|
5397
|
-
if
|
5398
|
-
|
5399
|
-
|
5400
|
-
|
5396
|
+
if output_format_set is None:
|
5397
|
+
output_format_set = select_output_format_set(entity_type, output_format)
|
5398
|
+
|
5399
|
+
if output_format_set:
|
5400
|
+
if isinstance(output_format_set, str):
|
5401
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
5402
|
+
if isinstance(output_format_set, dict):
|
5403
|
+
output_formats = output_format_set
|
5404
|
+
else:
|
5405
|
+
output_formats = None
|
5406
|
+
logger.trace(f"Executing generate_data_structure_output for {entity_type}: {output_formats}")
|
5401
5407
|
return generate_output(elements,
|
5402
5408
|
filter,
|
5403
5409
|
entity_type,
|
5404
5410
|
output_format,
|
5405
5411
|
self._extract_data_structure_properties,
|
5406
5412
|
None,
|
5407
|
-
|
5413
|
+
output_formats,
|
5408
5414
|
)
|
5409
5415
|
|
5410
5416
|
def _generate_data_class_output(self, elements: dict, filter: str, output_format: str, columns_struct: dict = None) -> str | list:
|
pyegeria/load_config.py
CHANGED
@@ -49,8 +49,8 @@ def load_app_config():
|
|
49
49
|
config = {
|
50
50
|
"Environment": {
|
51
51
|
"Console Width": 200,
|
52
|
-
"Dr.
|
53
|
-
"Dr.
|
52
|
+
"Dr.Egeria Inbox": "md_processing/dr-egeria-inbox",
|
53
|
+
"Dr.Egeria Outbox": "md_processing/dr-egeria-outbox",
|
54
54
|
"Egeria Engine Host URL": "",
|
55
55
|
"Egeria Engine Host": "qs-engine-host",
|
56
56
|
"Egeria Glossary Path": "glossary",
|
@@ -123,9 +123,9 @@ def load_app_config():
|
|
123
123
|
env = config["Environment"]
|
124
124
|
env["Console Width"] = int(os.getenv("PYEGERIA_CONSOLE_WIDTH", env.get("EGERIA_WIDTH", 200)))
|
125
125
|
env["Dr.Egeria Inbox"] = os.getenv("DR_EGERIA_INBOX_PATH", env.get("Dr_EGERIA_INBOX",
|
126
|
-
"
|
126
|
+
"md_processing/dr-egeria-inbox"))
|
127
127
|
env["Dr.Egeria Outbox"] = os.getenv("DR_EGERIA_OUTBOX_PATH", env.get("DR_EGERIA_OUTBOX",
|
128
|
-
"
|
128
|
+
"md_processing/dr-egeria-outbox"))
|
129
129
|
env["Egeria Engine Host"] = os.getenv("EGERIA_ENGINE_HOST", env.get("Egeria Engine Host", "qs-engine-host"))
|
130
130
|
env["Egeria Engine Host URL"] = os.getenv("EGERIA_ENGINE_HOST_URL",env.get("Egeria Engine Host URL", "https://localhost:9443"))
|
131
131
|
|
pyegeria/output_formatter.py
CHANGED
@@ -4,12 +4,19 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
|
4
4
|
from pyegeria.utils import (camel_to_title_case)
|
5
5
|
from markdown_it import MarkdownIt
|
6
6
|
from rich.console import Console
|
7
|
+
from loguru import logger
|
7
8
|
|
8
9
|
from pyegeria.mermaid_utilities import construct_mermaid_web
|
10
|
+
from pyegeria._output_formats import select_output_format_set, MD_SEPARATOR
|
11
|
+
|
12
|
+
"""
|
13
|
+
Note on select_output_format_set function:
|
14
|
+
|
15
|
+
This function and related data structures have been moved back to _output_formats.py.
|
16
|
+
Please import select_output_format_set from pyegeria._output_formats instead of from this module.
|
17
|
+
"""
|
9
18
|
|
10
19
|
console = Console(width= 250)
|
11
|
-
# Constants
|
12
|
-
MD_SEPARATOR = "\n---\n\n"
|
13
20
|
|
14
21
|
|
15
22
|
def _extract_referenceable_properties(element: dict[str, Any]) -> dict[str, Any]:
|