pyegeria 5.3.6.2.4__py3-none-any.whl → 5.3.6.3__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 (31) hide show
  1. pyegeria/__init__.py +3 -0
  2. pyegeria/commands/cat/{freddies-inbox → dr_egeria_inbox}/freddie_intro.md +64 -16
  3. pyegeria/commands/cat/{freddie_jupyter.py → dr_egeria_jupyter.py} +8 -16
  4. pyegeria/commands/cat/{freddie_md.py → dr_egeria_md.py} +29 -32
  5. pyegeria/commands/cat/glossary_actions.py +59 -1
  6. pyegeria/commands/cat/list_categories.py +185 -0
  7. pyegeria/commands/cat/list_glossaries.py +26 -33
  8. pyegeria/commands/cat/list_terms.py +47 -47
  9. pyegeria/commands/cli/egeria.py +51 -61
  10. pyegeria/commands/cli/egeria_cat.py +53 -31
  11. pyegeria/create_tech_guid_lists.py +2 -5
  12. pyegeria/glossary_browser_omvs.py +257 -105
  13. pyegeria/glossary_manager_omvs.py +148 -1591
  14. pyegeria/md_processing_utils.py +816 -0
  15. {pyegeria-5.3.6.2.4.dist-info → pyegeria-5.3.6.3.dist-info}/METADATA +1 -1
  16. {pyegeria-5.3.6.2.4.dist-info → pyegeria-5.3.6.3.dist-info}/RECORD +21 -29
  17. {pyegeria-5.3.6.2.4.dist-info → pyegeria-5.3.6.3.dist-info}/entry_points.txt +5 -0
  18. pyegeria/commands/cat/freddie_jup.py +0 -124
  19. pyegeria/commands/cat/freddie_utils.py +0 -590
  20. pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-19-29-Report.md +0 -69
  21. pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-20-30-Update-Form.md +0 -78
  22. pyegeria/commands/cat/glossary_creation_experiment.ipynb +0 -235
  23. pyegeria/test_j.html +0 -0
  24. pyegeria/test_m.html +0 -213
  25. pyegeria/test_m1.html +0 -273
  26. pyegeria/test_mer.ipynb +0 -596
  27. pyegeria/test_w.html +0 -213
  28. /pyegeria/commands/cat/{freddies-inbox → dr_egeria_inbox}/glossary_creation_experiment.ipynb +0 -0
  29. /pyegeria/commands/cat/{freddies-inbox → dr_egeria_inbox}/glossary_exp.md +0 -0
  30. {pyegeria-5.3.6.2.4.dist-info → pyegeria-5.3.6.3.dist-info}/LICENSE +0 -0
  31. {pyegeria-5.3.6.2.4.dist-info → pyegeria-5.3.6.3.dist-info}/WHEEL +0 -0
@@ -15,7 +15,7 @@ import json
15
15
  from pyegeria._client import Client
16
16
  from pyegeria._validators import validate_guid, validate_name, validate_search_string
17
17
  from pyegeria.utils import body_slimmer
18
- from pyegeria._globals import NO_ELEMENTS_FOUND
18
+ from pyegeria._globals import NO_ELEMENTS_FOUND, NO_CATALOGS_FOUND, NO_CATEGORIES_FOUND, NO_TERMS_FOUND
19
19
  MD_SEPERATOR = "\n---\n\n"
20
20
 
21
21
  class GlossaryBrowser(Client):
@@ -53,15 +53,48 @@ class GlossaryBrowser(Client):
53
53
 
54
54
  Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
55
55
 
56
- def generate_glossaries_md(self, elements: list, search_string: str, form:bool = True)-> str:
57
- if form:
58
- elements_md = f"# Update Glossaries Form - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
59
- elements_action = "Update Glossary"
60
- else:
61
- elements_md = f"# Glossaries Report - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
56
+
57
+ def make_preamble(self, obj_type, search_string, output_format: str = 'MD')-> tuple[str, str | None]:
58
+ """
59
+ Creates a preamble string and an elements action based on the given object type, search string,
60
+ and output format. The preamble provides a descriptive header based on the intent: To make a form,
61
+ a report, or unadorned markdwon. The elements action specifies the action to be taken on the object type.
62
+
63
+ Args:
64
+ obj_type: The type of object being updated or reported on (e.g., "Product", "Category").
65
+ search_string: The search string used to filter objects. Defaults to "All Terms" if None.
66
+ output_format: A format identifier determining the output structure.
67
+ JSON - output standard json
68
+ MD - output standard markdown with no preamble
69
+ FORM - output markdown with a preamble for a form
70
+ REPORT - output markdown with a preamble for a report
71
+
72
+ Returns:
73
+ tuple: A tuple containing:
74
+ - A string representing the formatted update or report preamble.
75
+ - A string or None indicating the action description for the elements,
76
+ depending on the output format.
77
+ """
78
+ search_string = search_string if search_string else "All Terms"
79
+ elements_action = "Update " + obj_type
80
+ if output_format == "FORM":
81
+ preamble = (f"\n# Update {obj_type} Form - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
82
+ f"\t {obj_type} found from the search string: `{search_string}`\n\n")
83
+
84
+ return preamble, elements_action
85
+ elif output_format == "REPORT":
86
+ elements_md = (f"# {obj_type} Report - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
87
+ f"\t{obj_type} found from the search string: `{search_string}`\n\n")
62
88
  elements_action = None
