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

Allow filtering inferences by timestamp and/or with logical operators #14

Open
loreabad6 opened this issue Jul 28, 2021 · 1 comment
Open

Comments

@loreabad6
Copy link
Member

Describe the solution you'd like
It would be nice to do something like:

sen2cli inference ls --timestamp_created=2021-07-28T08:00:00
Usage: sen2cli inference ls [OPTIONS]
Try 'sen2cli inference ls --help' for help.

Error: No such option: --timestamp_created

or if that is not possible something like:

sen2cli inference ls --id>=8420
Error: Option '--id' requires an argument.

Maybe there is a way I am not familiar with?

@grmpfhmbl
Copy link
Collaborator

I will have a look on how to implement that type of filter best.

For now you can do that with the --raw_modifier option. I didn't want to have too many different filter options directly on the command line right away to see what is needed. I'll create some more examples for the --raw_modifier option.

For the time filter try the following

Create a file e.g. ~/host_data/date_filter.json with the following content

[
  {
    "name": "timestamp_started",
    "op": "gt",
    "val": "2021-07-25T22:06:22"
  }
]

Then run the CLI with sen2cli inference ls --raw_modifier="filter=$(cat ~/host_data/date_filter.json)" and you should get all inferences with a timestamp_started later than 2021-07-25T22:06:22. If you want before use lt instead of gt. The filter syntax follows the Flask-restless filter syntax.

Downside of the --raw_modifier option is that you can't really combine it with the other filter options. Combining with --sort works though. sen2cli inference ls --raw_modifier="filter=$(cat ~/host_data/date_filter.json)" --sort=-status.

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

No branches or pull requests

2 participants