OpenGeodeWeb-Back 5.9.1__py3-none-any.whl → 5.10.0__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.
Potentially problematic release.
This version of OpenGeodeWeb-Back might be problematic. Click here for more details.
- opengeodeweb_back/app_config.py +13 -2
- opengeodeweb_back/geode_functions.py +35 -14
- opengeodeweb_back/geode_objects.py +32 -7
- opengeodeweb_back/py.typed +1 -0
- opengeodeweb_back/routes/blueprint_routes.py +24 -46
- opengeodeweb_back/routes/models/blueprint_models.py +2 -8
- opengeodeweb_back/routes/models/schemas/mesh_components.json +1 -11
- opengeodeweb_back/routes/schemas/polygon_attribute_names.json +0 -10
- opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json +0 -10
- opengeodeweb_back/routes/schemas/texture_coordinates.json +1 -11
- opengeodeweb_back/routes/schemas/vertex_attribute_names.json +0 -10
- opengeodeweb_back/utils_functions.py +126 -75
- {opengeodeweb_back-5.9.1.dist-info → opengeodeweb_back-5.10.0.dist-info}/METADATA +22 -17
- {opengeodeweb_back-5.9.1.dist-info → opengeodeweb_back-5.10.0.dist-info}/RECORD +17 -16
- {opengeodeweb_back-5.9.1.dist-info → opengeodeweb_back-5.10.0.dist-info}/WHEEL +0 -0
- {opengeodeweb_back-5.9.1.dist-info → opengeodeweb_back-5.10.0.dist-info}/licenses/LICENSE +0 -0
- {opengeodeweb_back-5.9.1.dist-info → opengeodeweb_back-5.10.0.dist-info}/top_level.txt +0 -0
opengeodeweb_back/app_config.py
CHANGED
|
@@ -4,6 +4,9 @@ import time
|
|
|
4
4
|
|
|
5
5
|
# Third party imports
|
|
6
6
|
# Local application imports
|
|
7
|
+
from opengeodeweb_microservice.database.connection import get_database
|
|
8
|
+
|
|
9
|
+
DATABASE_FILENAME = "project.db"
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
class Config(object):
|
|
@@ -15,6 +18,7 @@ class Config(object):
|
|
|
15
18
|
REQUEST_COUNTER = 0
|
|
16
19
|
LAST_REQUEST_TIME = time.time()
|
|
17
20
|
LAST_PING_TIME = time.time()
|
|
21
|
+
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
class ProdConfig(Config):
|
|
@@ -22,7 +26,10 @@ class ProdConfig(Config):
|
|
|
22
26
|
ORIGINS = ""
|
|
23
27
|
MINUTES_BEFORE_TIMEOUT = "1"
|
|
24
28
|
SECONDS_BETWEEN_SHUTDOWNS = "10"
|
|
25
|
-
DATA_FOLDER_PATH = "/data
|
|
29
|
+
DATA_FOLDER_PATH = "/data"
|
|
30
|
+
SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.abspath(
|
|
31
|
+
os.path.join(DATA_FOLDER_PATH, DATABASE_FILENAME)
|
|
32
|
+
)}"
|
|
26
33
|
|
|
27
34
|
|
|
28
35
|
class DevConfig(Config):
|
|
@@ -30,4 +37,8 @@ class DevConfig(Config):
|
|
|
30
37
|
ORIGINS = "*"
|
|
31
38
|
MINUTES_BEFORE_TIMEOUT = "1"
|
|
32
39
|
SECONDS_BETWEEN_SHUTDOWNS = "10"
|
|
33
|
-
|
|
40
|
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
41
|
+
DATA_FOLDER_PATH = os.path.join(BASE_DIR, "data")
|
|
42
|
+
SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.join(
|
|
43
|
+
BASE_DIR, DATA_FOLDER_PATH, DATABASE_FILENAME
|
|
44
|
+
)}"
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
# Third party imports
|
|
5
|
-
import opengeode_geosciences as og_gs
|
|
6
|
-
import opengeode as og
|
|
5
|
+
import opengeode_geosciences as og_gs # type: ignore
|
|
6
|
+
import opengeode as og # type: ignore
|
|
7
7
|
import werkzeug
|
|
8
8
|
import flask
|
|
9
|
+
from typing import Any
|
|
9
10
|
|
|
10
11
|
# Local application imports
|
|
11
12
|
from .geode_objects import geode_objects_dict
|
|
12
13
|
from . import utils_functions
|
|
14
|
+
from opengeodeweb_microservice.database.data import Data
|
|
15
|
+
from opengeodeweb_microservice.database.connection import get_session
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
def geode_object_value(geode_object: str):
|
|
@@ -37,25 +40,40 @@ def is_loadable(geode_object: str, file_absolute_path: str) -> float:
|
|
|
37
40
|
return percentage.value()
|
|
38
41
|
|
|
39
42
|
|
|
43
|
+
def object_priority(geode_object: str, file_absolute_path: str) -> int:
|
|
44
|
+
return geode_object_value(geode_object)["object_priority"](file_absolute_path)
|
|
45
|
+
|
|
46
|
+
|
|
40
47
|
def load(geode_object: str, file_absolute_path: str):
|
|
41
48
|
return geode_object_value(geode_object)["load"](file_absolute_path)
|
|
42
49
|
|
|
43
50
|
|
|
44
|
-
def data_file_path(data_id: str, filename: str) -> str:
|
|
51
|
+
def data_file_path(data_id: str, filename: str = "") -> str:
|
|
45
52
|
data_folder_path = flask.current_app.config["DATA_FOLDER_PATH"]
|
|
46
|
-
|
|
47
|
-
data_folder_path,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
53
|
+
if filename:
|
|
54
|
+
return os.path.join(data_folder_path, data_id, filename)
|
|
55
|
+
return os.path.join(data_folder_path, data_id)
|
|
56
|
+
|
|
51
57
|
|
|
58
|
+
def load_data(data_id: str) -> Any:
|
|
59
|
+
data_entry = Data.get(data_id)
|
|
60
|
+
if not data_entry:
|
|
61
|
+
flask.abort(404, f"Data with id {data_id} not found")
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
file_absolute_path = data_file_path(data_id, data_entry.native_file_name)
|
|
64
|
+
print("Loading file: ", file_absolute_path)
|
|
65
|
+
print("File exists: ", os.path.exists(file_absolute_path))
|
|
66
|
+
return load(data_entry.geode_object, file_absolute_path)
|
|
56
67
|
|
|
57
68
|
|
|
58
|
-
def
|
|
69
|
+
def get_data_info(data_id: str) -> Data:
|
|
70
|
+
data_entry = Data.get(data_id)
|
|
71
|
+
if not data_entry:
|
|
72
|
+
flask.abort(404, f"Data with id {data_id} not found")
|
|
73
|
+
return data_entry
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def upload_file_path(filename: str) -> str:
|
|
59
77
|
upload_folder = flask.current_app.config["UPLOAD_FOLDER"]
|
|
60
78
|
secure_filename = werkzeug.utils.secure_filename(filename)
|
|
61
79
|
return os.path.abspath(os.path.join(upload_folder, secure_filename))
|
|
@@ -181,11 +199,14 @@ def list_geode_objects(
|
|
|
181
199
|
os.path.basename(file_absolute_path)
|
|
182
200
|
)
|
|
183
201
|
geode_objects_filtered_list = filter_geode_objects(key)
|
|
184
|
-
|
|
185
202
|
for geode_object in geode_objects_filtered_list:
|
|
186
203
|
if has_creator(geode_object, file_extension):
|
|
187
204
|
loadability_score = is_loadable(geode_object, file_absolute_path)
|
|
188
|
-
|
|
205
|
+
priority_score = object_priority(geode_object, file_absolute_path)
|
|
206
|
+
return_dict[geode_object] = {
|
|
207
|
+
"is_loadable": loadability_score,
|
|
208
|
+
"object_priority": priority_score,
|
|
209
|
+
}
|
|
189
210
|
return return_dict
|
|
190
211
|
|
|
191
212
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Standard library imports
|
|
2
2
|
|
|
3
3
|
# Third party imports
|
|
4
|
-
import opengeode as og
|
|
5
|
-
import opengeode_io as og_io
|
|
6
|
-
import opengeode_inspector as og_inspector
|
|
7
|
-
import opengeode_geosciences as og_gs
|
|
8
|
-
import opengeode_geosciencesio as og_gs_io
|
|
9
|
-
import geode_viewables as g_v
|
|
4
|
+
import opengeode as og # type: ignore
|
|
5
|
+
import opengeode_io as og_io # type: ignore
|
|
6
|
+
import opengeode_inspector as og_inspector # type: ignore
|
|
7
|
+
import opengeode_geosciences as og_gs # type: ignore
|
|
8
|
+
import opengeode_geosciencesio as og_gs_io # type: ignore
|
|
9
|
+
import geode_viewables as g_v # type: ignore
|
|
10
10
|
|
|
11
11
|
# Local application imports
|
|
12
12
|
|
|
@@ -27,6 +27,7 @@ def geode_objects_dict():
|
|
|
27
27
|
"output_factory": og.BRepOutputFactory,
|
|
28
28
|
"additional_files": og.brep_additional_files,
|
|
29
29
|
"is_loadable": og.is_brep_loadable,
|
|
30
|
+
"object_priority": og.brep_object_priority,
|
|
30
31
|
"load": og.load_brep,
|
|
31
32
|
"is_saveable": og.is_brep_saveable,
|
|
32
33
|
"save": og.save_brep,
|
|
@@ -50,6 +51,7 @@ def geode_objects_dict():
|
|
|
50
51
|
"output_factory": og_gs.CrossSectionOutputFactory,
|
|
51
52
|
"additional_files": og_gs.cross_section_additional_files,
|
|
52
53
|
"is_loadable": og_gs.is_cross_section_loadable,
|
|
54
|
+
"object_priority": og_gs.cross_section_object_priority,
|
|
53
55
|
"load": og_gs.load_cross_section,
|
|
54
56
|
"is_saveable": og_gs.is_cross_section_saveable,
|
|
55
57
|
"save": og_gs.save_cross_section,
|
|
@@ -72,6 +74,7 @@ def geode_objects_dict():
|
|
|
72
74
|
"output_factory": og.EdgedCurveOutputFactory2D,
|
|
73
75
|
"additional_files": og.edged_curve_additional_files2D,
|
|
74
76
|
"is_loadable": og.is_edged_curve_loadable2D,
|
|
77
|
+
"object_priority": og.edged_curve_object_priority2D,
|
|
75
78
|
"load": og.load_edged_curve2D,
|
|
76
79
|
"is_saveable": og.is_edged_curve_saveable2D,
|
|
77
80
|
"save": og.save_edged_curve2D,
|
|
@@ -95,6 +98,7 @@ def geode_objects_dict():
|
|
|
95
98
|
"output_factory": og.EdgedCurveOutputFactory3D,
|
|
96
99
|
"additional_files": og.edged_curve_additional_files3D,
|
|
97
100
|
"is_loadable": og.is_edged_curve_loadable3D,
|
|
101
|
+
"object_priority": og.edged_curve_object_priority3D,
|
|
98
102
|
"load": og.load_edged_curve3D,
|
|
99
103
|
"is_saveable": og.is_edged_curve_saveable3D,
|
|
100
104
|
"save": og.save_edged_curve3D,
|
|
@@ -118,6 +122,7 @@ def geode_objects_dict():
|
|
|
118
122
|
"output_factory": og.GraphOutputFactory,
|
|
119
123
|
"additional_files": og.graph_additional_files,
|
|
120
124
|
"is_loadable": og.is_graph_loadable,
|
|
125
|
+
"object_priority": og.graph_object_priority,
|
|
121
126
|
"load": og.load_graph,
|
|
122
127
|
"is_saveable": og.is_graph_saveable,
|
|
123
128
|
"save": og.save_graph,
|
|
@@ -132,6 +137,7 @@ def geode_objects_dict():
|
|
|
132
137
|
"output_factory": og.HybridSolidOutputFactory3D,
|
|
133
138
|
"additional_files": og.hybrid_solid_additional_files3D,
|
|
134
139
|
"is_loadable": og.is_hybrid_solid_loadable3D,
|
|
140
|
+
"object_priority": og.hybrid_solid_object_priority3D,
|
|
135
141
|
"load": og.load_hybrid_solid3D,
|
|
136
142
|
"is_saveable": og.is_hybrid_solid_saveable3D,
|
|
137
143
|
"save": og.save_hybrid_solid3D,
|
|
@@ -156,6 +162,7 @@ def geode_objects_dict():
|
|
|
156
162
|
"output_factory": og_gs.ImplicitCrossSectionOutputFactory,
|
|
157
163
|
"additional_files": og_gs.implicit_cross_section_additional_files,
|
|
158
164
|
"is_loadable": og_gs.is_implicit_cross_section_loadable,
|
|
165
|
+
"object_priority": og_gs.implicit_cross_section_object_priority,
|
|
159
166
|
"load": og_gs.load_implicit_cross_section,
|
|
160
167
|
"is_saveable": og_gs.is_implicit_cross_section_saveable,
|
|
161
168
|
"save": og_gs.save_implicit_cross_section,
|
|
@@ -179,6 +186,7 @@ def geode_objects_dict():
|
|
|
179
186
|
"output_factory": og_gs.ImplicitStructuralModelOutputFactory,
|
|
180
187
|
"additional_files": og_gs.implicit_structural_model_additional_files,
|
|
181
188
|
"is_loadable": og_gs.is_implicit_structural_model_loadable,
|
|
189
|
+
"object_priority": og_gs.implicit_structural_model_object_priority,
|
|
182
190
|
"load": og_gs.load_implicit_structural_model,
|
|
183
191
|
"is_saveable": og_gs.is_implicit_structural_model_saveable,
|
|
184
192
|
"save": og_gs.save_implicit_structural_model,
|
|
@@ -201,6 +209,7 @@ def geode_objects_dict():
|
|
|
201
209
|
"output_factory": og.LightRegularGridOutputFactory2D,
|
|
202
210
|
"additional_files": og.light_regular_grid_additional_files2D,
|
|
203
211
|
"is_loadable": og.is_light_regular_grid_loadable2D,
|
|
212
|
+
"object_priority": og.light_regular_grid_object_priority2D,
|
|
204
213
|
"load": og.load_light_regular_grid2D,
|
|
205
214
|
"is_saveable": og.is_light_regular_grid_saveable2D,
|
|
206
215
|
"save": og.save_light_regular_grid2D,
|
|
@@ -208,7 +217,7 @@ def geode_objects_dict():
|
|
|
208
217
|
"elements": [points, polygons],
|
|
209
218
|
"is_3D": False,
|
|
210
219
|
"is_viewable": True,
|
|
211
|
-
"save_viewable": g_v.
|
|
220
|
+
"save_viewable": g_v.save_viewable_light_regular_grid2D,
|
|
212
221
|
"save_light_viewable": g_v.save_light_viewable_light_regular_grid2D,
|
|
213
222
|
},
|
|
214
223
|
"LightRegularGrid3D": {
|
|
@@ -217,6 +226,7 @@ def geode_objects_dict():
|
|
|
217
226
|
"output_factory": og.LightRegularGridOutputFactory3D,
|
|
218
227
|
"additional_files": og.light_regular_grid_additional_files3D,
|
|
219
228
|
"is_loadable": og.is_light_regular_grid_loadable3D,
|
|
229
|
+
"object_priority": og.light_regular_grid_object_priority3D,
|
|
220
230
|
"load": og.load_light_regular_grid3D,
|
|
221
231
|
"is_saveable": og.is_light_regular_grid_saveable3D,
|
|
222
232
|
"save": og.save_light_regular_grid3D,
|
|
@@ -233,6 +243,7 @@ def geode_objects_dict():
|
|
|
233
243
|
"output_factory": og.PointSetOutputFactory2D,
|
|
234
244
|
"additional_files": og.point_set_additional_files2D,
|
|
235
245
|
"is_loadable": og.is_point_set_loadable2D,
|
|
246
|
+
"object_priority": og.point_set_object_priority2D,
|
|
236
247
|
"load": og.load_point_set2D,
|
|
237
248
|
"is_saveable": og.is_point_set_saveable2D,
|
|
238
249
|
"save": og.save_point_set2D,
|
|
@@ -256,6 +267,7 @@ def geode_objects_dict():
|
|
|
256
267
|
"output_factory": og.PointSetOutputFactory3D,
|
|
257
268
|
"additional_files": og.point_set_additional_files3D,
|
|
258
269
|
"is_loadable": og.is_point_set_loadable3D,
|
|
270
|
+
"object_priority": og.point_set_object_priority3D,
|
|
259
271
|
"load": og.load_point_set3D,
|
|
260
272
|
"is_saveable": og.is_point_set_saveable3D,
|
|
261
273
|
"save": og.save_point_set3D,
|
|
@@ -279,6 +291,7 @@ def geode_objects_dict():
|
|
|
279
291
|
"output_factory": og.PolygonalSurfaceOutputFactory2D,
|
|
280
292
|
"additional_files": og.polygonal_surface_additional_files2D,
|
|
281
293
|
"is_loadable": og.is_polygonal_surface_loadable2D,
|
|
294
|
+
"object_priority": og.polygonal_surface_object_priority2D,
|
|
282
295
|
"load": og.load_polygonal_surface2D,
|
|
283
296
|
"is_saveable": og.is_polygonal_surface_saveable2D,
|
|
284
297
|
"save": og.save_polygonal_surface2D,
|
|
@@ -302,6 +315,7 @@ def geode_objects_dict():
|
|
|
302
315
|
"output_factory": og.PolygonalSurfaceOutputFactory3D,
|
|
303
316
|
"additional_files": og.polygonal_surface_additional_files3D,
|
|
304
317
|
"is_loadable": og.is_polygonal_surface_loadable3D,
|
|
318
|
+
"object_priority": og.polygonal_surface_object_priority3D,
|
|
305
319
|
"load": og.load_polygonal_surface3D,
|
|
306
320
|
"is_saveable": og.is_polygonal_surface_saveable3D,
|
|
307
321
|
"save": og.save_polygonal_surface3D,
|
|
@@ -325,6 +339,7 @@ def geode_objects_dict():
|
|
|
325
339
|
"output_factory": og.PolyhedralSolidOutputFactory3D,
|
|
326
340
|
"additional_files": og.polyhedral_solid_additional_files3D,
|
|
327
341
|
"is_loadable": og.is_polyhedral_solid_loadable3D,
|
|
342
|
+
"object_priority": og.polyhedral_solid_object_priority3D,
|
|
328
343
|
"load": og.load_polyhedral_solid3D,
|
|
329
344
|
"is_saveable": og.is_polyhedral_solid_saveable3D,
|
|
330
345
|
"save": og.save_polyhedral_solid3D,
|
|
@@ -348,6 +363,7 @@ def geode_objects_dict():
|
|
|
348
363
|
"output_factory": og.RasterImageOutputFactory2D,
|
|
349
364
|
"additional_files": og.raster_image_additional_files2D,
|
|
350
365
|
"is_loadable": og.is_raster_image_loadable2D,
|
|
366
|
+
"object_priority": og.raster_image_object_priority2D,
|
|
351
367
|
"load": og.load_raster_image2D,
|
|
352
368
|
"is_saveable": og.is_raster_image_saveable2D,
|
|
353
369
|
"save": og.save_raster_image2D,
|
|
@@ -362,6 +378,7 @@ def geode_objects_dict():
|
|
|
362
378
|
"output_factory": og.RasterImageOutputFactory3D,
|
|
363
379
|
"additional_files": og.raster_image_additional_files3D,
|
|
364
380
|
"is_loadable": og.is_raster_image_loadable3D,
|
|
381
|
+
"object_priority": og.raster_image_object_priority3D,
|
|
365
382
|
"load": og.load_raster_image3D,
|
|
366
383
|
"is_saveable": og.is_raster_image_saveable3D,
|
|
367
384
|
"save": og.save_raster_image3D,
|
|
@@ -376,6 +393,7 @@ def geode_objects_dict():
|
|
|
376
393
|
"output_factory": og.RegularGridOutputFactory2D,
|
|
377
394
|
"additional_files": og.regular_grid_additional_files2D,
|
|
378
395
|
"is_loadable": og.is_regular_grid_loadable2D,
|
|
396
|
+
"object_priority": og.regular_grid_object_priority2D,
|
|
379
397
|
"load": og.load_regular_grid2D,
|
|
380
398
|
"is_saveable": og.is_regular_grid_saveable2D,
|
|
381
399
|
"save": og.save_regular_grid2D,
|
|
@@ -398,6 +416,7 @@ def geode_objects_dict():
|
|
|
398
416
|
"output_factory": og.RegularGridOutputFactory3D,
|
|
399
417
|
"additional_files": og.regular_grid_additional_files3D,
|
|
400
418
|
"is_loadable": og.is_regular_grid_loadable3D,
|
|
419
|
+
"object_priority": og.regular_grid_object_priority3D,
|
|
401
420
|
"load": og.load_regular_grid3D,
|
|
402
421
|
"is_saveable": og.is_regular_grid_saveable3D,
|
|
403
422
|
"save": og.save_regular_grid3D,
|
|
@@ -420,6 +439,7 @@ def geode_objects_dict():
|
|
|
420
439
|
"output_factory": og.SectionOutputFactory,
|
|
421
440
|
"additional_files": og.section_additional_files,
|
|
422
441
|
"is_loadable": og.is_section_loadable,
|
|
442
|
+
"object_priority": og.section_object_priority,
|
|
423
443
|
"load": og.load_section,
|
|
424
444
|
"is_saveable": og.is_section_saveable,
|
|
425
445
|
"save": og.save_section,
|
|
@@ -443,6 +463,7 @@ def geode_objects_dict():
|
|
|
443
463
|
"output_factory": og_gs.StructuralModelOutputFactory,
|
|
444
464
|
"additional_files": og_gs.structural_model_additional_files,
|
|
445
465
|
"is_loadable": og_gs.is_structural_model_loadable,
|
|
466
|
+
"object_priority": og_gs.structural_model_object_priority,
|
|
446
467
|
"load": og_gs.load_structural_model,
|
|
447
468
|
"is_saveable": og_gs.is_structural_model_saveable,
|
|
448
469
|
"save": og_gs.save_structural_model,
|
|
@@ -465,6 +486,7 @@ def geode_objects_dict():
|
|
|
465
486
|
"output_factory": og.TetrahedralSolidOutputFactory3D,
|
|
466
487
|
"additional_files": og.tetrahedral_solid_additional_files3D,
|
|
467
488
|
"is_loadable": og.is_tetrahedral_solid_loadable3D,
|
|
489
|
+
"object_priority": og.tetrahedral_solid_object_priority3D,
|
|
468
490
|
"load": og.load_tetrahedral_solid3D,
|
|
469
491
|
"is_saveable": og.is_tetrahedral_solid_saveable3D,
|
|
470
492
|
"save": og.save_tetrahedral_solid3D,
|
|
@@ -488,6 +510,7 @@ def geode_objects_dict():
|
|
|
488
510
|
"output_factory": og.TriangulatedSurfaceOutputFactory2D,
|
|
489
511
|
"additional_files": og.triangulated_surface_additional_files2D,
|
|
490
512
|
"is_loadable": og.is_triangulated_surface_loadable2D,
|
|
513
|
+
"object_priority": og.triangulated_surface_object_priority2D,
|
|
491
514
|
"load": og.load_triangulated_surface2D,
|
|
492
515
|
"is_saveable": og.is_triangulated_surface_saveable2D,
|
|
493
516
|
"save": og.save_triangulated_surface2D,
|
|
@@ -511,6 +534,7 @@ def geode_objects_dict():
|
|
|
511
534
|
"output_factory": og.TriangulatedSurfaceOutputFactory3D,
|
|
512
535
|
"additional_files": og.triangulated_surface_additional_files3D,
|
|
513
536
|
"is_loadable": og.is_triangulated_surface_loadable3D,
|
|
537
|
+
"object_priority": og.triangulated_surface_object_priority3D,
|
|
514
538
|
"load": og.load_triangulated_surface3D,
|
|
515
539
|
"is_saveable": og.is_triangulated_surface_saveable3D,
|
|
516
540
|
"save": og.save_triangulated_surface3D,
|
|
@@ -534,6 +558,7 @@ def geode_objects_dict():
|
|
|
534
558
|
"output_factory": og.VertexSetOutputFactory,
|
|
535
559
|
"additional_files": og.vertex_set_additional_files,
|
|
536
560
|
"is_loadable": og.is_vertex_set_loadable,
|
|
561
|
+
"object_priority": og.vertex_set_object_priority,
|
|
537
562
|
"load": og.load_vertex_set,
|
|
538
563
|
"is_saveable": og.is_vertex_set_saveable,
|
|
539
564
|
"save": og.save_vertex_set,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
partial
|
|
@@ -53,7 +53,7 @@ with open(
|
|
|
53
53
|
def allowed_files():
|
|
54
54
|
utils_functions.validate_request(flask.request, allowed_files_json)
|
|
55
55
|
extensions = geode_functions.list_input_extensions(
|
|
56
|
-
flask.request.
|
|
56
|
+
flask.request.get_json()["supported_feature"]
|
|
57
57
|
)
|
|
58
58
|
return flask.make_response({"extensions": extensions}, 200)
|
|
59
59
|
|
|
@@ -99,10 +99,10 @@ def allowed_objects():
|
|
|
99
99
|
|
|
100
100
|
utils_functions.validate_request(flask.request, allowed_objects_json)
|
|
101
101
|
file_absolute_path = geode_functions.upload_file_path(
|
|
102
|
-
flask.request.
|
|
102
|
+
flask.request.get_json()["filename"]
|
|
103
103
|
)
|
|
104
104
|
allowed_objects = geode_functions.list_geode_objects(
|
|
105
|
-
file_absolute_path, flask.request.
|
|
105
|
+
file_absolute_path, flask.request.get_json()["supported_feature"]
|
|
106
106
|
)
|
|
107
107
|
return flask.make_response({"allowed_objects": allowed_objects}, 200)
|
|
108
108
|
|
|
@@ -120,10 +120,10 @@ with open(
|
|
|
120
120
|
)
|
|
121
121
|
def missing_files():
|
|
122
122
|
utils_functions.validate_request(flask.request, missing_files_json)
|
|
123
|
-
file_path = geode_functions.upload_file_path(flask.request.
|
|
123
|
+
file_path = geode_functions.upload_file_path(flask.request.get_json()["filename"])
|
|
124
124
|
|
|
125
125
|
additional_files = geode_functions.additional_files(
|
|
126
|
-
flask.request.
|
|
126
|
+
flask.request.get_json()["input_geode_object"],
|
|
127
127
|
file_path,
|
|
128
128
|
)
|
|
129
129
|
|
|
@@ -167,7 +167,7 @@ with open(
|
|
|
167
167
|
def crs_converter_geographic_coordinate_systems():
|
|
168
168
|
utils_functions.validate_request(flask.request, geographic_coordinate_systems_json)
|
|
169
169
|
infos = geode_functions.geographic_coordinate_systems(
|
|
170
|
-
flask.request.
|
|
170
|
+
flask.request.get_json()["input_geode_object"]
|
|
171
171
|
)
|
|
172
172
|
crs_list = []
|
|
173
173
|
for info in infos:
|
|
@@ -194,10 +194,12 @@ with open(
|
|
|
194
194
|
def inspect_file():
|
|
195
195
|
utils_functions.validate_request(flask.request, inspect_file_json)
|
|
196
196
|
|
|
197
|
-
file_path = geode_functions.upload_file_path(flask.request.
|
|
198
|
-
data = geode_functions.load(
|
|
197
|
+
file_path = geode_functions.upload_file_path(flask.request.get_json()["filename"])
|
|
198
|
+
data = geode_functions.load(
|
|
199
|
+
flask.request.get_json()["input_geode_object"], file_path
|
|
200
|
+
)
|
|
199
201
|
class_inspector = geode_functions.inspect(
|
|
200
|
-
flask.request.
|
|
202
|
+
flask.request.get_json()["input_geode_object"], data
|
|
201
203
|
)
|
|
202
204
|
inspection_result = geode_functions.get_inspector_children(class_inspector)
|
|
203
205
|
return flask.make_response({"inspection_result": inspection_result}, 200)
|
|
@@ -218,14 +220,14 @@ def geode_objects_and_output_extensions():
|
|
|
218
220
|
utils_functions.validate_request(
|
|
219
221
|
flask.request, geode_objects_and_output_extensions_json
|
|
220
222
|
)
|
|
221
|
-
file_path = geode_functions.upload_file_path(flask.request.
|
|
223
|
+
file_path = geode_functions.upload_file_path(flask.request.get_json()["filename"])
|
|
222
224
|
data = geode_functions.load(
|
|
223
|
-
flask.request.
|
|
225
|
+
flask.request.get_json()["input_geode_object"],
|
|
224
226
|
file_path,
|
|
225
227
|
)
|
|
226
228
|
geode_objects_and_output_extensions = (
|
|
227
229
|
geode_functions.geode_objects_output_extensions(
|
|
228
|
-
flask.request.
|
|
230
|
+
flask.request.get_json()["input_geode_object"], data
|
|
229
231
|
)
|
|
230
232
|
)
|
|
231
233
|
return flask.make_response(
|
|
@@ -249,8 +251,8 @@ def save_viewable_file():
|
|
|
249
251
|
utils_functions.validate_request(flask.request, save_viewable_file_json)
|
|
250
252
|
return flask.make_response(
|
|
251
253
|
utils_functions.generate_native_viewable_and_light_viewable_from_file(
|
|
252
|
-
geode_object=flask.request.
|
|
253
|
-
input_filename=flask.request.
|
|
254
|
+
geode_object=flask.request.get_json()["input_geode_object"],
|
|
255
|
+
input_filename=flask.request.get_json()["filename"],
|
|
254
256
|
),
|
|
255
257
|
200,
|
|
256
258
|
)
|
|
@@ -263,10 +265,10 @@ with open(os.path.join(schemas, "create_point.json"), "r") as file:
|
|
|
263
265
|
@routes.route(create_point_json["route"], methods=create_point_json["methods"])
|
|
264
266
|
def create_point():
|
|
265
267
|
utils_functions.validate_request(flask.request, create_point_json)
|
|
266
|
-
title = flask.request.
|
|
267
|
-
x = flask.request.
|
|
268
|
-
y = flask.request.
|
|
269
|
-
z = flask.request.
|
|
268
|
+
title = flask.request.get_json()["title"]
|
|
269
|
+
x = flask.request.get_json()["x"]
|
|
270
|
+
y = flask.request.get_json()["y"]
|
|
271
|
+
z = flask.request.get_json()["z"]
|
|
270
272
|
class_ = geode_functions.geode_object_class("PointSet3D")
|
|
271
273
|
PointSet3D = class_.create()
|
|
272
274
|
builder = geode_functions.create_builder("PointSet3D", PointSet3D)
|
|
@@ -290,14 +292,8 @@ with open(os.path.join(schemas, "texture_coordinates.json"), "r") as file:
|
|
|
290
292
|
)
|
|
291
293
|
def texture_coordinates():
|
|
292
294
|
utils_functions.validate_request(flask.request, texture_coordinates_json)
|
|
293
|
-
data = geode_functions.load_data(
|
|
294
|
-
flask.request.json["input_geode_object"],
|
|
295
|
-
flask.request.json["id"],
|
|
296
|
-
flask.request.json["filename"],
|
|
297
|
-
)
|
|
298
|
-
|
|
295
|
+
data = geode_functions.load_data(flask.request.get_json().get("id"))
|
|
299
296
|
texture_coordinates = data.texture_manager().texture_names()
|
|
300
|
-
|
|
301
297
|
return flask.make_response({"texture_coordinates": texture_coordinates}, 200)
|
|
302
298
|
|
|
303
299
|
|
|
@@ -314,14 +310,8 @@ with open(
|
|
|
314
310
|
)
|
|
315
311
|
def vertex_attribute_names():
|
|
316
312
|
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
|
|
317
|
-
data = geode_functions.load_data(
|
|
318
|
-
flask.request.json["input_geode_object"],
|
|
319
|
-
flask.request.json["id"],
|
|
320
|
-
flask.request.json["filename"],
|
|
321
|
-
)
|
|
322
|
-
|
|
313
|
+
data = geode_functions.load_data(flask.request.get_json().get("id"))
|
|
323
314
|
vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
|
|
324
|
-
|
|
325
315
|
return flask.make_response(
|
|
326
316
|
{
|
|
327
317
|
"vertex_attribute_names": vertex_attribute_names,
|
|
@@ -343,14 +333,8 @@ with open(
|
|
|
343
333
|
)
|
|
344
334
|
def polygon_attribute_names():
|
|
345
335
|
utils_functions.validate_request(flask.request, polygon_attribute_names_json)
|
|
346
|
-
data = geode_functions.load_data(
|
|
347
|
-
flask.request.json["input_geode_object"],
|
|
348
|
-
flask.request.json["id"],
|
|
349
|
-
flask.request.json["filename"],
|
|
350
|
-
)
|
|
351
|
-
|
|
336
|
+
data = geode_functions.load_data(flask.request.get_json().get("id"))
|
|
352
337
|
polygon_attribute_names = data.polygon_attribute_manager().attribute_names()
|
|
353
|
-
|
|
354
338
|
return flask.make_response(
|
|
355
339
|
{
|
|
356
340
|
"polygon_attribute_names": polygon_attribute_names,
|
|
@@ -372,14 +356,8 @@ with open(
|
|
|
372
356
|
)
|
|
373
357
|
def polyhedron_attribute_names():
|
|
374
358
|
utils_functions.validate_request(flask.request, polyhedron_attribute_names_json)
|
|
375
|
-
data = geode_functions.load_data(
|
|
376
|
-
flask.request.json["input_geode_object"],
|
|
377
|
-
flask.request.json["id"],
|
|
378
|
-
flask.request.json["filename"],
|
|
379
|
-
)
|
|
380
|
-
|
|
359
|
+
data = geode_functions.load_data(flask.request.get_json().get("id"))
|
|
381
360
|
polyhedron_attribute_names = data.polyhedron_attribute_manager().attribute_names()
|
|
382
|
-
|
|
383
361
|
return flask.make_response(
|
|
384
362
|
{
|
|
385
363
|
"polyhedron_attribute_names": polyhedron_attribute_names,
|
|
@@ -20,7 +20,7 @@ def uuid_to_flat_index():
|
|
|
20
20
|
utils_functions.validate_request(flask.request, vtm_component_indices_json)
|
|
21
21
|
|
|
22
22
|
vtm_file_path = geode_functions.data_file_path(
|
|
23
|
-
flask.request.
|
|
23
|
+
flask.request.get_json().get("id"), "viewable.vtm"
|
|
24
24
|
)
|
|
25
25
|
tree = ET.parse(vtm_file_path)
|
|
26
26
|
root = tree.find("vtkMultiBlockDataSet")
|
|
@@ -49,12 +49,6 @@ with open(os.path.join(schemas, "mesh_components.json"), "r") as file:
|
|
|
49
49
|
@routes.route(mesh_components_json["route"], methods=mesh_components_json["methods"])
|
|
50
50
|
def extract_uuids_endpoint():
|
|
51
51
|
utils_functions.validate_request(flask.request, mesh_components_json)
|
|
52
|
-
|
|
53
|
-
model = geode_functions.load_data(
|
|
54
|
-
flask.request.json["geode_object"],
|
|
55
|
-
flask.request.json["id"],
|
|
56
|
-
flask.request.json["filename"],
|
|
57
|
-
)
|
|
58
|
-
|
|
52
|
+
model = geode_functions.load_data(flask.request.get_json().get("id"))
|
|
59
53
|
uuid_dict = extract_model_uuids(model)
|
|
60
54
|
return flask.make_response({"uuid_dict": uuid_dict}, 200)
|
|
@@ -8,20 +8,10 @@
|
|
|
8
8
|
"id": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"minLength": 1
|
|
11
|
-
},
|
|
12
|
-
"filename": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
},
|
|
16
|
-
"geode_object": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"minLength": 1
|
|
19
11
|
}
|
|
20
12
|
},
|
|
21
13
|
"required": [
|
|
22
|
-
"id"
|
|
23
|
-
"filename",
|
|
24
|
-
"geode_object"
|
|
14
|
+
"id"
|
|
25
15
|
],
|
|
26
16
|
"additionalProperties": false
|
|
27
17
|
}
|
|
@@ -5,22 +5,12 @@
|
|
|
5
5
|
],
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"input_geode_object": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"minLength": 1
|
|
11
|
-
},
|
|
12
|
-
"filename": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
},
|
|
16
8
|
"id": {
|
|
17
9
|
"type": "string",
|
|
18
10
|
"minLength": 1
|
|
19
11
|
}
|
|
20
12
|
},
|
|
21
13
|
"required": [
|
|
22
|
-
"input_geode_object",
|
|
23
|
-
"filename",
|
|
24
14
|
"id"
|
|
25
15
|
],
|
|
26
16
|
"additionalProperties": false
|
|
@@ -5,22 +5,12 @@
|
|
|
5
5
|
],
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"input_geode_object": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"minLength": 1
|
|
11
|
-
},
|
|
12
|
-
"filename": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
},
|
|
16
8
|
"id": {
|
|
17
9
|
"type": "string",
|
|
18
10
|
"minLength": 1
|
|
19
11
|
}
|
|
20
12
|
},
|
|
21
13
|
"required": [
|
|
22
|
-
"input_geode_object",
|
|
23
|
-
"filename",
|
|
24
14
|
"id"
|
|
25
15
|
],
|
|
26
16
|
"additionalProperties": false
|
|
@@ -5,23 +5,13 @@
|
|
|
5
5
|
],
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"input_geode_object": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"minLength": 1
|
|
11
|
-
},
|
|
12
|
-
"filename": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
},
|
|
16
8
|
"id": {
|
|
17
9
|
"type": "string",
|
|
18
10
|
"minLength": 1
|
|
19
11
|
}
|
|
20
12
|
},
|
|
21
13
|
"required": [
|
|
22
|
-
"
|
|
23
|
-
"id",
|
|
24
|
-
"filename"
|
|
14
|
+
"id"
|
|
25
15
|
],
|
|
26
16
|
"additionalProperties": false
|
|
27
17
|
}
|
|
@@ -5,22 +5,12 @@
|
|
|
5
5
|
],
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"input_geode_object": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"minLength": 1
|
|
11
|
-
},
|
|
12
|
-
"filename": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
},
|
|
16
8
|
"id": {
|
|
17
9
|
"type": "string",
|
|
18
10
|
"minLength": 1
|
|
19
11
|
}
|
|
20
12
|
},
|
|
21
13
|
"required": [
|
|
22
|
-
"input_geode_object",
|
|
23
|
-
"filename",
|
|
24
14
|
"id"
|
|
25
15
|
],
|
|
26
16
|
"additionalProperties": false
|
|
@@ -2,54 +2,59 @@
|
|
|
2
2
|
import os
|
|
3
3
|
import threading
|
|
4
4
|
import time
|
|
5
|
-
import uuid
|
|
6
5
|
import zipfile
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
from typing import Any
|
|
8
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
7
9
|
|
|
8
10
|
# Third party imports
|
|
9
11
|
import flask
|
|
10
|
-
import fastjsonschema
|
|
12
|
+
import fastjsonschema # type: ignore
|
|
11
13
|
import importlib.metadata as metadata
|
|
12
14
|
import shutil
|
|
15
|
+
from werkzeug.exceptions import HTTPException
|
|
13
16
|
import werkzeug
|
|
14
17
|
|
|
15
18
|
# Local application imports
|
|
16
19
|
from . import geode_functions
|
|
20
|
+
from opengeodeweb_microservice.database.data import Data
|
|
21
|
+
from opengeodeweb_microservice.database.connection import get_session
|
|
17
22
|
|
|
18
23
|
|
|
19
|
-
def increment_request_counter(current_app):
|
|
24
|
+
def increment_request_counter(current_app: flask.Flask) -> None:
|
|
20
25
|
if "REQUEST_COUNTER" in current_app.config:
|
|
21
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
|
26
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
|
22
27
|
REQUEST_COUNTER += 1
|
|
23
28
|
current_app.config.update(REQUEST_COUNTER=REQUEST_COUNTER)
|
|
24
29
|
|
|
25
30
|
|
|
26
|
-
def decrement_request_counter(current_app):
|
|
31
|
+
def decrement_request_counter(current_app: flask.Flask) -> None:
|
|
27
32
|
if "REQUEST_COUNTER" in current_app.config:
|
|
28
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
|
33
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
|
29
34
|
REQUEST_COUNTER -= 1
|
|
30
35
|
current_app.config.update(REQUEST_COUNTER=REQUEST_COUNTER)
|
|
31
36
|
|
|
32
37
|
|
|
33
|
-
def update_last_request_time(current_app):
|
|
38
|
+
def update_last_request_time(current_app: flask.Flask) -> None:
|
|
34
39
|
if "LAST_REQUEST_TIME" in current_app.config:
|
|
35
40
|
LAST_REQUEST_TIME = time.time()
|
|
36
41
|
current_app.config.update(LAST_REQUEST_TIME=LAST_REQUEST_TIME)
|
|
37
42
|
|
|
38
43
|
|
|
39
|
-
def before_request(current_app):
|
|
44
|
+
def before_request(current_app: flask.Flask) -> None:
|
|
40
45
|
increment_request_counter(current_app)
|
|
41
46
|
|
|
42
47
|
|
|
43
|
-
def teardown_request(current_app):
|
|
48
|
+
def teardown_request(current_app: flask.Flask) -> None:
|
|
44
49
|
decrement_request_counter(current_app)
|
|
45
50
|
update_last_request_time(current_app)
|
|
46
51
|
|
|
47
52
|
|
|
48
|
-
def kill_task(current_app):
|
|
49
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
|
50
|
-
LAST_PING_TIME = float(current_app.config.get("LAST_PING_TIME"))
|
|
51
|
-
LAST_REQUEST_TIME = float(current_app.config.get("LAST_REQUEST_TIME"))
|
|
52
|
-
MINUTES_BEFORE_TIMEOUT = float(current_app.config.get("MINUTES_BEFORE_TIMEOUT"))
|
|
53
|
+
def kill_task(current_app: flask.Flask) -> None:
|
|
54
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
|
55
|
+
LAST_PING_TIME = float(current_app.config.get("LAST_PING_TIME", 0))
|
|
56
|
+
LAST_REQUEST_TIME = float(current_app.config.get("LAST_REQUEST_TIME", 0))
|
|
57
|
+
MINUTES_BEFORE_TIMEOUT = float(current_app.config.get("MINUTES_BEFORE_TIMEOUT", 0))
|
|
53
58
|
current_time = time.time()
|
|
54
59
|
minutes_since_last_request = (current_time - LAST_REQUEST_TIME) / 60
|
|
55
60
|
minutes_since_last_ping = (current_time - LAST_PING_TIME) / 60
|
|
@@ -64,12 +69,12 @@ def kill_task(current_app):
|
|
|
64
69
|
kill_server()
|
|
65
70
|
|
|
66
71
|
|
|
67
|
-
def kill_server():
|
|
72
|
+
def kill_server() -> None:
|
|
68
73
|
print("Server timed out due to inactivity, shutting down...", flush=True)
|
|
69
74
|
os._exit(0)
|
|
70
75
|
|
|
71
76
|
|
|
72
|
-
def versions(list_packages: list):
|
|
77
|
+
def versions(list_packages: list[str]) -> list[dict[str, str]]:
|
|
73
78
|
list_with_versions = []
|
|
74
79
|
for package in list_packages:
|
|
75
80
|
list_with_versions.append(
|
|
@@ -78,7 +83,7 @@ def versions(list_packages: list):
|
|
|
78
83
|
return list_with_versions
|
|
79
84
|
|
|
80
85
|
|
|
81
|
-
def validate_request(request, schema):
|
|
86
|
+
def validate_request(request: flask.Request, schema: dict[str, str]) -> None:
|
|
82
87
|
json_data = request.get_json(force=True, silent=True)
|
|
83
88
|
|
|
84
89
|
if json_data is None:
|
|
@@ -92,22 +97,26 @@ def validate_request(request, schema):
|
|
|
92
97
|
flask.abort(400, error_msg)
|
|
93
98
|
|
|
94
99
|
|
|
95
|
-
def set_interval(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
def set_interval(
|
|
101
|
+
function: Callable[[Any], None], seconds: float, args: Any
|
|
102
|
+
) -> threading.Timer:
|
|
103
|
+
def function_wrapper() -> None:
|
|
104
|
+
set_interval(function, seconds, args)
|
|
105
|
+
function(args)
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return
|
|
107
|
+
timer = threading.Timer(seconds, function_wrapper)
|
|
108
|
+
timer.daemon = True
|
|
109
|
+
timer.start()
|
|
110
|
+
return timer
|
|
104
111
|
|
|
105
112
|
|
|
106
|
-
def extension_from_filename(filename):
|
|
113
|
+
def extension_from_filename(filename: str) -> str:
|
|
107
114
|
return os.path.splitext(filename)[1][1:]
|
|
108
115
|
|
|
109
116
|
|
|
110
|
-
def send_file(
|
|
117
|
+
def send_file(
|
|
118
|
+
upload_folder: str, saved_files: str, new_file_name: str
|
|
119
|
+
) -> flask.Response:
|
|
111
120
|
if len(saved_files) == 1:
|
|
112
121
|
mimetype = "application/octet-binary"
|
|
113
122
|
else:
|
|
@@ -132,66 +141,100 @@ def send_file(upload_folder, saved_files, new_file_name):
|
|
|
132
141
|
return response
|
|
133
142
|
|
|
134
143
|
|
|
135
|
-
def handle_exception(
|
|
136
|
-
response =
|
|
144
|
+
def handle_exception(exception: HTTPException) -> flask.Response:
|
|
145
|
+
response = exception.get_response()
|
|
137
146
|
response.data = flask.json.dumps(
|
|
138
147
|
{
|
|
139
|
-
"code":
|
|
140
|
-
"name":
|
|
141
|
-
"description":
|
|
148
|
+
"code": exception.code,
|
|
149
|
+
"name": exception.name,
|
|
150
|
+
"description": exception.description,
|
|
142
151
|
}
|
|
143
152
|
)
|
|
144
153
|
response.content_type = "application/json"
|
|
145
154
|
return response
|
|
146
155
|
|
|
147
156
|
|
|
148
|
-
def
|
|
157
|
+
def create_data_folder_from_id(data_id: str) -> str:
|
|
149
158
|
base_data_folder = flask.current_app.config["DATA_FOLDER_PATH"]
|
|
150
|
-
|
|
151
|
-
data_path = os.path.join(base_data_folder, generated_id)
|
|
159
|
+
data_path = os.path.join(base_data_folder, data_id)
|
|
152
160
|
os.makedirs(data_path, exist_ok=True)
|
|
153
|
-
return
|
|
161
|
+
return data_path
|
|
154
162
|
|
|
155
163
|
|
|
156
164
|
def save_all_viewables_and_return_info(
|
|
157
|
-
geode_object
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
geode_object,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
geode_object, data, data_path, "light_viewable"
|
|
170
|
-
)
|
|
171
|
-
with open(saved_light_viewable_file_path, "rb") as f:
|
|
172
|
-
binary_light_viewable = f.read()
|
|
173
|
-
|
|
174
|
-
return {
|
|
175
|
-
"name": data.name(),
|
|
176
|
-
"native_file_name": os.path.basename(saved_native_file_path[0]),
|
|
177
|
-
"viewable_file_name": os.path.basename(saved_viewable_file_path),
|
|
178
|
-
"id": generated_id,
|
|
179
|
-
"object_type": geode_functions.get_object_type(geode_object),
|
|
180
|
-
"binary_light_viewable": binary_light_viewable.decode("utf-8"),
|
|
181
|
-
"geode_object": geode_object,
|
|
182
|
-
"input_files": additional_files or [],
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def generate_native_viewable_and_light_viewable_from_object(geode_object, data):
|
|
187
|
-
generated_id, data_path = create_unique_data_folder()
|
|
188
|
-
return save_all_viewables_and_return_info(
|
|
189
|
-
geode_object, data, generated_id, data_path
|
|
165
|
+
geode_object: str,
|
|
166
|
+
data: Any,
|
|
167
|
+
input_file: str,
|
|
168
|
+
additional_files: list[str] | None = None,
|
|
169
|
+
) -> dict[str, Any]:
|
|
170
|
+
if additional_files is None:
|
|
171
|
+
additional_files = []
|
|
172
|
+
|
|
173
|
+
data_entry = Data.create(
|
|
174
|
+
geode_object=geode_object,
|
|
175
|
+
input_file=input_file,
|
|
176
|
+
additional_files=additional_files,
|
|
190
177
|
)
|
|
178
|
+
data_path = create_data_folder_from_id(data_entry.id)
|
|
179
|
+
with ThreadPoolExecutor() as executor:
|
|
180
|
+
native_future = executor.submit(
|
|
181
|
+
geode_functions.save,
|
|
182
|
+
geode_object,
|
|
183
|
+
data,
|
|
184
|
+
data_path,
|
|
185
|
+
"native." + data.native_extension(),
|
|
186
|
+
)
|
|
187
|
+
viewable_future = executor.submit(
|
|
188
|
+
geode_functions.save_viewable, geode_object, data, data_path, "viewable"
|
|
189
|
+
)
|
|
190
|
+
light_viewable_future = executor.submit(
|
|
191
|
+
geode_functions.save_light_viewable,
|
|
192
|
+
geode_object,
|
|
193
|
+
data,
|
|
194
|
+
data_path,
|
|
195
|
+
"light_viewable",
|
|
196
|
+
)
|
|
197
|
+
saved_light_viewable_file_path = light_viewable_future.result()
|
|
198
|
+
with open(saved_light_viewable_file_path, "rb") as f:
|
|
199
|
+
binary_light_viewable = f.read()
|
|
200
|
+
saved_native_file_path = native_future.result()
|
|
201
|
+
saved_viewable_file_path = viewable_future.result()
|
|
202
|
+
data_entry.native_file_name = os.path.basename(saved_native_file_path[0])
|
|
203
|
+
data_entry.viewable_file_name = os.path.basename(saved_viewable_file_path)
|
|
204
|
+
data_entry.light_viewable = os.path.basename(saved_light_viewable_file_path)
|
|
205
|
+
|
|
206
|
+
session = get_session()
|
|
207
|
+
if session:
|
|
208
|
+
session.commit()
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
"native_file_name": data_entry.native_file_name,
|
|
212
|
+
"viewable_file_name": data_entry.viewable_file_name,
|
|
213
|
+
"id": data_entry.id,
|
|
214
|
+
"object_type": geode_functions.get_object_type(geode_object),
|
|
215
|
+
"binary_light_viewable": binary_light_viewable.decode("utf-8"),
|
|
216
|
+
"geode_object": data_entry.geode_object,
|
|
217
|
+
"input_files": data_entry.input_file,
|
|
218
|
+
"additional_files": data_entry.additional_files,
|
|
219
|
+
}
|
|
191
220
|
|
|
192
221
|
|
|
193
|
-
def
|
|
194
|
-
|
|
222
|
+
def generate_native_viewable_and_light_viewable_from_object(
|
|
223
|
+
geode_object: str, data: Any
|
|
224
|
+
) -> dict[str, Any]:
|
|
225
|
+
return save_all_viewables_and_return_info(geode_object, data, input_file="")
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def generate_native_viewable_and_light_viewable_from_file(
|
|
229
|
+
geode_object: str, input_filename: str
|
|
230
|
+
) -> dict[str, Any]:
|
|
231
|
+
temp_data_entry = Data.create(
|
|
232
|
+
geode_object=geode_object,
|
|
233
|
+
input_file=input_filename,
|
|
234
|
+
additional_files=[],
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
data_path = create_data_folder_from_id(temp_data_entry.id)
|
|
195
238
|
|
|
196
239
|
full_input_filename = geode_functions.upload_file_path(input_filename)
|
|
197
240
|
copied_full_path = os.path.join(
|
|
@@ -199,7 +242,7 @@ def generate_native_viewable_and_light_viewable_from_file(geode_object, input_fi
|
|
|
199
242
|
)
|
|
200
243
|
shutil.copy2(full_input_filename, copied_full_path)
|
|
201
244
|
|
|
202
|
-
additional_files_copied = []
|
|
245
|
+
additional_files_copied: list[str] = []
|
|
203
246
|
additional = geode_functions.additional_files(geode_object, full_input_filename)
|
|
204
247
|
for additional_file in additional.mandatory_files + additional.optional_files:
|
|
205
248
|
if additional_file.is_missing:
|
|
@@ -214,12 +257,20 @@ def generate_native_viewable_and_light_viewable_from_file(geode_object, input_fi
|
|
|
214
257
|
shutil.copy2(source_path, dest_path)
|
|
215
258
|
additional_files_copied.append(additional_file.filename)
|
|
216
259
|
|
|
217
|
-
data = geode_functions.
|
|
260
|
+
data = geode_functions.load(geode_object, copied_full_path)
|
|
261
|
+
|
|
262
|
+
# Remplacer :
|
|
263
|
+
# database.session.delete(temp_data_entry)
|
|
264
|
+
# database.session.flush()
|
|
265
|
+
# Par :
|
|
266
|
+
session = get_session()
|
|
267
|
+
if session:
|
|
268
|
+
session.delete(temp_data_entry)
|
|
269
|
+
session.flush()
|
|
218
270
|
|
|
219
271
|
return save_all_viewables_and_return_info(
|
|
220
272
|
geode_object,
|
|
221
273
|
data,
|
|
222
|
-
|
|
223
|
-
data_path,
|
|
274
|
+
input_file=input_filename,
|
|
224
275
|
additional_files=additional_files_copied,
|
|
225
276
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: OpenGeodeWeb-Back
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.10.0
|
|
4
4
|
Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
|
|
5
5
|
Author-email: Geode-solutions <team-web@geode-solutions.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
|
|
@@ -11,22 +11,27 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: <3.13,>=3.9
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: asgiref
|
|
15
|
-
Requires-Dist: blinker
|
|
16
|
-
Requires-Dist: click
|
|
17
|
-
Requires-Dist: fastjsonschema
|
|
18
|
-
Requires-Dist: flask[async]
|
|
19
|
-
Requires-Dist: flask-cors
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist: geode-
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: opengeode-
|
|
28
|
-
Requires-Dist: opengeode-
|
|
29
|
-
Requires-Dist: opengeode-
|
|
14
|
+
Requires-Dist: asgiref~=3.0
|
|
15
|
+
Requires-Dist: blinker~=1.0
|
|
16
|
+
Requires-Dist: click~=8.0
|
|
17
|
+
Requires-Dist: fastjsonschema~=2.0
|
|
18
|
+
Requires-Dist: flask[async]~=3.0
|
|
19
|
+
Requires-Dist: flask-cors~=6.0
|
|
20
|
+
Requires-Dist: flask-sqlalchemy~=3.0
|
|
21
|
+
Requires-Dist: geode-common==33.11.0
|
|
22
|
+
Requires-Dist: geode-viewables==3.3.0
|
|
23
|
+
Requires-Dist: greenlet~=3.0
|
|
24
|
+
Requires-Dist: itsdangerous~=2.0
|
|
25
|
+
Requires-Dist: jinja2~=3.0
|
|
26
|
+
Requires-Dist: markupsafe~=3.0
|
|
27
|
+
Requires-Dist: opengeode-core==15.27.4
|
|
28
|
+
Requires-Dist: opengeode-geosciences==9.4.1
|
|
29
|
+
Requires-Dist: opengeode-geosciencesio==5.8.0
|
|
30
|
+
Requires-Dist: opengeode-inspector==6.8.1
|
|
31
|
+
Requires-Dist: opengeode-io==7.4.0
|
|
32
|
+
Requires-Dist: opengeodeweb-microservice~=1.0
|
|
33
|
+
Requires-Dist: sqlalchemy~=2.0
|
|
34
|
+
Requires-Dist: typing-extensions~=4.0
|
|
30
35
|
Requires-Dist: werkzeug==3.0.3
|
|
31
36
|
Dynamic: license-file
|
|
32
37
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
opengeodeweb_back/app_config.py,sha256=
|
|
3
|
-
opengeodeweb_back/geode_functions.py,sha256=
|
|
4
|
-
opengeodeweb_back/geode_objects.py,sha256=
|
|
2
|
+
opengeodeweb_back/app_config.py,sha256=WH0f-J-cXgIU23wAhn-lujwqN2-htUw9nSWkrgyW5xc,1207
|
|
3
|
+
opengeodeweb_back/geode_functions.py,sha256=NzELy9s6AETDnm7tyA_uM2N89zrfeLdblRhzYrBONmw,10804
|
|
4
|
+
opengeodeweb_back/geode_objects.py,sha256=_NclGPa024kCwUHdORkFuXYtiZBmQpgq6sO3LRkBhe8,27776
|
|
5
|
+
opengeodeweb_back/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
5
6
|
opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
|
|
6
|
-
opengeodeweb_back/utils_functions.py,sha256=
|
|
7
|
-
opengeodeweb_back/routes/blueprint_routes.py,sha256=
|
|
8
|
-
opengeodeweb_back/routes/models/blueprint_models.py,sha256=
|
|
9
|
-
opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=
|
|
7
|
+
opengeodeweb_back/utils_functions.py,sha256=k8FpsHruaqnqyYgfwRC2JVvzoQrV5JgY7z5JJ7dhMgs,9180
|
|
8
|
+
opengeodeweb_back/routes/blueprint_routes.py,sha256=h_yfFC3ljH0KqFr5Ab_-IQYNB7VVRENwAMQk4NDsh18,11042
|
|
9
|
+
opengeodeweb_back/routes/models/blueprint_models.py,sha256=Jo9pUDeu1nO3_IbBiuHGk57cc4_fhwxjM0EKNyv1FT0,1874
|
|
10
|
+
opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=JmQUvpy7HpGS6FlThZLx1YjHqiInRTqUZ_Ft5MfOzEE,239
|
|
10
11
|
opengeodeweb_back/routes/models/schemas/vtm_component_indices.json,sha256=0XILVxhAxi0RhQFDZZoUeGcAnBMroWz3kNJS7-6_dKQ,239
|
|
11
12
|
opengeodeweb_back/routes/schemas/allowed_files.json,sha256=pRsGf39LiJpl3zEGLg4IqvRtm7iUx3Wq4Tb4tSFXGV0,234
|
|
12
13
|
opengeodeweb_back/routes/schemas/allowed_objects.json,sha256=oy_YYpFzgDICx-keWqNIUpQM3zzB4eE3H6mPNxH9rWc,361
|
|
@@ -16,14 +17,14 @@ opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json,sha256=lnPqe
|
|
|
16
17
|
opengeodeweb_back/routes/schemas/inspect_file.json,sha256=WoFF2hgZCUfqSDFJRq1sLpivjCQ6TCvSHPH8pKFY6KM,348
|
|
17
18
|
opengeodeweb_back/routes/schemas/missing_files.json,sha256=eOBAkiphA-2xG6e-OAy7wcJK2FeY0YFYXJlLdr8SNSc,349
|
|
18
19
|
opengeodeweb_back/routes/schemas/ping.json,sha256=MhI5jtrjMsAsfIKEzdY8p1HyV9xv4O3hYfESWw6tkyE,162
|
|
19
|
-
opengeodeweb_back/routes/schemas/polygon_attribute_names.json,sha256=
|
|
20
|
-
opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json,sha256=
|
|
20
|
+
opengeodeweb_back/routes/schemas/polygon_attribute_names.json,sha256=1BrpfjcbRL1ZOL4azHIHirqXIc8tpu4xGnMRFEMEshU,241
|
|
21
|
+
opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json,sha256=Tt6fWBGOWgxOVC-n76_JbOQcZ-Ss-foPghMrQOY-DIE,244
|
|
21
22
|
opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl3bXzlcA5blgflK0EYp2hBDf74qY,424
|
|
22
|
-
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=
|
|
23
|
+
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=2uQueIl1jOmxFG_gIi_vJETR4IurrwuSf8GAnzphk9g,237
|
|
23
24
|
opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
|
|
24
|
-
opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=
|
|
25
|
-
opengeodeweb_back-5.
|
|
26
|
-
opengeodeweb_back-5.
|
|
27
|
-
opengeodeweb_back-5.
|
|
28
|
-
opengeodeweb_back-5.
|
|
29
|
-
opengeodeweb_back-5.
|
|
25
|
+
opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=ECIflohiqPZNsflAdkfEzksL4we0JvZhIxUd84Ubctg,240
|
|
26
|
+
opengeodeweb_back-5.10.0.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
|
|
27
|
+
opengeodeweb_back-5.10.0.dist-info/METADATA,sha256=mP_Wll4jLDiW3TFxMjs4RBl_ArkFnYOYcM5_CcofQqs,2836
|
|
28
|
+
opengeodeweb_back-5.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
+
opengeodeweb_back-5.10.0.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
|
30
|
+
opengeodeweb_back-5.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|