63
- search_string = search_string if search_string else "All Glossaries"
64
- elements_md += f"Glossaries found from the search string: `{search_string}`\n\n"
89
+ return elements_md, elements_action
90
+ else:
91
+ return "\n", elements_action
92
+
93
+ def generate_glossaries_md(self, elements: list | dict, search_string: str, output_format: str = 'MD')-> str:
94
+ elements_md, elements_action = self.make_preamble(obj_type="Glossary", search_string=search_string,
95
+ output_format=output_format)
96
+ if isinstance(elements, dict):
97
+ elements = [elements]
65
98
 
66
99
  for element in elements:
67
100
  guid = element['elementHeader'].get("guid", None)
@@ -72,12 +105,15 @@ class GlossaryBrowser(Client):
72
105
  usage = properties.get("usage", None)
73
106
  qualified_name = properties.get("qualifiedName", None)
74
107
 
75
- if form:
108
+ if output_format == 'FORM':
76
109
  elements_md += f"# {elements_action}\n\n"
77
- elements_md += f"## Glossary Name \n{display_name}\n\n"
78
- else:
110
+ elements_md += f"## Glossary Name \n\n{display_name}\n\n"
111
+ elements_md += "## Update Description\n\n\n"
112
+ elif output_format == 'REPORT':
79
113
  elements_md += f"# Glossary Name: {display_name}\n\n"
80
-
114
+ else:
115
+ elements_md += f"## Glossary Name \n\n{display_name}\n\n"
116
+ elements_md += "## Update Description\n\n\n"
81
117
 
82
118
  elements_md += f"## Description\n{description}\n\n"
83
119
  elements_md += f"## Language\n{language}\n\n"
@@ -87,15 +123,10 @@ class GlossaryBrowser(Client):
87
123
  elements_md += MD_SEPERATOR
88
124
  return elements_md
89
125
 
90
- def generate_terms_md(self, elements: list, search_string: str, form:bool = True)-> str:
91
- if form:
92
- elements_md = f"# Update terms Form - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
93
- elements_action = "Update Terms"
94
- else:
95
- elements_md = f"# Glossary Terms Report - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
96
- elements_action = None
97
- search_string = search_string if search_string else "All Terms"
98
- elements_md += f"Terms found from the search string: `{search_string}`\n\n"
126
+ def generate_terms_md(self, elements: list | dict, search_string: str, output_format: str = 'MD') -> str:
127
+ elements_md, elements_action = self.make_preamble(obj_type="Terms", search_string=search_string, output_format=output_format)
128
+ if isinstance(elements, dict):
129
+ elements = [elements]
99
130
 
100
131
  for element in elements:
101
132
  guid = element['elementHeader'].get("guid", None)
@@ -107,20 +138,70 @@ class GlossaryBrowser(Client):
107
138
  usage = element_properties.get("usage", None)
108
139
  pub_version = element_properties.get("publishedVersionIdentifier", None)
109
140
  qualified_name = element_properties.get("qualifiedName", None)
