Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added pattern for list_collections #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clausmichele
Copy link
Member

@soxofaan I was considering that it could be useful to have the ability to filter the collections directly by providing a keyword/pattern when calling list_collections(). What do you think?

@soxofaan
Copy link
Member

I'm a bit hesitant to this, as a user might want more flexibility than what the current PR allows: e.g. filter strictly on prefix/suffix, exclude instead of include, use a regex instead of single string, check multiple patterns at same time, ...
so this might grow in an overkill solution at this place.

What might make more sense is to make list_collections return some kind of new CollectionList object that provides a .filter method that allows .filter(include="sentinel2"), .filter(include=["sentinel2", "s2"]), .filter(exclude="experimental", case_sensitive=False), ...

Also, a user might want to filter on other fields than just id, so that is also something to consider here

@clausmichele
Copy link
Member Author

Indeed, this PR was just an idea that we can discuss about and that could evolve in different ways. I do consider this metadata filtering as something to tackle as possible new developments.

@soxofaan
Copy link
Member

when generalized in some way, this feature could also be useful in the context of:

  • list_services
  • list_processes
  • list_jobs
  • list_user_defined_processes
  • batch job logs and secondary service logs

@m-mohr
Copy link
Member

m-mohr commented Mar 6, 2023

fyi: In the Jupyter interface there's already a search control for the Vue components :-)

@clausmichele
Copy link
Member Author

fyi: In the Jupyter interface there's already a search control for the Vue components :-)

I know, but sometimes it would be good to avoid user interactions and show directly what we would like to! So, if an example is focused on Sentinel-2, instead of writing "please type Sentinel-2 to filter the collections", we can just present them the available ones given a keyword.

@m-mohr
Copy link
Member

m-mohr commented Mar 6, 2023

Sentinel 2 is a good example for an implementation, because it should likely match "Sentinel2", "Sentinel 2", "Sentinel-2", "Sentinel_2" and "Sentinel 2A". And you may want to match it in ID, title and maybe even more (keywords, description?). Thus the code must do some normalization, which for example leads to quite a bit of code in the Vue components: https://github.com/Open-EO/openeo-vue-components/blob/master/utils.js#L434
The code can be an inspiration how to do it here as well. It should likely not be pure 1:1 "string matching" because otherwise you likely don't get the results you are looking for. The implementation covers all cases from above, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants