3dgeo-heidelberg / pytreedb

Python package providing a file and object-based database to store tree objects.
Other
32 stars 4 forks source link

Frontend queries - Idea for improvement (`$elemMatch`) #52

Closed han16nah closed 2 years ago

han16nah commented 2 years ago

In the Frontend, we combine multiple conditions with OR / AND. These includes queries on data fields, which are present multiple times for one tree (e.g. canopy condition or tree metrics like Height). There are two options:

This can be done using the $elemMatch operator (https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/).

The $elemMatch operator matches documents that contain an array field with at least one element that matches all the specified query criteria.

You can check 07_query_with_multiple_conditions.ipynb for examples of queries with $elemMatch

I am not sure yet how this could look like in the user interface. Maybe there could be a checkbox next to the filter for which elemMatch should apply?

bhoefle-3dgeo commented 2 years ago

@annachiu7, I think this is an important aspect of the query tool in the web frontend. @han16nah elemMatch is might be not a good word for non-Mongo-users. We could add a check box to force that all search criteria are fullfilled for a data source and hint with a "?" link to the notebook and the elemMatch issue.

annachiu7 commented 2 years ago

This is updated in the latest commit of frontend_query_enhance branch. Needs testing

han16nah commented 2 years ago

@annachiu7 Is it only possible atm to connect ALL filters with elemMatch (with the checkbox "All search criteria should be fulfilled by a single data source")? Would it also be feasible to connect it somehow to the "Source" and "Mode" filters (as these are the filters which we would like to conntect elemMatch to").. Maybe with checkboxes saying "indented search criteria below should be fulfilled by a single data source/acquisition mode" - and whenever I add another mode/source filter, another checkbox appears?

Then I could e.g. specify that I need a TLS point cloud in leaf-on condition with quality 3 or better or alternatively a ULS point cloud in leaf-off condition with quality 2 or better..

han16nah commented 2 years ago

@annachiu7 Can the frontend_query_enhance branch we merged?

annachiu7 commented 2 years ago

I can do it manually if you want to (too many merge conflicts)

annachiu7 commented 2 years ago

Found a bug concerning Quality filter behavior. Trying to fix