110
- status = element['elementHeader']['classifications'][0].get('status', None)
141
+ status = element['elementHeader'].get('status', None)
142
+
143
+ category_list_md = "\n"
144
+ category_list = self.get_categories_for_term(guid)
145
+ if type(category_list) is str and category_list == NO_CATEGORIES_FOUND:
146
+ category_list_md = ['---']
147
+ elif isinstance(category_list, list) and len(category_list) > 0:
148
+ for category in category_list:
149
+ category_name = category["glossaryCategoryProperties"].get("displayName", '---')
150
+ category_list_md += f" {category_name}\n"
151
+
152
+ if output_format == 'FORM':
153
+ elements_md += f"# {elements_action}\n\n"
154
+ elements_md += f"## Term Name \n\n{display_name}\n\n"
155
+ elements_md += "## Update Description\n\n\n"
156
+ elif output_format == 'REPORT':
157
+ elements_md += f"# Term Name: {display_name}\n\n"
158
+ else:
159
+ elements_md += f"## Term Name \n\n{display_name}\n\n"
160
+ elements_md += "## Update Description\n\n\n"
161
+ elements_md += f"## Categories\n\n{category_list_md}\n\n"
162
+ elements_md += f"## Status\n\n{status}\n\n"
163
+ elements_md += f"## Summary\n\n{summary}\n\n"
164
+ elements_md += f"## Description\n\n{description}\n\n"
165
+ elements_md += f"## Examples\n\n{examples}\n\n"
166
+ elements_md += f"## Usage\n\n{usage}\n\n"
167
+ elements_md += f"## Published Version\n\n{pub_version}\n\n"
168
+ elements_md += f"## Qualified Name\n\n{qualified_name}\n\n"
169
+ elements_md += f"## GUID\n\n{guid}\n\n"
170
+ elements_md += MD_SEPERATOR
171
+ return elements_md
111
172
 
112
- if form:
173
+ def generate_categories_md(self, elements: list | dict, search_string: str, output_format: str = 'MD')-> str:
174
+ elements_md, elements_action = self.make_preamble(obj_type="Categories", search_string=search_string,
175
+ output_format=output_format)
176
+ if isinstance(elements, dict):
177
+ elements = [elements]
178
+
179
+ for element in elements:
180
+ guid = element['elementHeader'].get("guid", None)
181
+ properties = element['glossaryCategoryProperties']
182
+ display_name = properties.get("displayName", None)
183
+ description = properties.get("description", None)
184
+ qualified_name = properties.get("qualifiedName", None)
185
+
186
+ classification_props = element["elementHeader"]['classifications'][0].get('classificationProperties', None)
187
+ glossary_qualified_name = '---'
188
+ if classification_props is not None:
189
+ glossary_guid = classification_props.get('anchorGUID', '---')
190
+ glossary_qualified_name = (
191
+ self.get_glossary_by_guid(glossary_guid))['glossaryProperties']['qualifiedName']
192
+
193
+ if output_format == 'FORM':
113
194
  elements_md += f"# {elements_action}\n\n"
114
- elements_md += f"## Term Name \n{display_name}\n\n"
195
+ elements_md += f"## Category Name \n\n{display_name}\n\n"
196
+ elements_md += "## Update Description\n\n\n"
197
+ elif output_format == 'REPORT':
198
+ elements_md += f"# Category Name: {display_name}\n\n"
115
199
  else:
116
- elements_md += f"# Term Name: {display_name}\n\n"
200
+ elements_md += f"## Category Name \n\n{display_name}\n\n"
201
+ elements_md += "## Update Description\n\n\n"
117
202
 
118
- elements_md += f"## Status\n{status}\n\n"
119
- elements_md += f"## Summary\n{summary}\n\n"
120
203
  elements_md += f"## Description\n{description}\n\n"
121
- elements_md += f"## Examples\n{examples}\n\n"
122
- elements_md += f"## Usage\n{usage}\n\n"
123
- elements_md += f"## Published Version\n{pub_version}\n\n"
204
+ elements_md += f"## In Glossary (Qualified Name)\n{glossary_qualified_name}\n\n"
124
205
  elements_md += f"## Qualified Name\n{qualified_name}\n\n"
125
206
  elements_md += f"## GUID\n{guid}\n\n"
126
207
  elements_md += MD_SEPERATOR
@@ -267,8 +348,7 @@ class GlossaryBrowser(Client):
267
348
  type_name: str = None,
268
349
  start_from: int = 0,
269
350
  page_size: int = None,
270
- md: bool = False,
271
- form: bool = True
351
+ output_format: str = 'JSON'
272
352
  ) -> list | str:
