pyegeria 5.4.8.6__py3-none-any.whl → 5.4.8.8__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.
- examples/Coco_config/README.md +19 -0
- examples/Coco_config/__init__.py +4 -0
- examples/Coco_config/config_cocoMDS1.py +108 -0
- examples/Coco_config/config_cocoMDS2.py +126 -0
- examples/Coco_config/config_cocoMDS3.py +109 -0
- examples/Coco_config/config_cocoMDS4.py +91 -0
- examples/Coco_config/config_cocoMDS5.py +116 -0
- examples/Coco_config/config_cocoMDS6.py +114 -0
- examples/Coco_config/config_cocoMDSx.py +119 -0
- examples/Coco_config/config_cocoView1.py +155 -0
- examples/Coco_config/config_coco_core.py +255 -0
- examples/Coco_config/config_coco_datalake.py +450 -0
- examples/Coco_config/config_exchangeDL01.py +106 -0
- examples/Coco_config/config_governDL01.py +80 -0
- examples/Coco_config/config_monitorDev01.py +60 -0
- examples/Coco_config/config_monitorGov01.py +194 -0
- examples/Coco_config/globals.py +154 -0
- examples/GeoSpatial Products Example.py +535 -0
- examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2137 -0
- examples/Jupyter Notebooks/README.md +2 -0
- examples/Jupyter Notebooks/common/P-environment-check.ipynb +115 -0
- examples/Jupyter Notebooks/common/__init__.py +14 -0
- examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
- examples/Jupyter Notebooks/common/environment-check.ipynb +53 -0
- examples/Jupyter Notebooks/common/globals.ipynb +184 -0
- examples/Jupyter Notebooks/common/globals.py +154 -0
- examples/Jupyter Notebooks/common/orig_globals.py +152 -0
- examples/format_sets/all_format_sets.json +910 -0
- examples/format_sets/custom_format_sets.json +268 -0
- examples/format_sets/subset_format_sets.json +187 -0
- examples/format_sets_save_load_example.py +294 -0
- examples/output_formats_example.py +193 -0
- md_processing/__init__.py +6 -0
- md_processing/data/commands.json +30640 -59579
- md_processing/dr_egeria.py +18 -0
- md_processing/md_commands/feedback_commands.py +763 -0
- md_processing/md_commands/project_commands.py +1 -1
- md_processing/md_processing_utils/md_processing_constants.py +134 -4
- pyegeria/__init__.py +1 -1
- pyegeria/_client_new.py +109 -12
- pyegeria/_globals.py +3 -2
- pyegeria/base_report_formats.py +17 -0
- pyegeria/format_set_executor.py +5 -2
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/METADATA +1 -1
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/RECORD +49 -16
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/top_level.txt +1 -0
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/entry_points.txt +0 -0
- {pyegeria-5.4.8.6.dist-info → pyegeria-5.4.8.8.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"""PDX-License-Identifier: Apache-2.0
|
|
2
|
+
Copyright Contributors to the ODPi Egeria project.
|
|
3
|
+
|
|
4
|
+
This module provides a simple example for building out some GeoSpatial Digital Products.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
import os
|
|
9
|
+
import time
|
|
10
|
+
|
|
11
|
+
from loguru import logger
|
|
12
|
+
from rich import box
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from rich.markdown import Markdown
|
|
15
|
+
from rich.prompt import Prompt
|
|
16
|
+
from rich.table import Table
|
|
17
|
+
from rich.text import Text
|
|
18
|
+
import pydevd_pycharm
|
|
19
|
+
|
|
20
|
+
from pyegeria import (
|
|
21
|
+
EgeriaTech,
|
|
22
|
+
CollectionManager,
|
|
23
|
+
NO_ELEMENTS_FOUND,
|
|
24
|
+
|
|
25
|
+
)
|
|
26
|
+
from pyegeria.config import settings, get_app_config
|
|
27
|
+
from pyegeria.logging_configuration import config_logging
|
|
28
|
+
from pyegeria.base_report_formats import (select_report_spec, get_report_spec_heading, get_report_spec_description)
|
|
29
|
+
from pyegeria._exceptions_new import (PyegeriaException, print_basic_exception, print_validation_error,
|
|
30
|
+
PyegeriaInvalidParameterException, PyegeriaConnectionException,
|
|
31
|
+
PyegeriaAPIException, PyegeriaUnknownException, print_exception_table
|
|
32
|
+
)
|
|
33
|
+
from pydantic import ValidationError
|
|
34
|
+
from pyegeria import EgeriaTech
|
|
35
|
+
|
|
36
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
|
37
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
|
38
|
+
|
|
39
|
+
app_settings = get_app_config()
|
|
40
|
+
app_config = app_settings.Environment
|
|
41
|
+
config_logging()
|
|
42
|
+
logger.enable("pyegeria")
|
|
43
|
+
logger.info(f"Console width is {app_config.console_width}")
|
|
44
|
+
|
|
45
|
+
view_server = app_config.egeria_view_server
|
|
46
|
+
view_url = app_config.egeria_view_server_url
|
|
47
|
+
user = EGERIA_USER
|
|
48
|
+
user_pass = EGERIA_USER_PASSWORD
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
console = Console(
|
|
52
|
+
style="bold bright_white on black",
|
|
53
|
+
width=app_config.console_width,
|
|
54
|
+
force_terminal=not app_config.egeria_jupyter,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
client = EgeriaTech(view_server, view_url, user, user_pass)
|
|
62
|
+
|
|
63
|
+
token = client.create_egeria_bearer_token()
|
|
64
|
+
start_time = time.perf_counter()
|
|
65
|
+
logger.info("Starting to create GeoSpatial Products")
|
|
66
|
+
display_name = "GeoSpatial Root"
|
|
67
|
+
description = "This is the root of the GeoSpatial work"
|
|
68
|
+
category = "GeoSpatial"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
print("First we'll set up a number of folders to support the work.")
|
|
72
|
+
#
|
|
73
|
+
# Root Folder
|
|
74
|
+
#
|
|
75
|
+
root = client.get_collections_by_name(display_name)
|
|
76
|
+
if isinstance(root, dict | list):
|
|
77
|
+
root_guid = root[0]['elementHeader']['guid']
|
|
78
|
+
print(f"Found root guid of {root_guid}")
|
|
79
|
+
else:
|
|
80
|
+
root_guid = client.create_root_collection(
|
|
81
|
+
display_name=display_name,
|
|
82
|
+
description=description,
|
|
83
|
+
category=category
|
|
84
|
+
)
|
|
85
|
+
logger.success(f"Created root collection {root_guid}")
|
|
86
|
+
#
|
|
87
|
+
# Digital Products Marketplace
|
|
88
|
+
#
|
|
89
|
+
display_name = "Digital Products MarketPlace"
|
|
90
|
+
description = "This is the digital products marketplace"
|
|
91
|
+
category = "GeoSpatial"
|
|
92
|
+
qualified_name = client.__create_qualified_name__("Marketplace", display_name)
|
|
93
|
+
|
|
94
|
+
props_body = {
|
|
95
|
+
"class": "DigitalProductCatalogProperties",
|
|
96
|
+
"qualifiedName": qualified_name,
|
|
97
|
+
"displayName": display_name,
|
|
98
|
+
"description": description,
|
|
99
|
+
"category": category
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
request_body = {
|
|
103
|
+
|
|
104
|
+
"class": "NewElementRequestBody",
|
|
105
|
+
"isOwnAnchor": False,
|
|
106
|
+
"anchorGUID": root_guid,
|
|
107
|
+
"parentGUID": root_guid,
|
|
108
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
109
|
+
"parentAtEnd1": True,
|
|
110
|
+
"properties": props_body,
|
|
111
|
+
}
|
|
112
|
+
marketplace = client.get_collections_by_name(qualified_name)
|
|
113
|
+
if isinstance(marketplace, dict | list):
|
|
114
|
+
marketplace_guid = marketplace[0]['elementHeader']['guid']
|
|
115
|
+
print(f"Found marketplace guid of {marketplace_guid}")
|
|
116
|
+
else:
|
|
117
|
+
marketplace_guid = client.create_digital_product_catalog(body=request_body)
|
|
118
|
+
logger.success(f"Created folder collection for marketplace: {marketplace_guid}")
|
|
119
|
+
#
|
|
120
|
+
# GeoSpatial Products folder
|
|
121
|
+
#
|
|
122
|
+
display_name = "GeoSpatial Products"
|
|
123
|
+
description = "GeoSpatial product offerings"
|
|
124
|
+
category = "GeoSpatial"
|
|
125
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
126
|
+
|
|
127
|
+
props_body = {
|
|
128
|
+
"class": "DigitalProductCatalogProperties",
|
|
129
|
+
"qualifiedName": qualified_name,
|
|
130
|
+
"displayName": display_name,
|
|
131
|
+
"description": description,
|
|
132
|
+
"category": category
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
request_body = {
|
|
136
|
+
"class": "NewElementRequestBody",
|
|
137
|
+
"isOwnAnchor": False,
|
|
138
|
+
"anchorGUID": marketplace_guid,
|
|
139
|
+
"parentGUID": marketplace_guid,
|
|
140
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
141
|
+
"parentAtEnd1": True,
|
|
142
|
+
"properties": props_body,
|
|
143
|
+
}
|
|
144
|
+
geo_prods = client.get_collections_by_name(qualified_name)
|
|
145
|
+
if isinstance(geo_prods, dict | list):
|
|
146
|
+
geo_prods_guid = geo_prods[0]['elementHeader']['guid']
|
|
147
|
+
print(f"Found geo_prods guid of {geo_prods_guid}")
|
|
148
|
+
else:
|
|
149
|
+
geo_prods_guid = client.create_digital_product_catalog(body=request_body)
|
|
150
|
+
logger.success(f"Created folder collection for geoprods: {geo_prods_guid}")
|
|
151
|
+
#
|
|
152
|
+
# Agricultural Products Folder
|
|
153
|
+
#
|
|
154
|
+
display_name = "Agricultural Products"
|
|
155
|
+
description = "Agricultural product offerings"
|
|
156
|
+
category = "GeoSpatial"
|
|
157
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
158
|
+
|
|
159
|
+
props_body = {
|
|
160
|
+
|
|
161
|
+
"class": "DigitalProductCatalogProperties",
|
|
162
|
+
"qualifiedName": qualified_name,
|
|
163
|
+
"displayName": display_name,
|
|
164
|
+
"description": description,
|
|
165
|
+
"category": category
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
request_body = {
|
|
169
|
+
|
|
170
|
+
"class": "NewElementRequestBody",
|
|
171
|
+
"isOwnAnchor": False,
|
|
172
|
+
"anchorGUID": marketplace_guid,
|
|
173
|
+
"parentGUID": marketplace_guid,
|
|
174
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
175
|
+
"parentAtEnd1": True,
|
|
176
|
+
"properties": props_body, }
|
|
177
|
+
ag_prods = client.get_collections_by_name(qualified_name)
|
|
178
|
+
if isinstance(ag_prods, dict | list):
|
|
179
|
+
ag_prods_guid = ag_prods[0]['elementHeader']['guid']
|
|
180
|
+
print(f"Found ag_prods guid of {ag_prods_guid}")
|
|
181
|
+
else:
|
|
182
|
+
ag_prods_guid = client.create_digital_product_catalog(body=request_body)
|
|
183
|
+
logger.success(f"Created folder collection for ag products: {ag_prods_guid}")
|
|
184
|
+
#
|
|
185
|
+
# Folder to hold Prepared Imagery Products
|
|
186
|
+
#
|
|
187
|
+
display_name = "Prepared Imagery Products"
|
|
188
|
+
description = "Imagery products that are ready for consumption"
|
|
189
|
+
category = "GeoSpatial"
|
|
190
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
191
|
+
|
|
192
|
+
props_body = {
|
|
193
|
+
"class": "DigitalProductCatalogProperties",
|
|
194
|
+
"qualifiedName": qualified_name,
|
|
195
|
+
"displayName": display_name,
|
|
196
|
+
"description": description,
|
|
197
|
+
"category": category
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
request_body = {
|
|
201
|
+
"class": "NewElementRequestBody",
|
|
202
|
+
"isOwnAnchor": False,
|
|
203
|
+
"anchorGUID": root_guid,
|
|
204
|
+
"parentGUID": root_guid,
|
|
205
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
206
|
+
"parentAtEnd1": True,
|
|
207
|
+
"properties": props_body,
|
|
208
|
+
}
|
|
209
|
+
prepared_imagery = client.get_collections_by_name(qualified_name)
|
|
210
|
+
if isinstance(prepared_imagery, dict | list):
|
|
211
|
+
prepared_imagery_guid = prepared_imagery[0]['elementHeader']['guid']
|
|
212
|
+
print(f"Found prepared_imagery guid of {prepared_imagery_guid}")
|
|
213
|
+
else:
|
|
214
|
+
prepared_imagery_guid = client.create_digital_product_catalog(body=request_body)
|
|
215
|
+
logger.success(f"Created folder for prepared imagery products: {prepared_imagery_guid}")
|
|
216
|
+
#
|
|
217
|
+
# A digital product covering NDVI - derived from Sentinel 2
|
|
218
|
+
#
|
|
219
|
+
display_name = "NDVI - Sentinel 2 derived"
|
|
220
|
+
description = "NDVI vegetation index calculated from Sentinel 2 imagery"
|
|
221
|
+
category = "GeoSpatial"
|
|
222
|
+
qualified_name = client.__create_qualified_name__("DigitalProduct", display_name)
|
|
223
|
+
|
|
224
|
+
props_body = {
|
|
225
|
+
"class": "DigitalProductProperties",
|
|
226
|
+
"qualifiedName": qualified_name,
|
|
227
|
+
"displayName": display_name,
|
|
228
|
+
"description": description,
|
|
229
|
+
"category": category,
|
|
230
|
+
"productType": "Periodic Extended",
|
|
231
|
+
"identifier": "NDVI-S",
|
|
232
|
+
"productName": "NDVI - Sentinel 2",
|
|
233
|
+
"serviceLife": "Until interest and budget wane",
|
|
234
|
+
"maturity": "Nascent"
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
request_body = {
|
|
238
|
+
"class": "NewElementRequestBody",
|
|
239
|
+
"isOwnAnchor": False,
|
|
240
|
+
"anchorGUID": prepared_imagery_guid,
|
|
241
|
+
"parentGUID": prepared_imagery_guid,
|
|
242
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
243
|
+
"parentAtEnd1": True,
|
|
244
|
+
"properties": props_body,
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
ndvi = client.get_collections_by_name(qualified_name)
|
|
248
|
+
if isinstance(ndvi, dict | list):
|
|
249
|
+
ndvi_guid = ndvi[0]['elementHeader']['guid']
|
|
250
|
+
print(f"Found ndvi guid of {ndvi_guid}")
|
|
251
|
+
else:
|
|
252
|
+
ndvi_guid = client.create_digital_product(body=request_body)
|
|
253
|
+
logger.success(f"Created NDVI product: {ndvi_guid}")
|
|
254
|
+
#
|
|
255
|
+
# A folder to hold Raw Satellite Imagery Products
|
|
256
|
+
#
|
|
257
|
+
display_name = "Raw Satellite Imagery Products"
|
|
258
|
+
description = "Raw satellite imagery imported from or referenced from satellite data providers"
|
|
259
|
+
category = "GeoSpatial"
|
|
260
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
261
|
+
|
|
262
|
+
props_body = {
|
|
263
|
+
"class": "DigitalProductCatalogProperties",
|
|
264
|
+
"qualifiedName": qualified_name,
|
|
265
|
+
"displayName": display_name,
|
|
266
|
+
"description": description,
|
|
267
|
+
"category": category
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
request_body = {
|
|
271
|
+
"class": "NewElementRequestBody",
|
|
272
|
+
"isOwnAnchor": False,
|
|
273
|
+
"anchorGUID": root_guid,
|
|
274
|
+
"parentGUID": root_guid,
|
|
275
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
276
|
+
"parentAtEnd1": True,
|
|
277
|
+
"properties": props_body,
|
|
278
|
+
}
|
|
279
|
+
raw_imagery = client.get_collections_by_name(qualified_name)
|
|
280
|
+
if isinstance(raw_imagery, dict | list):
|
|
281
|
+
raw_imagery_guid = raw_imagery[0]['elementHeader']['guid']
|
|
282
|
+
print(f"Found raw_imagery guid of {raw_imagery_guid}")
|
|
283
|
+
else:
|
|
284
|
+
raw_imagery_guid = client.create_digital_product_catalog(body=request_body)
|
|
285
|
+
logger.success(f"Created folder for raw imagery products: {raw_imagery_guid}")
|
|
286
|
+
#
|
|
287
|
+
# A digital product providing Sentinel-2a imagery
|
|
288
|
+
#
|
|
289
|
+
display_name = "Sentinel-2a"
|
|
290
|
+
description = "Level 2a (surface level) imagery"
|
|
291
|
+
category = "GeoSpatial"
|
|
292
|
+
qualified_name = client.__create_qualified_name__("DigitalProduct", display_name)
|
|
293
|
+
|
|
294
|
+
props_body = {
|
|
295
|
+
"class": "DigitalProductProperties",
|
|
296
|
+
"qualifiedName": qualified_name,
|
|
297
|
+
"displayName": display_name,
|
|
298
|
+
"description": description,
|
|
299
|
+
"category": category,
|
|
300
|
+
"productType": "Periodic Extended",
|
|
301
|
+
"identifier": "sentinel-2a",
|
|
302
|
+
"productName": "Sentinel Level 2A",
|
|
303
|
+
"serviceLife": "Until interest and budget wane",
|
|
304
|
+
"maturity": "Nascent"
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
request_body = {
|
|
308
|
+
"class": "NewElementRequestBody",
|
|
309
|
+
"isOwnAnchor": False,
|
|
310
|
+
"anchorGUID": raw_imagery_guid,
|
|
311
|
+
"parentGUID": raw_imagery_guid,
|
|
312
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
313
|
+
"parentAtEnd1": True,
|
|
314
|
+
"properties": props_body,
|
|
315
|
+
}
|
|
316
|
+
sentinel2a = client.get_collections_by_name(qualified_name)
|
|
317
|
+
if isinstance(sentinel2a, dict | list):
|
|
318
|
+
sentinel2a_guid = sentinel2a[0]['elementHeader']['guid']
|
|
319
|
+
print(f"Found sentinel2a guid of {sentinel2a_guid}")
|
|
320
|
+
else:
|
|
321
|
+
sentinel2a_guid = client.create_digital_product(body=request_body)
|
|
322
|
+
logger.success(f"Created Sentinel-2a product: {sentinel2a_guid}")
|
|
323
|
+
|
|
324
|
+
# NDVI uses Sentinel 2A data so Add a dependency between ndvi dependent on sentinel2a
|
|
325
|
+
client.link_digital_product_dependency(sentinel2a_guid, ndvi_guid)
|
|
326
|
+
|
|
327
|
+
#
|
|
328
|
+
# Now lets create some standard subscriptions (a form of agreement)
|
|
329
|
+
#
|
|
330
|
+
# Create a folder for standard agreements
|
|
331
|
+
display_name = "Standard Subscription Agreements Folder"
|
|
332
|
+
description = "A folder collection for digital product subscriptions"
|
|
333
|
+
category = "GeoSpatial"
|
|
334
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
335
|
+
|
|
336
|
+
props_body = {
|
|
337
|
+
"class": "CollectionProperties",
|
|
338
|
+
"qualifiedName": qualified_name,
|
|
339
|
+
"displayName": display_name,
|
|
340
|
+
"description": description,
|
|
341
|
+
"category": category
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
request_body = {
|
|
345
|
+
"class": "NewElementRequestBody",
|
|
346
|
+
"isOwnAnchor": False,
|
|
347
|
+
"anchorGUID": root_guid,
|
|
348
|
+
"parentGUID": root_guid,
|
|
349
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
350
|
+
"parentAtEnd1": True,
|
|
351
|
+
"properties": props_body,
|
|
352
|
+
}
|
|
353
|
+
subscriptions_folder = client.get_collections_by_name(qualified_name)
|
|
354
|
+
if isinstance(subscriptions_folder, dict | list):
|
|
355
|
+
subscriptions_folder_guid = subscriptions_folder[0]['elementHeader']['guid']
|
|
356
|
+
print(f"Found Standard Subscription Agreements Folder {subscriptions_folder_guid}")
|
|
357
|
+
else:
|
|
358
|
+
subscriptions_folder_guid = client.create_folder_collection(body=request_body)
|
|
359
|
+
logger.success(f"Created folder for standard subscriptions: {subscriptions_folder_guid}")
|
|
360
|
+
#
|
|
361
|
+
# Add a Digital Subscription to this folder
|
|
362
|
+
#
|
|
363
|
+
anchor_guid = subscriptions_folder_guid
|
|
364
|
+
parent_guid = subscriptions_folder_guid
|
|
365
|
+
parent_relationship_type_name = "CollectionMembership"
|
|
366
|
+
parent_at_end1 = True
|
|
367
|
+
display_name = "GeoSpatial Data Products Subscription"
|
|
368
|
+
description = "A generic subscription agreement for GeoSpatial Data Products"
|
|
369
|
+
identifier = "GeoSpatial-0"
|
|
370
|
+
category = "GeoSpatial"
|
|
371
|
+
is_own_anchor = False
|
|
372
|
+
|
|
373
|
+
qualified_name = client.__create_qualified_name__("DigitalSubscription", display_name)
|
|
374
|
+
|
|
375
|
+
body = {
|
|
376
|
+
"class": "NewElementRequestBody",
|
|
377
|
+
"anchorGUID": anchor_guid,
|
|
378
|
+
"isOwnAnchor": is_own_anchor,
|
|
379
|
+
"parentGUID": parent_guid,
|
|
380
|
+
# "initialClassification": {classification: {"class": {}}},
|
|
381
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
|
382
|
+
"parentAtEnd1": parent_at_end1,
|
|
383
|
+
"properties": {
|
|
384
|
+
"class": "DigitalSubscriptionProperties",
|
|
385
|
+
"displayName": display_name,
|
|
386
|
+
"qualifiedName": qualified_name,
|
|
387
|
+
"description": description,
|
|
388
|
+
"identifier": identifier,
|
|
389
|
+
"category": category,
|
|
390
|
+
"supportLevel": "Best Effort"
|
|
391
|
+
},
|
|
392
|
+
}
|
|
393
|
+
geo_subscriptions = client.get_collections_by_name(qualified_name)
|
|
394
|
+
if isinstance(geo_subscriptions, dict | list):
|
|
395
|
+
geo_subscriptions_guid = geo_subscriptions[0]['elementHeader']['guid']
|
|
396
|
+
print(f"Found GeoSpatial Subscriptions guid of {geo_subscriptions_guid}")
|
|
397
|
+
else:
|
|
398
|
+
geo_subscriptions_guid = client.create_digital_subscription(body)
|
|
399
|
+
print(f"Created Digital Subscription, GeoSpatial Data Products Subscription: {geo_subscriptions_guid}")
|
|
400
|
+
logger.success(f"Created subscription : {geo_subscriptions_guid}")
|
|
401
|
+
#
|
|
402
|
+
# Add agreement items to the agreement - the sentinel data
|
|
403
|
+
#
|
|
404
|
+
body = {
|
|
405
|
+
"class": "NewRelationshipRequestBody",
|
|
406
|
+
"properties": {
|
|
407
|
+
"class": "AgreementItemProperties",
|
|
408
|
+
"agreementItemId": "Sentinel-2a-Subscription",
|
|
409
|
+
"agreementStart": "2025-08-01",
|
|
410
|
+
"agreementEnd": "2025-12-31",
|
|
411
|
+
"entitlements": {"Data Download": "Allowed", "Data Sharing": "Allowed"}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
client.link_agreement_item(geo_subscriptions_guid, sentinel2a_guid, body)
|
|
415
|
+
msg = f"Linked agreement item sentinel2a to geo_subscriptions"
|
|
416
|
+
logger.success(msg)
|
|
417
|
+
print(msg)
|
|
418
|
+
|
|
419
|
+
#
|
|
420
|
+
# Licensing
|
|
421
|
+
#
|
|
422
|
+
# First a folder to hold license types - we will anchor it to the GeoSpatial root
|
|
423
|
+
#
|
|
424
|
+
display_name = "GeoSpatial Data Products License Types"
|
|
425
|
+
description = "A folder collection containing license types governing GeoSpatial Data Products"
|
|
426
|
+
category = "GeoSpatial"
|
|
427
|
+
qualified_name = client.__create_qualified_name__("Folder", display_name)
|
|
428
|
+
|
|
429
|
+
props_body = {
|
|
430
|
+
"class": "CollectionProperties",
|
|
431
|
+
"qualifiedName": qualified_name,
|
|
432
|
+
"displayName": display_name,
|
|
433
|
+
"description": description,
|
|
434
|
+
"category": category
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
request_body = {
|
|
438
|
+
"class": "NewElementRequestBody",
|
|
439
|
+
"isOwnAnchor": False,
|
|
440
|
+
"anchorGUID": root_guid,
|
|
441
|
+
"parentGUID": root_guid,
|
|
442
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
443
|
+
"parentAtEnd1": True,
|
|
444
|
+
"properties": props_body,
|
|
445
|
+
}
|
|
446
|
+
license_type_folder = client.get_collections_by_name(qualified_name)
|
|
447
|
+
if not isinstance(license_type_folder, dict | list):
|
|
448
|
+
license_type_folder_guid = client.create_folder_collection(body=request_body)
|
|
449
|
+
logger.success(f"Created folder for GeoSpatial Data Products License Types: {license_type_folder_guid}")
|
|
450
|
+
else:
|
|
451
|
+
license_type_folder_guid = license_type_folder[0]['elementHeader']['guid']
|
|
452
|
+
print(f"Found license_type_folder guid of {license_type_folder_guid}")
|
|
453
|
+
|
|
454
|
+
#
|
|
455
|
+
# Now lets create a few license types:
|
|
456
|
+
# - one for importing sentinel 2 data from ESA
|
|
457
|
+
# - one for offering the sentinel 2 data as a digital product
|
|
458
|
+
# - one for offering our derived product (NDVI) as a digital product
|
|
459
|
+
#
|
|
460
|
+
display_name = "ESA License Type"
|
|
461
|
+
description = "A folder collection containing license types governing GeoSpatial Data Products"
|
|
462
|
+
summary = "Free and Open Data - Requires Attribution"
|
|
463
|
+
category = "GeoSpatial"
|
|
464
|
+
details = "https://www.copernicus.eu/en/access-data/copyright-and-licences"
|
|
465
|
+
qualified_name = client.__create_qualified_name__("LicenseType", display_name)
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
props_body = {
|
|
469
|
+
"class": "LicenseTypeProperties",
|
|
470
|
+
"typeName": "LicenseType",
|
|
471
|
+
"domainIdentifier": 0,
|
|
472
|
+
"qualifiedName": qualified_name,
|
|
473
|
+
"display_name": display_name,
|
|
474
|
+
"summary": summary,
|
|
475
|
+
"description": description,
|
|
476
|
+
"scope": "World-Wide",
|
|
477
|
+
"importance": "Foundational",
|
|
478
|
+
# "details": details,
|
|
479
|
+
# "entitlements": {"Data Download": "True", "Data Sharing": "True", "Data Access": "True",
|
|
480
|
+
# "Data Usage": "True", "Data Analysis": "True"},
|
|
481
|
+
# "restrictions": {},
|
|
482
|
+
# "obligations": {"Attribution Required": "True"},
|
|
483
|
+
"implications": ["Open Use"],
|
|
484
|
+
"outcomes": ["Data Available"]
|
|
485
|
+
# "results": [],
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
request_body = {
|
|
490
|
+
"class": "NewElementRequestBody",
|
|
491
|
+
"anchorGUID": license_type_folder_guid,
|
|
492
|
+
"isOwnAnchor": False,
|
|
493
|
+
"parentGUID": license_type_folder_guid,
|
|
494
|
+
"parentRelationshipTypeName": "CollectionMembership",
|
|
495
|
+
"parentAtEnd1": True,
|
|
496
|
+
"properties": {
|
|
497
|
+
"class": "LicenseTypeProperties",
|
|
498
|
+
"typeName": "LicenseType",
|
|
499
|
+
"domainIdentifier": 0,
|
|
500
|
+
"qualifiedName": qualified_name,
|
|
501
|
+
"display_name": display_name,
|
|
502
|
+
"summary": summary,
|
|
503
|
+
"description": description,
|
|
504
|
+
"scope": "World-Wide",
|
|
505
|
+
"importance": "Foundational",
|
|
506
|
+
# "details": details,
|
|
507
|
+
"entitlements": {"Data Download": "True", "Data Sharing": "True", "Data Access": "True",
|
|
508
|
+
"Data Usage": "True", "Data Analysis": "True"},
|
|
509
|
+
"restrictions": {},
|
|
510
|
+
"obligations": {"Attribution Required": "True"},
|
|
511
|
+
"implications": ["Open Use"],
|
|
512
|
+
"outcomes": ["Data Available"],
|
|
513
|
+
"results": []
|
|
514
|
+
},
|
|
515
|
+
"initialStatus": "ACTIVE"
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
esa_license_type = client.get_governance_definitions_by_name(qualified_name)
|
|
519
|
+
if not isinstance(esa_license_type, dict | list):
|
|
520
|
+
esa_license_type_guid = client.create_governance_definition(body=request_body)
|
|
521
|
+
logger.success(f"Created license type for ESA License Type: {esa_license_type_guid}")
|
|
522
|
+
else:
|
|
523
|
+
esa_license_type_guid = esa_license_type[0]['elementHeader']['guid']
|
|
524
|
+
print(f"Found license_type_guid for esa license type {esa_license_type_guid}")
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
except (PyegeriaInvalidParameterException, PyegeriaConnectionException, PyegeriaAPIException,
|
|
529
|
+
PyegeriaUnknownException, PyegeriaException) as e:
|
|
530
|
+
print_exception_table(e)
|
|
531
|
+
except ValidationError as e:
|
|
532
|
+
print_validation_error(e)
|
|
533
|
+
|
|
534
|
+
finally:
|
|
535
|
+
client.close_session()
|