OpenGeodeWeb-Back 5.10.0rc8__tar.gz → 5.10.0rc9__tar.gz
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.
- {opengeodeweb_back-5.10.0rc8/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.10.0rc9}/PKG-INFO +1 -1
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/pyproject.toml +1 -1
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO +1 -1
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/data.py +4 -3
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/geode_functions.py +24 -10
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/blueprint_routes.py +24 -46
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/models/blueprint_models.py +2 -8
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/models/schemas/mesh_components.json +1 -11
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json +0 -10
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json +0 -10
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/texture_coordinates.json +1 -11
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json +0 -10
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/utils_functions.py +1 -4
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/tests/test_models_routes.py +9 -3
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/tests/test_routes.py +58 -113
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/tests/test_utils_functions.py +4 -8
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/LICENSE +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/README.md +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/requirements.txt +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/setup.cfg +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/OpenGeodeWeb_Back.egg-info/requires.txt +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/OpenGeodeWeb_Back.egg-info/top_level.txt +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/__init__.py +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/app_config.py +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/database.py +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/geode_objects.py +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/models/schemas/vtm_component_indices.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/allowed_files.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/allowed_objects.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/create_point.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/inspect_file.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/missing_files.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/ping.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/save_viewable_file.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/routes/schemas/upload_file.json +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/test_utils.py +0 -0
- {opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/tests/test_geode_functions.py +0 -0
{opengeodeweb_back-5.10.0rc8/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.10.0rc9}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.10.
|
3
|
+
Version: 5.10.0rc9
|
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
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.10.
|
3
|
+
Version: 5.10.0rc9
|
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
|
@@ -10,7 +10,6 @@ class Data(Base):
|
|
10
10
|
id: Mapped[str] = mapped_column(
|
11
11
|
String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
|
12
12
|
)
|
13
|
-
name: Mapped[str] = mapped_column(String, nullable=False)
|
14
13
|
native_file_name: Mapped[str] = mapped_column(String, nullable=False)
|
15
14
|
viewable_file_name: Mapped[str] = mapped_column(String, nullable=False)
|
16
15
|
geode_object: Mapped[str] = mapped_column(String, nullable=False)
|
@@ -21,7 +20,6 @@ class Data(Base):
|
|
21
20
|
|
22
21
|
@staticmethod
|
23
22
|
def create(
|
24
|
-
name: str,
|
25
23
|
geode_object: str,
|
26
24
|
input_file: str | None = None,
|
27
25
|
additional_files: list[str] | None = None,
|
@@ -30,7 +28,6 @@ class Data(Base):
|
|
30
28
|
additional_files = additional_files if additional_files is not None else []
|
31
29
|
|
32
30
|
data_entry = Data(
|
33
|
-
name=name,
|
34
31
|
geode_object=geode_object,
|
35
32
|
input_file=input_file,
|
36
33
|
additional_files=additional_files,
|
@@ -42,3 +39,7 @@ class Data(Base):
|
|
42
39
|
database.session.add(data_entry)
|
43
40
|
database.session.flush()
|
44
41
|
return data_entry
|
42
|
+
|
43
|
+
@staticmethod
|
44
|
+
def get(data_id: str) -> "Data | None":
|
45
|
+
return database.session.get(Data, data_id)
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/geode_functions.py
RENAMED
@@ -6,10 +6,13 @@ import opengeode_geosciences as og_gs # type: ignore
|
|
6
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 .data import Data
|
15
|
+
from .database import database
|
13
16
|
|
14
17
|
|
15
18
|
def geode_object_value(geode_object: str):
|
@@ -45,21 +48,32 @@ def load(geode_object: str, file_absolute_path: str):
|
|
45
48
|
return geode_object_value(geode_object)["load"](file_absolute_path)
|
46
49
|
|
47
50
|
|
48
|
-
def data_file_path(data_id: str, filename: str) -> str:
|
51
|
+
def data_file_path(data_id: str, filename: str = "") -> str:
|
49
52
|
data_folder_path = flask.current_app.config["DATA_FOLDER_PATH"]
|
50
|
-
|
51
|
-
data_folder_path,
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
+
|
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")
|
62
|
+
|
63
|
+
file_absolute_path = data_file_path(data_id, data_entry.native_file_name)
|
64
|
+
return load(data_entry.geode_object, file_absolute_path)
|
65
|
+
|
55
66
|
|
67
|
+
def get_data_info(data_id: str) -> Data:
|
68
|
+
from .data import Data
|
56
69
|
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
60
74
|
|
61
75
|
|
62
|
-
def upload_file_path(filename):
|
76
|
+
def upload_file_path(filename: str) -> str:
|
63
77
|
upload_folder = flask.current_app.config["UPLOAD_FOLDER"]
|
64
78
|
secure_filename = werkzeug.utils.secure_filename(filename)
|
65
79
|
return os.path.abspath(os.path.join(upload_folder, secure_filename))
|
@@ -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
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/utils_functions.py
RENAMED
@@ -170,7 +170,6 @@ def save_all_viewables_and_return_info(
|
|
170
170
|
additional_files = []
|
171
171
|
|
172
172
|
data_entry = Data.create(
|
173
|
-
name=data.name(),
|
174
173
|
geode_object=geode_object,
|
175
174
|
input_file=input_file,
|
176
175
|
additional_files=additional_files,
|
@@ -197,7 +196,6 @@ def save_all_viewables_and_return_info(
|
|
197
196
|
database.session.commit()
|
198
197
|
|
199
198
|
return {
|
200
|
-
"name": data_entry.name,
|
201
199
|
"native_file_name": data_entry.native_file_name,
|
202
200
|
"viewable_file_name": data_entry.viewable_file_name,
|
203
201
|
"id": data_entry.id,
|
@@ -219,7 +217,6 @@ def generate_native_viewable_and_light_viewable_from_file(
|
|
219
217
|
geode_object: str, input_filename: str
|
220
218
|
) -> dict[str, Any]:
|
221
219
|
temp_data_entry = Data.create(
|
222
|
-
name="temp",
|
223
220
|
geode_object=geode_object,
|
224
221
|
input_file=input_filename,
|
225
222
|
additional_files=[],
|
@@ -248,7 +245,7 @@ def generate_native_viewable_and_light_viewable_from_file(
|
|
248
245
|
shutil.copy2(source_path, dest_path)
|
249
246
|
additional_files_copied.append(additional_file.filename)
|
250
247
|
|
251
|
-
data = geode_functions.
|
248
|
+
data = geode_functions.load(geode_object, copied_full_path)
|
252
249
|
|
253
250
|
database.session.delete(temp_data_entry)
|
254
251
|
database.session.flush()
|
@@ -3,6 +3,8 @@ import shutil
|
|
3
3
|
import flask
|
4
4
|
|
5
5
|
from src.opengeodeweb_back import geode_functions
|
6
|
+
from src.opengeodeweb_back.data import Data
|
7
|
+
from src.opengeodeweb_back.database import database
|
6
8
|
|
7
9
|
|
8
10
|
def test_model_mesh_components(client, test_id):
|
@@ -28,14 +30,18 @@ def test_model_mesh_components(client, test_id):
|
|
28
30
|
|
29
31
|
def test_extract_brep_uuids(client, test_id):
|
30
32
|
route = "/models/mesh_components"
|
31
|
-
|
32
33
|
brep_filename = "cube.og_brep"
|
33
|
-
json_data = {"id": test_id, "geode_object": "BRep", "filename": brep_filename}
|
34
34
|
|
35
35
|
with client.application.app_context():
|
36
|
-
|
36
|
+
data_entry = Data.create(geode_object="BRep", input_file=brep_filename)
|
37
|
+
data_entry.native_file_name = brep_filename
|
38
|
+
database.session.commit()
|
39
|
+
|
40
|
+
data_path = geode_functions.data_file_path(data_entry.id, brep_filename)
|
37
41
|
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
38
42
|
shutil.copy(f"./tests/data/{brep_filename}", data_path)
|
43
|
+
|
44
|
+
json_data = {"id": data_entry.id}
|
39
45
|
response = client.post(route, json=json_data)
|
40
46
|
|
41
47
|
assert response.status_code == 200
|
@@ -6,7 +6,9 @@ import shutil
|
|
6
6
|
from werkzeug.datastructures import FileStorage
|
7
7
|
|
8
8
|
# Local application imports
|
9
|
-
from src.opengeodeweb_back import geode_functions,
|
9
|
+
from src.opengeodeweb_back import geode_functions, test_utils
|
10
|
+
from src.opengeodeweb_back.data import Data
|
11
|
+
from src.opengeodeweb_back.database import database
|
10
12
|
|
11
13
|
|
12
14
|
def test_allowed_files(client):
|
@@ -151,13 +153,11 @@ def test_save_viewable_file(client):
|
|
151
153
|
# Normal test with filename 'corbi.og_brep'
|
152
154
|
response = client.post(route, json=get_full_data())
|
153
155
|
assert response.status_code == 200
|
154
|
-
name = response.json["name"]
|
155
|
-
assert type(name) is str
|
156
156
|
native_file_name = response.json["native_file_name"]
|
157
157
|
assert type(native_file_name) is str
|
158
158
|
viewable_file_name = response.json["viewable_file_name"]
|
159
159
|
assert type(viewable_file_name) is str
|
160
|
-
id = response.json
|
160
|
+
id = response.json.get("id")
|
161
161
|
assert type(id) is str
|
162
162
|
object_type = response.json["object_type"]
|
163
163
|
assert type(object_type) is str
|
@@ -171,17 +171,18 @@ def test_save_viewable_file(client):
|
|
171
171
|
|
172
172
|
def test_texture_coordinates(client, test_id):
|
173
173
|
with client.application.app_context():
|
174
|
-
|
174
|
+
data = Data.create(geode_object="PolygonalSurface3D", input_file="hat.vtp")
|
175
|
+
data.native_file_name = "hat.vtp"
|
176
|
+
database.session.commit()
|
177
|
+
|
178
|
+
data_path = geode_functions.data_file_path(data.id, "hat.vtp")
|
179
|
+
print(data_path)
|
175
180
|
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
176
181
|
shutil.copy("./tests/data/hat.vtp", data_path)
|
177
182
|
|
178
183
|
response = client.post(
|
179
184
|
"/texture_coordinates",
|
180
|
-
json={
|
181
|
-
"input_geode_object": "PolygonalSurface3D",
|
182
|
-
"id": test_id,
|
183
|
-
"filename": "hat.vtp",
|
184
|
-
},
|
185
|
+
json={"id": data.id},
|
185
186
|
)
|
186
187
|
assert response.status_code == 200
|
187
188
|
texture_coordinates = response.json["texture_coordinates"]
|
@@ -192,119 +193,63 @@ def test_texture_coordinates(client, test_id):
|
|
192
193
|
|
193
194
|
def test_vertex_attribute_names(client, test_id):
|
194
195
|
route = f"/vertex_attribute_names"
|
195
|
-
for geode_object, value in geode_objects.geode_objects_dict().items():
|
196
|
-
if value["object_type"] == "mesh":
|
197
|
-
input_extensions = geode_functions.geode_object_input_extensions(
|
198
|
-
geode_object
|
199
|
-
)
|
200
|
-
if "elements" in value:
|
201
|
-
elements = geode_functions.get_elements(geode_object)
|
202
|
-
if "points" in elements:
|
203
|
-
for input_extension in input_extensions:
|
204
|
-
if (
|
205
|
-
geode_functions.is_loadable(
|
206
|
-
geode_object,
|
207
|
-
os.path.join("./data", f"test.{input_extension}"),
|
208
|
-
)
|
209
|
-
> 0.0
|
210
|
-
):
|
211
|
-
|
212
|
-
def get_full_data():
|
213
|
-
return {
|
214
|
-
"input_geode_object": geode_object,
|
215
|
-
"id": test_id,
|
216
|
-
"filename": f"test.{input_extension}",
|
217
|
-
}
|
218
|
-
|
219
|
-
response = client.post(route, json=get_full_data())
|
220
|
-
assert response.status_code == 200
|
221
|
-
vertex_attribute_names = response.json[
|
222
|
-
"vertex_attribute_names"
|
223
|
-
]
|
224
|
-
assert type(vertex_attribute_names) is list
|
225
|
-
for vertex_attribute_name in vertex_attribute_names:
|
226
|
-
assert type(vertex_attribute_name) is str
|
227
196
|
|
228
|
-
|
229
|
-
|
197
|
+
with client.application.app_context():
|
198
|
+
data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
|
199
|
+
data.native_file_name = "test.vtp"
|
200
|
+
database.session.commit()
|
201
|
+
|
202
|
+
data_path = geode_functions.data_file_path(data.id, "test.vtp")
|
203
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
204
|
+
if os.path.exists("./tests/data/hat.vtp"):
|
205
|
+
shutil.copy("./tests/data/hat.vtp", data_path)
|
206
|
+
|
207
|
+
response = client.post(route, json={"id": data.id})
|
208
|
+
assert response.status_code == 200
|
209
|
+
vertex_attribute_names = response.json["vertex_attribute_names"]
|
210
|
+
assert type(vertex_attribute_names) is list
|
211
|
+
for vertex_attribute_name in vertex_attribute_names:
|
212
|
+
assert type(vertex_attribute_name) is str
|
230
213
|
|
231
214
|
|
232
215
|
def test_polygon_attribute_names(client, test_id):
|
233
216
|
route = f"/polygon_attribute_names"
|
234
|
-
for geode_object, value in geode_objects.geode_objects_dict().items():
|
235
|
-
if value["object_type"] == "mesh":
|
236
|
-
input_extensions = geode_functions.geode_object_input_extensions(
|
237
|
-
geode_object
|
238
|
-
)
|
239
|
-
if "elements" in value:
|
240
|
-
elements = geode_functions.get_elements(geode_object)
|
241
|
-
if "polygons" in elements:
|
242
|
-
for input_extension in input_extensions:
|
243
|
-
if (
|
244
|
-
geode_functions.is_loadable(
|
245
|
-
geode_object,
|
246
|
-
os.path.join("./data", f"test.{input_extension}"),
|
247
|
-
)
|
248
|
-
> 0.0
|
249
|
-
):
|
250
|
-
|
251
|
-
def get_full_data():
|
252
|
-
return {
|
253
|
-
"input_geode_object": geode_object,
|
254
|
-
"id": test_id,
|
255
|
-
"filename": f"test.{input_extension}",
|
256
|
-
}
|
257
|
-
|
258
|
-
response = client.post(route, json=get_full_data())
|
259
|
-
assert response.status_code == 200
|
260
|
-
polygon_attribute_names = response.json[
|
261
|
-
"polygon_attribute_names"
|
262
|
-
]
|
263
|
-
assert type(polygon_attribute_names) is list
|
264
|
-
for polygon_attribute_name in polygon_attribute_names:
|
265
|
-
assert type(polygon_attribute_name) is str
|
266
217
|
|
267
|
-
|
268
|
-
|
218
|
+
with client.application.app_context():
|
219
|
+
data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
|
220
|
+
data.native_file_name = "test.vtp"
|
221
|
+
database.session.commit()
|
222
|
+
|
223
|
+
data_path = geode_functions.data_file_path(data.id, "test.vtp")
|
224
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
225
|
+
shutil.copy("./tests/data/test.vtp", data_path)
|
226
|
+
|
227
|
+
response = client.post(route, json={"id": data.id})
|
228
|
+
assert response.status_code == 200
|
229
|
+
polygon_attribute_names = response.json["polygon_attribute_names"]
|
230
|
+
assert type(polygon_attribute_names) is list
|
231
|
+
for polygon_attribute_name in polygon_attribute_names:
|
232
|
+
assert type(polygon_attribute_name) is str
|
269
233
|
|
270
234
|
|
271
235
|
def test_polyhedron_attribute_names(client, test_id):
|
272
236
|
route = f"/polyhedron_attribute_names"
|
273
|
-
for geode_object, value in geode_objects.geode_objects_dict().items():
|
274
|
-
if value["object_type"] == "mesh":
|
275
|
-
input_extensions = geode_functions.geode_object_input_extensions(
|
276
|
-
geode_object
|
277
|
-
)
|
278
|
-
if "elements" in value:
|
279
|
-
elements = geode_functions.get_elements(geode_object)
|
280
|
-
if "polyhedrons" in elements:
|
281
|
-
for input_extension in input_extensions:
|
282
|
-
if (
|
283
|
-
geode_functions.is_loadable(
|
284
|
-
geode_object,
|
285
|
-
os.path.join("./data", f"test.{input_extension}"),
|
286
|
-
)
|
287
|
-
> 0.0
|
288
|
-
):
|
289
|
-
|
290
|
-
def get_full_data():
|
291
|
-
return {
|
292
|
-
"input_geode_object": geode_object,
|
293
|
-
"id": test_id,
|
294
|
-
"filename": f"test.{input_extension}",
|
295
|
-
}
|
296
|
-
|
297
|
-
response = client.post(route, json=get_full_data())
|
298
|
-
assert response.status_code == 200
|
299
|
-
polyhedron_attribute_names = response.json[
|
300
|
-
"polyhedron_attribute_names"
|
301
|
-
]
|
302
|
-
assert type(polyhedron_attribute_names) is list
|
303
|
-
for polyhedron_attribute_name in polyhedron_attribute_names:
|
304
|
-
assert type(polyhedron_attribute_name) is str
|
305
237
|
|
306
|
-
|
307
|
-
|
238
|
+
with client.application.app_context():
|
239
|
+
data = Data.create(geode_object="PolyhedralSolid3D", input_file="test.vtu")
|
240
|
+
data.native_file_name = "test.vtu"
|
241
|
+
database.session.commit()
|
242
|
+
|
243
|
+
data_path = geode_functions.data_file_path(data.id, "test.vtu")
|
244
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
245
|
+
shutil.copy("./tests/data/test.vtu", data_path)
|
246
|
+
|
247
|
+
response = client.post(route, json={"id": data.id})
|
248
|
+
assert response.status_code == 200
|
249
|
+
polyhedron_attribute_names = response.json["polyhedron_attribute_names"]
|
250
|
+
assert type(polyhedron_attribute_names) is list
|
251
|
+
for polyhedron_attribute_name in polyhedron_attribute_names:
|
252
|
+
assert type(polyhedron_attribute_name) is str
|
308
253
|
|
309
254
|
|
310
255
|
def test_create_point(client):
|
@@ -316,7 +261,7 @@ def test_create_point(client):
|
|
316
261
|
assert response.status_code == 200
|
317
262
|
viewable_file_name = response.json["viewable_file_name"]
|
318
263
|
assert type(viewable_file_name) is str
|
319
|
-
id = response.json
|
264
|
+
id = response.json.get("id")
|
320
265
|
assert type(id) is str
|
321
266
|
|
322
267
|
# Test all params
|
@@ -108,7 +108,6 @@ def test_save_all_viewables_and_return_info(client):
|
|
108
108
|
)
|
109
109
|
|
110
110
|
assert isinstance(result, dict)
|
111
|
-
assert result["name"] == data.name()
|
112
111
|
assert result["native_file_name"].startswith("native.")
|
113
112
|
assert result["viewable_file_name"].endswith(".vtm")
|
114
113
|
assert isinstance(result["id"], str)
|
@@ -119,9 +118,8 @@ def test_save_all_viewables_and_return_info(client):
|
|
119
118
|
assert result["geode_object"] == geode_object
|
120
119
|
assert result["input_files"] == input_file
|
121
120
|
|
122
|
-
db_entry =
|
121
|
+
db_entry = Data.get(result["id"])
|
123
122
|
assert db_entry is not None
|
124
|
-
assert db_entry.name == data.name()
|
125
123
|
assert db_entry.native_file_name == result["native_file_name"]
|
126
124
|
assert db_entry.viewable_file_name == result["viewable_file_name"]
|
127
125
|
assert db_entry.geode_object == geode_object
|
@@ -132,7 +130,7 @@ def test_save_all_viewables_and_return_info(client):
|
|
132
130
|
assert os.path.exists(expected_data_path)
|
133
131
|
|
134
132
|
|
135
|
-
def
|
133
|
+
def test_save_all_viewables_commits_to_db(client):
|
136
134
|
app = client.application
|
137
135
|
with app.app_context():
|
138
136
|
geode_object = "BRep"
|
@@ -142,11 +140,11 @@ def test_save_all_viewables_commits_to_db_properly(client):
|
|
142
140
|
geode_object, data, input_file
|
143
141
|
)
|
144
142
|
data_id = result["id"]
|
145
|
-
db_entry_before =
|
143
|
+
db_entry_before = Data.get(data_id)
|
146
144
|
assert db_entry_before is not None
|
147
145
|
assert db_entry_before.native_file_name == result["native_file_name"]
|
148
146
|
database.session.rollback()
|
149
|
-
db_entry_after =
|
147
|
+
db_entry_after = Data.get(data_id)
|
150
148
|
assert (
|
151
149
|
db_entry_after is not None
|
152
150
|
), "database.session.commit() was not called - entry missing after rollback"
|
@@ -166,7 +164,6 @@ def test_generate_native_viewable_and_light_viewable_from_object(client):
|
|
166
164
|
)
|
167
165
|
|
168
166
|
assert isinstance(result, dict)
|
169
|
-
assert isinstance(result["name"], str)
|
170
167
|
assert isinstance(result["native_file_name"], str)
|
171
168
|
assert result["native_file_name"].startswith("native.")
|
172
169
|
assert isinstance(result["viewable_file_name"], str)
|
@@ -189,7 +186,6 @@ def test_generate_native_viewable_and_light_viewable_from_file(client):
|
|
189
186
|
)
|
190
187
|
|
191
188
|
assert isinstance(result, dict)
|
192
|
-
assert isinstance(result["name"], str)
|
193
189
|
assert isinstance(result["native_file_name"], str)
|
194
190
|
assert result["native_file_name"].startswith("native.")
|
195
191
|
assert isinstance(result["viewable_file_name"], str)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/__init__.py
RENAMED
File without changes
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/app_config.py
RENAMED
File without changes
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/database.py
RENAMED
File without changes
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/geode_objects.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opengeodeweb_back-5.10.0rc8 → opengeodeweb_back-5.10.0rc9}/src/opengeodeweb_back/test_utils.py
RENAMED
File without changes
|
File without changes
|