273
353
  """Retrieve the list of glossary metadata elements that contain the search string. Async version.
274
354
  The search string is located in the request body and is interpreted as a plain string.
@@ -301,11 +381,12 @@ class GlossaryBrowser(Client):
301
381
  page_size: int, [default=None]
302
382
  The number of items to return in a single page. If not specified, the default will be taken from
303
383
  the class instance.
304
- md: bool, [default=False]
305
- If true, a simplified markdown representation of the glossary will be returned
306
- form: bool, [default=True]
307
- If true and md is true, a form for the glossaries will be returned as a markdown string.
308
- If false and md is true, a report for the glossaries will be returned.
384
+ output_format: str, default = 'JSON'
385
+ Type of output to produce:
386
+ JSON - output standard json
387
+ MD - output standard markdown with no preamble
388
+ FORM - output markdown with a preamble for a form
389
+ REPORT - output markdown with a preamble for a report
309
390
 
310
391
  Returns
311
392
  -------
@@ -353,14 +434,15 @@ class GlossaryBrowser(Client):
353
434
  f"forDuplicateProcessing={for_duplicate_processing_s}"
354
435
  )
355
436
 
356
- response = await self._async_make_request("POST", url, body)
357
- glossary_elements = response.json().get("elementList", NO_GLOSSARIES_FOUND)
358
- if glossary_elements == NO_GLOSSARIES_FOUND:
437
+ response = await self._async_make_request("POST", url, body_slimmer(body))
438
+ element = response.json().get("elementList", NO_GLOSSARIES_FOUND)
439
+ if element == NO_GLOSSARIES_FOUND:
359
440
  return NO_GLOSSARIES_FOUND
360
- if md: # return a simplified markdown representation
361
- return self.generate_glossaries_md(glossary_elements, search_string,form)
441
+ if output_format != 'JSON': # return a simplified markdown representation
442
+ return self.generate_glossaries_md(element, search_string, output_format)
362
443
  return response.json().get("elementList", NO_GLOSSARIES_FOUND)
363
444
 
445
+
364
446
  def find_glossaries(
365
447
  self,
366
448
  search_string: str,
@@ -373,8 +455,7 @@ class GlossaryBrowser(Client):
373
455
  type_name: str = None,
374
456
  start_from: int = 0,
375
457
  page_size: int = None,
376
- md: bool = False,
377
- form: bool = True
458
+ output_format: str = "JSON"
378
459
  ) -> list | str:
379
460
  """Retrieve the list of glossary metadata elements that contain the search string.
380
461
  The search string is located in the request body and is interpreted as a plain string.
@@ -408,11 +489,12 @@ class GlossaryBrowser(Client):
408
489
  page_size: int, [default=None]
409
490
  The number of items to return in a single page. If not specified, the default will be taken from
410
491
  the class instance.
411
- md: bool, [default=False]
412
- If true, a simplified markdown representation of the glossary will be returned
413
- form: bool, [default=True]
414
- If true and md is true, a form for the glossaries will be returned as a markdown string.
415
- If false and md is true, a report for the glossaries will be returned.
492
+ output_format: str, default = 'JSON'
493
+ Type of output to produce:
494
+ JSON - output standard json
495
+ MD - output standard markdown with no preamble
496
+ FORM - output markdown with a preamble for a form
497
+ REPORT - output markdown with a preamble for a report
416
498
  Returns
417
499
  -------
418
500
  List | str
@@ -443,15 +525,14 @@ class GlossaryBrowser(Client):
443
525
  type_name,
444
526
  start_from,
445
527
  page_size,
446
- md,
447
- form
528
+ output_format
448
529
  )
449
530
  )
450
531
 
451
532
  return response
452
533
 
453
534
  async def _async_get_glossary_by_guid(
454
- self, glossary_guid: str, effective_time: str = None
535
+ self, glossary_guid: str, effective_time: str = None, output_format: str = "JSON"
455
536
  ) -> dict:
456
537
  """Retrieves information about a glossary
457
538
  Parameters
@@ -461,6 +542,13 @@ class GlossaryBrowser(Client):
461
542
  effective_time: str, optional
462
543
  Effective time of the query. If not specified will default to any time. Time format is
463
544
  "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
545
+ output_format: str, default = 'JSON'
546
+ Type of output to produce:
547
+ JSON - output standard json
548
+ MD - output standard markdown with no preamble
549
+ FORM - output markdown with a preamble for a form
550
+ REPORT - output markdown with a preamble for a report
551
+
464
552
  Returns
465
553
  -------
466
554
  dict
@@ -477,22 +565,28 @@ class GlossaryBrowser(Client):
477
565
  Notes
478
566
  -----
479
567
  """
480
-
568
+ output_format = output_format.upper()
481
569
  validate_guid(glossary_guid)
482
570
 
483
571
  body = {
484
572
  "class": "EffectiveTimeQueryRequestBody",
485
- "effectiveTime": effective_time
573
+ "effectiveTime" : effective_time
486
574
  }
487
575
  url = (
488
576
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
489
577
  f"{glossary_guid}/retrieve"
490
578
  )
