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

Bug report - multiple filters don't work in Trends plots #338

Open
chrispyatt opened this issue Dec 22, 2021 · 3 comments
Open

Bug report - multiple filters don't work in Trends plots #338

chrispyatt opened this issue Dec 22, 2021 · 3 comments
Labels

Comments

@chrispyatt
Copy link

Describe the bug

When making a trends plot, applying two filters (e.g. Report_metadata_config_subtitle and Report_metadata_username) means no plot is generated (empty axes) even when the two filters work fine individually.

To Reproduce

Steps to reproduce the behavior:

  1. New Plot > Trends
  2. Create new filters (subtitle & username) in Global group
  3. Choose data type

Expected behavior

A new plot is made that only includes data uploaded by a specific user, filtered by assay (recorded in config subtitle in the jsons)

Actual behaviour

Empty axis appears (no datapoints)

@chrispyatt chrispyatt added the bug label Dec 22, 2021
@chrispyatt
Copy link
Author

I was just playing around with the filters yesterday and noticed that two filters does work if one is a date range and the other is metadata. So perhaps there is something preventing two filters of the same type (Report metadata)?

@multimeric
Copy link
Collaborator

This is interesting, and probably indicates a flaw in my filtering logic. I might have to rethink it.

@gouinK
Copy link

gouinK commented Mar 11, 2023

I ran into this as well, and although my situation might be a little different, I think the same issue is at play in both cases. In my case, I have Reports that have multiple metadata fields that I am interested in filtering against.

So for example:
Report 1: metadata_field_1 = foo, metadata_field_2 = bar
Report 2: metadata_field_1 = foo, metadata_field_2 = bat
Report 3: metadata_field_1 = baz, metadata_field_2 = bar

I want to make a filter that only shows Report 1. The current filtering uses "AND" logic for filters within the same group, however each report_meta_key is like its own row in the database, so if you try to filter based on both metadata_field_1 and metadata_field_2 (i.e. metadata_field_1 == "foo" AND metadata_field_2 == "bar") nothing will be returned because the two fields are in different rows. I'm not sure if I am using the "row" terminology in the correct manner here, but that is how I am thinking of it.

This is how I think the data are actually stored:
Row 1: report_id = Report 1, report_meta_key = metadata_field_1, report_meta_value = foo
Row 2: report_id = Report 1, report_meta_key = metadata_field_2, report_meta_value = bar
Row 3: report_id = Report 2, report_meta_key = metadata_field_1, report_meta_value = foo
Row 4: report_id = Report 2, report_meta_key = metadata_field_2, report_meta_value = bat
Row 5: report_id = Report 3, report_meta_key = metadata_field_1, report_meta_value = baz
Row 6: report_id = Report 3, report_meta_key = metadata_field_2, report_meta_value = bar

The short-term, less-ideal solution that I can see is to make separate filter queries for each field and then apply an INTERSECT operator.

The more-ideal solution might be to have all metadata fields in the same "row". There are probably better solutions, but this is what I have gathered so far.

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

No branches or pull requests

3 participants