OpenGeodeWeb-Back 5.10.0rc6__py3-none-any.whl → 5.10.0rc9__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.
- opengeodeweb_back/app_config.py +11 -2
- opengeodeweb_back/data.py +45 -0
- opengeodeweb_back/database.py +19 -0
- opengeodeweb_back/geode_functions.py +24 -10
- 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 +50 -24
- {opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/METADATA +5 -1
- {opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/RECORD +17 -15
- {opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/WHEEL +0 -0
- {opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/licenses/LICENSE +0 -0
- {opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/top_level.txt +0 -0
opengeodeweb_back/app_config.py
CHANGED
@@ -4,6 +4,7 @@ import time
|
|
4
4
|
|
5
5
|
# Third party imports
|
6
6
|
# Local application imports
|
7
|
+
from .database import DATABASE_FILENAME
|
7
8
|
|
8
9
|
|
9
10
|
class Config(object):
|
@@ -15,6 +16,7 @@ class Config(object):
|
|
15
16
|
REQUEST_COUNTER = 0
|
16
17
|
LAST_REQUEST_TIME = time.time()
|
17
18
|
LAST_PING_TIME = time.time()
|
19
|
+
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
18
20
|
|
19
21
|
|
20
22
|
class ProdConfig(Config):
|
@@ -22,7 +24,10 @@ class ProdConfig(Config):
|
|
22
24
|
ORIGINS = ""
|
23
25
|
MINUTES_BEFORE_TIMEOUT = "1"
|
24
26
|
SECONDS_BETWEEN_SHUTDOWNS = "10"
|
25
|
-
DATA_FOLDER_PATH = "/data
|
27
|
+
DATA_FOLDER_PATH = "/data"
|
28
|
+
SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.abspath(
|
29
|
+
os.path.join(DATA_FOLDER_PATH, DATABASE_FILENAME)
|
30
|
+
)}"
|
26
31
|
|
27
32
|
|
28
33
|
class DevConfig(Config):
|
@@ -30,4 +35,8 @@ class DevConfig(Config):
|
|
30
35
|
ORIGINS = "*"
|
31
36
|
MINUTES_BEFORE_TIMEOUT = "1"
|
32
37
|
SECONDS_BETWEEN_SHUTDOWNS = "10"
|
33
|
-
|
38
|
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
39
|
+
DATA_FOLDER_PATH = os.path.join(BASE_DIR, "data")
|
40
|
+
SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.join(
|
41
|
+
BASE_DIR, DATA_FOLDER_PATH, DATABASE_FILENAME
|
42
|
+
)}"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from sqlalchemy import String, JSON
|
2
|
+
from sqlalchemy.orm import Mapped, mapped_column
|
3
|
+
from .database import database, Base
|
4
|
+
import uuid
|
5
|
+
|
6
|
+
|
7
|
+
class Data(Base):
|
8
|
+
__tablename__ = "datas"
|
9
|
+
|
10
|
+
id: Mapped[str] = mapped_column(
|
11
|
+
String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
|
12
|
+
)
|
13
|
+
native_file_name: Mapped[str] = mapped_column(String, nullable=False)
|
14
|
+
viewable_file_name: Mapped[str] = mapped_column(String, nullable=False)
|
15
|
+
geode_object: Mapped[str] = mapped_column(String, nullable=False)
|
16
|
+
|
17
|
+
light_viewable: Mapped[str | None] = mapped_column(String, nullable=True)
|
18
|
+
input_file: Mapped[str | None] = mapped_column(String, nullable=True)
|
19
|
+
additional_files: Mapped[list[str] | None] = mapped_column(JSON, nullable=True)
|
20
|
+
|
21
|
+
@staticmethod
|
22
|
+
def create(
|
23
|
+
geode_object: str,
|
24
|
+
input_file: str | None = None,
|
25
|
+
additional_files: list[str] | None = None,
|
26
|
+
) -> "Data":
|
27
|
+
input_file = input_file if input_file is not None else ""
|
28
|
+
additional_files = additional_files if additional_files is not None else []
|
29
|
+
|
30
|
+
data_entry = Data(
|
31
|
+
geode_object=geode_object,
|
32
|
+
input_file=input_file,
|
33
|
+
additional_files=additional_files,
|
34
|
+
native_file_name="",
|
35
|
+
viewable_file_name="",
|
36
|
+
light_viewable=None,
|
37
|
+
)
|
38
|
+
|
39
|
+
database.session.add(data_entry)
|
40
|
+
database.session.flush()
|
41
|
+
return data_entry
|
42
|
+
|
43
|
+
@staticmethod
|
44
|
+
def get(data_id: str) -> "Data | None":
|
45
|
+
return database.session.get(Data, data_id)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from flask import Flask
|
2
|
+
from flask_sqlalchemy import SQLAlchemy
|
3
|
+
from sqlalchemy.orm import DeclarativeBase
|
4
|
+
|
5
|
+
DATABASE_FILENAME = "project.db"
|
6
|
+
|
7
|
+
|
8
|
+
class Base(DeclarativeBase):
|
9
|
+
pass
|
10
|
+
|
11
|
+
|
12
|
+
database = SQLAlchemy(model_class=Base)
|
13
|
+
|
14
|
+
|
15
|
+
def initialize_database(app: Flask) -> SQLAlchemy:
|
16
|
+
database.init_app(app)
|
17
|
+
with app.app_context():
|
18
|
+
database.create_all()
|
19
|
+
return database
|
@@ -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
|
@@ -2,7 +2,6 @@
|
|
2
2
|
import os
|
3
3
|
import threading
|
4
4
|
import time
|
5
|
-
import uuid
|
6
5
|
import zipfile
|
7
6
|
from collections.abc import Callable
|
8
7
|
from typing import Any
|
@@ -17,6 +16,8 @@ import werkzeug
|
|
17
16
|
|
18
17
|
# Local application imports
|
19
18
|
from . import geode_functions
|
19
|
+
from .data import Data
|
20
|
+
from .database import database
|
20
21
|
|
21
22
|
|
22
23
|
def increment_request_counter(current_app: flask.Flask) -> None:
|
@@ -152,17 +153,28 @@ def handle_exception(exception: HTTPException) -> flask.Response:
|
|
152
153
|
return response
|
153
154
|
|
154
155
|
|
155
|
-
def
|
156
|
+
def create_data_folder_from_id(data_id: str) -> str:
|
156
157
|
base_data_folder = flask.current_app.config["DATA_FOLDER_PATH"]
|
157
|
-
|
158
|
-
data_path = os.path.join(base_data_folder, generated_id)
|
158
|
+
data_path = os.path.join(base_data_folder, data_id)
|
159
159
|
os.makedirs(data_path, exist_ok=True)
|
160
|
-
return
|
160
|
+
return data_path
|
161
161
|
|
162
162
|
|
163
163
|
def save_all_viewables_and_return_info(
|
164
|
-
geode_object
|
165
|
-
|
164
|
+
geode_object: str,
|
165
|
+
data: Any,
|
166
|
+
input_file: str,
|
167
|
+
additional_files: list[str] | None = None,
|
168
|
+
) -> dict[str, Any]:
|
169
|
+
if additional_files is None:
|
170
|
+
additional_files = []
|
171
|
+
|
172
|
+
data_entry = Data.create(
|
173
|
+
geode_object=geode_object,
|
174
|
+
input_file=input_file,
|
175
|
+
additional_files=additional_files,
|
176
|
+
)
|
177
|
+
data_path = create_data_folder_from_id(data_entry.id)
|
166
178
|
saved_native_file_path = geode_functions.save(
|
167
179
|
geode_object,
|
168
180
|
data,
|
@@ -177,28 +189,40 @@ def save_all_viewables_and_return_info(
|
|
177
189
|
)
|
178
190
|
with open(saved_light_viewable_file_path, "rb") as f:
|
179
191
|
binary_light_viewable = f.read()
|
192
|
+
data_entry.native_file_name = os.path.basename(saved_native_file_path[0])
|
193
|
+
data_entry.viewable_file_name = os.path.basename(saved_viewable_file_path)
|
194
|
+
data_entry.light_viewable = os.path.basename(saved_light_viewable_file_path)
|
195
|
+
|
196
|
+
database.session.commit()
|
180
197
|
|
181
198
|
return {
|
182
|
-
"
|
183
|
-
"
|
184
|
-
"
|
185
|
-
"id": generated_id,
|
199
|
+
"native_file_name": data_entry.native_file_name,
|
200
|
+
"viewable_file_name": data_entry.viewable_file_name,
|
201
|
+
"id": data_entry.id,
|
186
202
|
"object_type": geode_functions.get_object_type(geode_object),
|
187
203
|
"binary_light_viewable": binary_light_viewable.decode("utf-8"),
|
188
|
-
"geode_object": geode_object,
|
189
|
-
"input_files":
|
204
|
+
"geode_object": data_entry.geode_object,
|
205
|
+
"input_files": data_entry.input_file,
|
206
|
+
"additional_files": data_entry.additional_files,
|
190
207
|
}
|
191
208
|
|
192
209
|
|
193
|
-
def generate_native_viewable_and_light_viewable_from_object(
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
)
|
210
|
+
def generate_native_viewable_and_light_viewable_from_object(
|
211
|
+
geode_object: str, data: Any
|
212
|
+
) -> dict[str, Any]:
|
213
|
+
return save_all_viewables_and_return_info(geode_object, data, input_file="")
|
198
214
|
|
199
215
|
|
200
|
-
def generate_native_viewable_and_light_viewable_from_file(
|
201
|
-
|
216
|
+
def generate_native_viewable_and_light_viewable_from_file(
|
217
|
+
geode_object: str, input_filename: str
|
218
|
+
) -> dict[str, Any]:
|
219
|
+
temp_data_entry = Data.create(
|
220
|
+
geode_object=geode_object,
|
221
|
+
input_file=input_filename,
|
222
|
+
additional_files=[],
|
223
|
+
)
|
224
|
+
|
225
|
+
data_path = create_data_folder_from_id(temp_data_entry.id)
|
202
226
|
|
203
227
|
full_input_filename = geode_functions.upload_file_path(input_filename)
|
204
228
|
copied_full_path = os.path.join(
|
@@ -206,7 +230,7 @@ def generate_native_viewable_and_light_viewable_from_file(geode_object, input_fi
|
|
206
230
|
)
|
207
231
|
shutil.copy2(full_input_filename, copied_full_path)
|
208
232
|
|
209
|
-
additional_files_copied = []
|
233
|
+
additional_files_copied: list[str] = []
|
210
234
|
additional = geode_functions.additional_files(geode_object, full_input_filename)
|
211
235
|
for additional_file in additional.mandatory_files + additional.optional_files:
|
212
236
|
if additional_file.is_missing:
|
@@ -221,12 +245,14 @@ def generate_native_viewable_and_light_viewable_from_file(geode_object, input_fi
|
|
221
245
|
shutil.copy2(source_path, dest_path)
|
222
246
|
additional_files_copied.append(additional_file.filename)
|
223
247
|
|
224
|
-
data = geode_functions.
|
248
|
+
data = geode_functions.load(geode_object, copied_full_path)
|
249
|
+
|
250
|
+
database.session.delete(temp_data_entry)
|
251
|
+
database.session.flush()
|
225
252
|
|
226
253
|
return save_all_viewables_and_return_info(
|
227
254
|
geode_object,
|
228
255
|
data,
|
229
|
-
|
230
|
-
data_path,
|
256
|
+
input_file=input_filename,
|
231
257
|
additional_files=additional_files_copied,
|
232
258
|
)
|
@@ -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
|
@@ -17,8 +17,10 @@ Requires-Dist: click==8.2.1
|
|
17
17
|
Requires-Dist: fastjsonschema==2.16.2
|
18
18
|
Requires-Dist: flask[async]==3.0.3
|
19
19
|
Requires-Dist: flask-cors==6.0.1
|
20
|
+
Requires-Dist: flask-sqlalchemy==3.1.1
|
20
21
|
Requires-Dist: geode-common==33.9.0
|
21
22
|
Requires-Dist: geode-viewables==3.2.0
|
23
|
+
Requires-Dist: greenlet==3.2.4
|
22
24
|
Requires-Dist: itsdangerous==2.2.0
|
23
25
|
Requires-Dist: jinja2==3.1.6
|
24
26
|
Requires-Dist: markupsafe==3.0.2
|
@@ -27,6 +29,8 @@ Requires-Dist: opengeode-geosciences==9.2.2
|
|
27
29
|
Requires-Dist: opengeode-geosciencesio==5.7.2
|
28
30
|
Requires-Dist: opengeode-inspector==6.7.0
|
29
31
|
Requires-Dist: opengeode-io==7.3.2
|
32
|
+
Requires-Dist: sqlalchemy==2.0.43
|
33
|
+
Requires-Dist: typing-extensions==4.15.0
|
30
34
|
Requires-Dist: werkzeug==3.0.3
|
31
35
|
Dynamic: license-file
|
32
36
|
|
@@ -1,12 +1,14 @@
|
|
1
1
|
opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
opengeodeweb_back/app_config.py,sha256=
|
3
|
-
opengeodeweb_back/
|
2
|
+
opengeodeweb_back/app_config.py,sha256=XFl5KqrOWifVxdudiLm-LXmczYDBCbZtNboSYnNbLf8,1142
|
3
|
+
opengeodeweb_back/data.py,sha256=wwLcWoYfPdE6jILnmkDQfkRJkMrHH9CB6VzPblrUgnk,1562
|
4
|
+
opengeodeweb_back/database.py,sha256=lXbbJRZCdqLcQU-Xqi1jPmo8cIitbHOqUJW5uLBF85w,381
|
5
|
+
opengeodeweb_back/geode_functions.py,sha256=uEWJSjlBpaJC4Qd5JPpiWiqLlCitb7peSMWzYRIVho8,10648
|
4
6
|
opengeodeweb_back/geode_objects.py,sha256=uXCKX8AOdXkItqmYItLnFfHcIBiMFaeN_WmGs4j64Ro,27782
|
5
7
|
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=
|
8
|
+
opengeodeweb_back/utils_functions.py,sha256=PclYunLMDVQn5s3V54v5jQ2zjtTFtH0C1m4niPOc2-0,8440
|
9
|
+
opengeodeweb_back/routes/blueprint_routes.py,sha256=h_yfFC3ljH0KqFr5Ab_-IQYNB7VVRENwAMQk4NDsh18,11042
|
10
|
+
opengeodeweb_back/routes/models/blueprint_models.py,sha256=Jo9pUDeu1nO3_IbBiuHGk57cc4_fhwxjM0EKNyv1FT0,1874
|
11
|
+
opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=JmQUvpy7HpGS6FlThZLx1YjHqiInRTqUZ_Ft5MfOzEE,239
|
10
12
|
opengeodeweb_back/routes/models/schemas/vtm_component_indices.json,sha256=0XILVxhAxi0RhQFDZZoUeGcAnBMroWz3kNJS7-6_dKQ,239
|
11
13
|
opengeodeweb_back/routes/schemas/allowed_files.json,sha256=pRsGf39LiJpl3zEGLg4IqvRtm7iUx3Wq4Tb4tSFXGV0,234
|
12
14
|
opengeodeweb_back/routes/schemas/allowed_objects.json,sha256=oy_YYpFzgDICx-keWqNIUpQM3zzB4eE3H6mPNxH9rWc,361
|
@@ -16,14 +18,14 @@ opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json,sha256=lnPqe
|
|
16
18
|
opengeodeweb_back/routes/schemas/inspect_file.json,sha256=WoFF2hgZCUfqSDFJRq1sLpivjCQ6TCvSHPH8pKFY6KM,348
|
17
19
|
opengeodeweb_back/routes/schemas/missing_files.json,sha256=eOBAkiphA-2xG6e-OAy7wcJK2FeY0YFYXJlLdr8SNSc,349
|
18
20
|
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=
|
21
|
+
opengeodeweb_back/routes/schemas/polygon_attribute_names.json,sha256=1BrpfjcbRL1ZOL4azHIHirqXIc8tpu4xGnMRFEMEshU,241
|
22
|
+
opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json,sha256=Tt6fWBGOWgxOVC-n76_JbOQcZ-Ss-foPghMrQOY-DIE,244
|
21
23
|
opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl3bXzlcA5blgflK0EYp2hBDf74qY,424
|
22
|
-
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=
|
24
|
+
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=2uQueIl1jOmxFG_gIi_vJETR4IurrwuSf8GAnzphk9g,237
|
23
25
|
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.10.
|
26
|
-
opengeodeweb_back-5.10.
|
27
|
-
opengeodeweb_back-5.10.
|
28
|
-
opengeodeweb_back-5.10.
|
29
|
-
opengeodeweb_back-5.10.
|
26
|
+
opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=ECIflohiqPZNsflAdkfEzksL4we0JvZhIxUd84Ubctg,240
|
27
|
+
opengeodeweb_back-5.10.0rc9.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
|
28
|
+
opengeodeweb_back-5.10.0rc9.dist-info/METADATA,sha256=ysyzH6RWFijRX2M1Q35hRv3CNs--V02IuGbqOLeQRr0,2821
|
29
|
+
opengeodeweb_back-5.10.0rc9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
30
|
+
opengeodeweb_back-5.10.0rc9.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
31
|
+
opengeodeweb_back-5.10.0rc9.dist-info/RECORD,,
|
File without changes
|
{opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{opengeodeweb_back-5.10.0rc6.dist-info → opengeodeweb_back-5.10.0rc9.dist-info}/top_level.txt
RENAMED
File without changes
|