491
- response = await self._async_make_request("POST", url, body)
579
+ response = await self._async_make_request("POST", url, body_slimmer(body))
580
+ element = response.json().get("element", NO_GLOSSARIES_FOUND)
581
+ if element == NO_GLOSSARIES_FOUND:
582
+ return NO_GLOSSARIES_FOUND
583
+ if output_format != 'JSON': # return a simplified markdown representation
584
+ return self.generate_glossaries_md(element, "GUID", output_format)
492
585
  return response.json().get("element", NO_GLOSSARIES_FOUND)
493
586
 
587
+
494
588
  def get_glossary_by_guid(
495
- self, glossary_guid: str, effective_time: str = None
589
+ self, glossary_guid: str, effective_time: str = None, output_format: str = "JSON"
496
590
  ) -> dict:
497
591
  """Retrieves information about a glossary
498
592
  Parameters
@@ -502,6 +596,12 @@ class GlossaryBrowser(Client):
502
596
  effective_time: str, optional
503
597
  Effective time of the query. If not specified will default to any time. Time format is
504
598
  "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
599
+ output_format: str, default = 'JSON'
600
+ Type of output to produce:
601
+ JSON - output standard json
602
+ MD - output standard markdown with no preamble
603
+ FORM - output markdown with a preamble for a form
604
+ REPORT - output markdown with a preamble for a report
505
605
 
506
606
  Returns
507
607
  -------
@@ -521,7 +621,7 @@ class GlossaryBrowser(Client):
521
621
  """
522
622
  loop = asyncio.get_event_loop()
523
623
  response = loop.run_until_complete(
524
- self._async_get_glossary_by_guid(glossary_guid, effective_time)
624
+ self._async_get_glossary_by_guid(glossary_guid, effective_time, output_format)
525
625
  )
526
626
  return response
527
627
 
@@ -738,6 +838,7 @@ class GlossaryBrowser(Client):
738
838
  ignore_case: bool = False,
739
839
  start_from: int = 0,
740
840
  page_size: int = None,
841
+ output_format: str = "JSON"
741
842
  ) -> list | str:
742
843
  """Retrieve the list of glossary category metadata elements that contain the search string.
743
844
  The search string is located in the request body and is interpreted as a plain string.
@@ -765,6 +866,13 @@ class GlossaryBrowser(Client):
765
866
  page_size: int, [default=None]
766
867
  The number of items to return in a single page. If not specified, the default will be taken from
767
868
  the class instance.
869
+ output_format: str, default = 'JSON'
870
+ Type of output to produce:
871
+ JSON - output standard json
872
+ MD - output standard markdown with no preamble
873
+ FORM - output markdown with a preamble for a form
874
+ REPORT - output markdown with a preamble for a report
875
+
768
876
  Returns
769
877
  -------
770
878
  List | str
@@ -799,17 +907,25 @@ class GlossaryBrowser(Client):
799
907
  "searchString": search_string,
800
908
  "effectiveTime": effective_time,
801
909
  }
802
- body = body_slimmer(body)
803
910
 
804
911
  url = (
805
912
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
806
913
  f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
807
914
  f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
808
915
  )
809
-
810
- response = await self._async_make_request("POST", url, body)
916
+ response = await self._async_make_request("POST", url, body_slimmer(body))
917
+ element = response.json().get("elementList", NO_CATEGORIES_FOUND)
918
+ if element == NO_CATEGORIES_FOUND:
919
+ return NO_CATEGORIES_FOUND
920
+ if output_format != 'JSON': # return a simplified markdown representation
921
+ return self.generate_categories_md(element, search_string, output_format)
811
922
  return response.json().get("elementList", NO_CATEGORIES_FOUND)
812
923
 
924
+
925
+
926
+
927
+
928
+
813
929
  def find_glossary_categories(
814
930
  self,
815
931
  search_string: str,
@@ -819,6 +935,7 @@ class GlossaryBrowser(Client):
819
935
  ignore_case: bool = False,
820
936
  start_from: int = 0,
821
937
  page_size: int = None,
938
+ output_format: str = "JSON"
822
939
  ) -> list | str:
823
940
  """Retrieve the list of glossary category metadata elements that contain the search string.
824
941
  The search string is located in the request body and is interpreted as a plain string.
@@ -841,11 +958,18 @@ class GlossaryBrowser(Client):
841
958
  Ends with the supplied string
842
959
  ignore_case : bool, [default=False], optional
843
960
  Ignore case when searching
844
- start_from: int, [default=0], optional
961
+ start_from: int, [default=0], optional
845
962
  When multiple pages of results are available, the page number to start from.
846
- page_size: int, [default=None]
963
+ page_size: int, [default=None]
847
964
  The number of items to return in a single page. If not specified, the default will be taken from
848
965
  the class instance.
966
+ output_format: str, default = 'JSON'
967
+ Type of output to produce:
968
+ JSON - output standard json
969
+ MD - output standard markdown with no preamble
970
+ FORM - output markdown with a preamble for a form
971
+ REPORT - output markdown with a preamble for a report
972
+
849
973
  Returns
850
974
  -------
851
975
  List | str
@@ -873,6 +997,7 @@ class GlossaryBrowser(Client):
873
997
  ignore_case,
874
998
  start_from,
875
999
  page_size,
1000
+ output_format
876
1001
  )
877
1002
  )
878
1003
 
@@ -1127,7 +1252,7 @@ class GlossaryBrowser(Client):
1127
1252
  }
1128
1253
 
1129
1254
  response = await self._async_make_request("POST", url, body)
1130
- return response.json().get("elementList", "No Categories found")
1255
+ return response.json().get("elementList", NO_CATEGORIES_FOUND)
1131
1256
 
1132
1257
  def get_categories_by_name(
1133
1258
  self,
@@ -1186,6 +1311,7 @@ class GlossaryBrowser(Client):
1186
1311
  self,
1187
1312
  glossary_category_guid: str,
1188
1313
  effective_time: str = None,
1314
+ output_format: str = 'JSON',
1189
1315
  ) -> list | str:
1190
1316
  """Retrieve the requested glossary category metadata element. The optional request body contain an effective
1191
1317
  time for the query..
@@ -1200,7 +1326,12 @@ class GlossaryBrowser(Client):
1200
1326
  If specified, the category should only be returned if it was effective at the specified time.
1201
1327
  Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1202
1328
 
1203
- If not provided, the server name associated with the instance is used.
1329
+ output_format: str, default = 'JSON'
1330
+ Type of output to produce:
1331
+ JSON - output standard json
1332
+ MD - output standard markdown with no preamble
1333
+ FORM - output markdown with a preamble for a form
1334
+ REPORT - output markdown with a preamble for a report
1204
1335
 
1205
1336
  Returns
1206
1337
  -------
@@ -1219,7 +1350,7 @@ class GlossaryBrowser(Client):
1219
1350
  The principle specified by the user_id does not have authorization for the requested action
1220
1351
 
1221
1352
  """
1222
-
1353
+ output_format = output_format.upper()
1223
1354
  url = (
1224
1355
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
1225
1356
  f"{glossary_category_guid}/retrieve"
@@ -1230,13 +1361,19 @@ class GlossaryBrowser(Client):
1230
1361
  "effectiveTime": effective_time,
1231
1362
  }
1232
1363
 
1233
- response = await self._async_make_request("POST", url, body)
1234
- return response.json().get("element", "No Category found")
1364
+ response = await self._async_make_request("POST", url, body_slimmer(body))
1365
+ element = response.json().get("element", NO_CATEGORIES_FOUND)
1366
+ if element == NO_CATEGORIES_FOUND:
1367
+ return NO_CATEGORIES_FOUND
1368
+ if output_format != 'JSON': # return a simplified markdown representation
1369
+ return self.generate_categories_md(element, "GUID", output_format)
1370
+ return response.json().get("element", NO_CATEGORIES_FOUND)
1235
1371
 
1236
1372
  def get_categories_by_guid(
1237
1373
  self,
1238
1374
  glossary_category_guid: str,
1239
1375
  effective_time: str = None,
1376
+ output_format: str = 'JSON',
1240
1377
  ) -> list | str:
1241
1378
  """Retrieve the requested glossary category metadata element. The optional request body contain an effective
1242
1379
  time for the query..
@@ -1249,7 +1386,12 @@ class GlossaryBrowser(Client):
1249
1386
  If specified, the category should only be returned if it was effective at the specified time.
1250
1387
  Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1251
1388
 
1252
- If not provided, the server name associated with the instance is used.
1389
+ output_format: str, default = 'JSON'
1390
+ Type of output to produce:
1391
+ JSON - output standard json
1392
+ MD - output standard markdown with no preamble
1393
+ FORM - output markdown with a preamble for a form
1394
+ REPORT - output markdown with a preamble for a report
1253
1395
 
1254
1396
  Returns
1255
1397
  -------
@@ -1270,7 +1412,7 @@ class GlossaryBrowser(Client):
1270
1412
  """
1271
1413
  loop = asyncio.get_event_loop()
