Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
opengeode-core==17.4.5
opengeode-io==7.7.2
opengeode-geosciences==9.6.1
opengeode-geosciencesio==5.9.0
opengeode-inspector==6.11.8
opengeode-inspector-geosciences==1.1.1
geode-common==33.25.4
geode-viewables==3.4.1
opengeode-core==18.0.0
opengeode-io==7.8.1
opengeode-geosciences==9.7.1
opengeode-geosciencesio==5.10.0
opengeode-inspector==6.12.0
opengeode-inspector-geosciences==1.2.0
geode-common==33.26.0
geode-viewables==3.5.0
flask[async]==3.1.2
flask-cors==6.0.2
werkzeug==3.1.8
17 changes: 8 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ flask[async]>=3
# flask-cors
flask-cors==6.0.2
# via -r requirements.in
geode-common==33.25.4
geode-common==33.26.0
# via
# -r requirements.in
# geode-viewables
geode-viewables==3.4.1
geode-viewables==3.5.0
# via -r requirements.in
itsdangerous>=2
# via flask
Expand All @@ -31,7 +31,7 @@ markupsafe>=3
# flask
# jinja2
# werkzeug
opengeode-core==17.4.5
opengeode-core==18.0.0
# via
# -r requirements.in
# geode-common
Expand All @@ -41,21 +41,21 @@ opengeode-core==17.4.5
# opengeode-inspector
# opengeode-inspector-geosciences
# opengeode-io
opengeode-geosciences==9.6.1
opengeode-geosciences==9.7.1
# via
# -r requirements.in
# geode-viewables
# opengeode-geosciencesio
# opengeode-inspector-geosciences
opengeode-geosciencesio==5.9.0
opengeode-geosciencesio==5.10.0
# via -r requirements.in
opengeode-inspector==6.11.8
opengeode-inspector==6.12.0
# via
# -r requirements.in
# opengeode-inspector-geosciences
opengeode-inspector-geosciences==1.1.1
opengeode-inspector-geosciences==1.2.0
# via -r requirements.in
opengeode-io==7.7.2
opengeode-io==7.8.1
# via
# -r requirements.in
# geode-viewables
Expand All @@ -66,4 +66,3 @@ werkzeug==3.1.8
# flask
# flask-cors

opengeodeweb-microservice==1.*,>=1.2.1
68 changes: 42 additions & 26 deletions src/opengeodeweb_back/routes/blueprint_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,21 @@ def extract_valid_attribute_values(
attribute_name: str,
item_index: int,
) -> list[float]:
component_attribute = attribute_manager.find_generic_attribute(attribute_name)
attribute_ids_matching_name = attribute_manager.attribute_ids_matching_name(
attribute_name
)
if not isinstance(attribute_ids_matching_name, list):
return []
component_attribute = attribute_manager.find_generic_attribute(
attribute_ids_matching_name[0]
)
if component_attribute is None:
return []
if not component_attribute.is_genericable():
return []
valid_values: list[float] = []
for index in range(attribute_manager.nb_elements()):
value = component_attribute.generic_item_value(index, item_index)
for element_index in range(attribute_manager.nb_elements()):
value = component_attribute.generic_item_value(element_index, item_index)
if value is not None and not math.isnan(value):
valid_values.append(value)
return valid_values
Expand All @@ -274,29 +283,37 @@ def attributes_metadata(
attribute_managers = manager if isinstance(manager, list) else [manager]
attributes: list[dict[str, str | int | float | list[float]]] = []
first_manager = attribute_managers[0]
for name in first_manager.attribute_names():
attribute = first_manager.find_generic_attribute(name)
nb_items = 1
min_values, max_values = [-1.0], [-1.0]
if attribute.is_genericable():
nb_items = attribute.nb_items()
min_values, max_values = [], []
for item_index in range(nb_items):
valid_values: list[float] = []
for attribute_manager in attribute_managers:
valid_values.extend(
extract_valid_attribute_values(
attribute_manager, name, item_index
)
for id in first_manager.attribute_ids():
attribute = first_manager.find_generic_attribute(id)
if attribute is None:
continue
attribute_name = attribute.name()
if attribute_name is None:
continue
if not attribute.is_genericable():
continue
nb_items = attribute.nb_items()
min_values, max_values = [], []
for item_index in range(nb_items):
valid_values: list[float] = []
for attribute_manager in attribute_managers:
valid_values.extend(
extract_valid_attribute_values(
attribute_manager, attribute_name, item_index
)
min_values.append(min(valid_values) if valid_values else -1.0)
max_values.append(max(valid_values) if valid_values else -1.0)
)
if valid_values:
min_values.append(min(valid_values))
max_values.append(max(valid_values))
if not min_values or not max_values:
continue
attributes.append(
{
"attribute_name": name,
"attribute_name": attribute_name,
"attribute_id": id.string(),
"nb_items": nb_items,
"min_value": min_values[0],
"max_value": max_values[0],
"min_value": min(min_values),
"max_value": max(max_values),
"min_values": min_values,
"max_values": max_values,
}
Expand Down Expand Up @@ -497,10 +514,9 @@ def model_component_polyhedron_attribute_names() -> flask.Response:
ComponentBlock,
)
]
return flask.make_response(
{"attributes": attributes_metadata(managers)},
200,
)
attributes = attributes_metadata(managers)
print(f"{attributes=}", flush=True)
return flask.make_response({"attributes": attributes}, 200)


@routes.route(
Expand Down
6 changes: 3 additions & 3 deletions src/opengeodeweb_back/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ def model_components(
component_name = geode_id
viewer_id = uuid_to_flat_index[geode_id]
boundaries = model.boundaries(id)
boundaries_uuid = [boundary.id().string() for boundary in boundaries]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sur de ça?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benjamin disait que oui, plus mypy me dit ça : "uuid" not callableMypy[operator]

boundaries_uuid = [boundary.id.string() for boundary in boundaries]
internals = model.internals(id)
internals_uuid = [internal.id().string() for internal in internals]
internals_uuid = [internal.id.string() for internal in internals]
mesh_component_object = {
"viewer_id": viewer_id,
"geode_id": geode_id,
Expand All @@ -251,7 +251,7 @@ def model_components(
if not component_name:
component_name = geode_id
items = model.items(id)
items_uuid = [item.id().string() for item in items]
items_uuid = [item.id.string() for item in items]
collection_component_object = {
"geode_id": geode_id,
"name": component_name,
Expand Down
Loading
Loading