1272
1414
  response = loop.run_until_complete(
1273
- self._async_get_categories_by_guid(glossary_category_guid, effective_time)
1415
+ self._async_get_categories_by_guid(glossary_category_guid, effective_time, output_format)
1274
1416
  )
1275
1417
  return response
1276
1418
 
@@ -1390,7 +1532,6 @@ class GlossaryBrowser(Client):
1390
1532
  ----------
1391
1533
  glossary_category_guid : str
1392
1534
  Unique identifier for the glossary category to retrieve terms from.
1393
-
1394
1535
  effective_time : str, optional
1395
1536
  If specified, the terms are returned if they are active at the `effective_time
1396
1537
  Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
@@ -1400,7 +1541,7 @@ class GlossaryBrowser(Client):
1400
1541
  The number of elements to retrieve
1401
1542
  Returns
1402
1543
  -------
1403
- dict
1544
+ [dict]
1404
1545
  The glossary definition associated with the glossary_guid
1405
1546
 
1406
1547
  Raises
@@ -1411,8 +1552,7 @@ class GlossaryBrowser(Client):
1411
1552
  Raised by the server when an issue arises in processing a valid request.
1412
1553
  NotAuthorizedException
1413
1554
  The principle specified by the user_id does not have authorization for the requested action.
1414
- Notes
1415
- -----
1555
+
1416
1556
  """
1417
1557
 
1418
1558
  validate_guid(glossary_category_guid)
@@ -1421,7 +1561,7 @@ class GlossaryBrowser(Client):
1421
1561
  page_size = self.page_size
1422
1562
 
1423
1563
  url = (
1424
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
1564
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
1425
1565
  f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}"
1426
1566
  )
1427
1567
 
@@ -1915,13 +2055,18 @@ class GlossaryBrowser(Client):
1915
2055
  )
1916
2056
  return response
1917
2057
 
1918
- async def _async_get_terms_by_guid(self, term_guid: str) -> dict | str:
2058
+ async def _async_get_terms_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
1919
2059
  """Retrieve a term using its unique id. Async version.
1920
2060
  Parameters
1921
2061
  ----------
1922
2062
  term_guid : str
1923
2063
  The GUID of the glossary term to retrieve.
1924
-
2064
+ output_format: str, default = 'JSON'
2065
+ Type of output to produce:
2066
+ JSON - output standard json
2067
+ MD - output standard markdown with no preamble
2068
+ FORM - output markdown with a preamble for a form
2069
+ REPORT - output markdown with a preamble for a report
1925
2070
 
1926
2071
  Returns
1927
2072
  -------
@@ -1938,31 +2083,39 @@ class GlossaryBrowser(Client):
1938
2083
  NotAuthorizedException
1939
2084
  The principle specified by the user_id does not have authorization for the requested action.
1940
2085
  """
1941
-
2086
+ output_format = output_format.upper()
1942
2087
  validate_guid(term_guid)
1943
2088
 
1944
2089
  url = (
1945
2090
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
1946
2091
  f"{term_guid}/retrieve"
1947
2092
  )
1948
-
1949
2093
  response = await self._async_make_request("POST", url)
1950
- return response.json().get("element", "No term found")
2094
+ term_element = response.json().get("element", NO_TERMS_FOUND)
2095
+ if term_element == NO_TERMS_FOUND:
2096
+ return NO_TERMS_FOUND
2097
+ if output_format != 'JSON': # return a simplified markdown representation
2098
+ return self.generate_terms_md(term_element, "GUID", output_format)
2099
+ return response.json().get("element", NO_TERMS_FOUND)
2100
+
1951
2101
 
1952
- def get_terms_by_guid(self, term_guid: str) -> dict | str:
2102
+ def get_terms_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
1953
2103
  """Retrieve a term using its unique id. Async version.
1954
2104
  Parameters
1955
2105
  ----------
1956
2106
  term_guid : str
1957
2107
  The GUID of the glossary term to retrieve.
1958
-
1959
-
2108
+ output_format: str, default = 'JSON'
2109
+ Type of output to produce:
2110
+ JSON - output standard json
2111
+ MD - output standard markdown with no preamble
2112
+ FORM - output markdown with a preamble for a form
2113
+ REPORT - output markdown with a preamble for a report
1960
2114
  Returns
1961
2115
  -------
1962
2116
  dict | str
1963
2117
  A dict detailing the glossary term represented by the GUID. If no term is found, the string
1964
2118
  "No term found" will be returned.
1965
-
1966
2119
  Raises
1967
2120
  ------
1968
2121
  InvalidParameterException
@@ -1974,7 +2127,7 @@ class GlossaryBrowser(Client):
1974
2127
  """
1975
2128
 
1976
2129
  loop = asyncio.get_event_loop()
1977
- response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid))
2130
+ response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid, output_format))
1978
2131
 
1979
2132
  return response
1980
2133
 
@@ -2257,8 +2410,7 @@ class GlossaryBrowser(Client):
2257
2410
  for_duplicate_processing: bool = False,
2258
2411
  start_from: int = 0,
2259
2412
  page_size: int = None,
2260
- md: bool = False,
2261
- form: bool = True,
2413
+ output_format: str = "JSON",
2262
2414
  ) -> list | str:
2263
2415
  """Retrieve the list of glossary term metadata elements that contain the search string.
2264
2416
 
@@ -2290,11 +2442,12 @@ class GlossaryBrowser(Client):
2290
2442
  Page of results to start from
2291
2443
  page_size : int, optional
2292
2444
  Number of elements to return per page - if None, then default for class will be used.
2293
- md: bool, [default=False]
2294
- If true, a simplified markdown representation of the glossary will be returned
2295
- form: bool, [default=True]
2296
- If true and md is true, a form for the glossaries will be returned as a markdown string.
2297
- If false and md is true, a report for the glossaries will be returned.
2445
+ output_format: str, default = 'JSON'
2446
+ Type of output to produce:
2447
+ JSON - output standard json
2448
+ MD - output standard markdown with no preamble
2449
+ FORM - output markdown with a preamble for a form
2450
+ REPORT - output markdown with a preamble for a report
2298
2451
 
2299
2452
  Returns
2300
2453
  -------
@@ -2340,7 +2493,6 @@ class GlossaryBrowser(Client):
2340
2493
  "effectiveTime": effective_time,
2341
2494
  "limitResultsByStatus": status_filter,
2342
2495
  }
2343
- body = body_slimmer(body)
2344
2496
 
2345
2497
  url = (
2346
2498
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
@@ -2349,12 +2501,13 @@ class GlossaryBrowser(Client):
2349
2501
  f"forDuplicateProcessing={for_duplicate_processing_s}"
2350
2502
  )
2351
2503
 
2352
- response = await self._async_make_request("POST", url, body)
2504
+
2505
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2353
2506
  term_elements = response.json().get("elementList", NO_TERMS_FOUND)
2354
2507
  if term_elements == NO_TERMS_FOUND:
2355
2508
  return NO_TERMS_FOUND
2356
- if md: # return a simplified markdown representation
2357
- return self.generate_terms_md(term_elements, search_string, form)
2509
+ if output_format != "JSON": # return a simplified markdown representation
2510
+ return self.generate_terms_md(term_elements, search_string, output_format)
2358
2511
  return response.json().get("elementList", NO_TERMS_FOUND)
2359
2512
 
2360
2513
 
@@ -2371,8 +2524,7 @@ class GlossaryBrowser(Client):
2371
2524
  for_duplicate_processing: bool = False,
2372
2525
  start_from: int = 0,
2373
2526
  page_size: int = None,
2374
- md: bool = False,
2375
- form: bool = True,
2527
+ output_format: str = "JSON",
2376
2528
  ) -> list | str:
2377
2529
  """Retrieve the list of glossary term metadata elements that contain the search string.
2378
2530
 
@@ -2405,11 +2557,12 @@ class GlossaryBrowser(Client):
2405
2557
  Page of results to start from
2406
2558
  page_size : int, optional
2407
2559
  Number of elements to return per page - if None, then default for class will be used.
2408
- md: bool, [default=False]
2409
- If true, a simplified markdown representation of the glossary will be returned
2410
- form: bool, [default=True]
2411
- If true and md is true, a form for the glossaries will be returned as a markdown string.
2412
- If false and md is true, a report for the glossaries will be returned.
2560
+ output_format: str, default = 'JSON'
2561
+ Type of output to produce:
2562
+ JSON - output standard json
2563
+ MD - output standard markdown with no preamble
2564
+ FORM - output markdown with a preamble for a form
2565
+ REPORT - output markdown with a preamble for a report
2413
2566
 
2414
2567
  Returns
2415
2568
  -------
@@ -2448,8 +2601,7 @@ class GlossaryBrowser(Client):
2448
2601
  for_duplicate_processing,
2449
2602
  start_from,
2450
2603
  page_size,
2451
- md,
2452
- form,
2604
+ output_format
2453
2605
  )
2454
2606
  )
2455
2607