Skip to content

Conversation

annavik
Copy link
Member

@annavik annavik commented Jul 4, 2025

Summary

In this PR we setup default filters for projects. This will help us present more relevant data for users and simplify view settings. The PR is in draft since we need to include BE changes and also a few remaining FE tweaks.

List of Changes

  • Setup new settings view "Default filters"
  • Setup a form to configure following filters for a project
    • Score threshold
    • Include taxa
    • Exclude taxa
  • Exclude view controls for score filtering (for sessions, occurrences and taxa)

Sub Tasks

  • [FE] Setup settings page for default filters ✅
  • [BE] Update the project model to handle default filters ✅
  • [BE] Update the project API to expose default filters ✅
  • [BE] Apply the default filters backend side when data is returned ⏳
    • Stats bars and charts
    • List views
    • Capture view
    • Numbers in columns
    • Taxa search
  • [FE] Connect settings form with backend ✅
  • [FE] Update quick actions to use exclude taxa values ✅
  • [FE] Make it possible to disable default project filters when needed ⏳

Related Issues

#873
#868
#237
#906 (the time gap between monitoring sessions should be configurable by users)

Detailed Description

Screenshots

Screenshot 2025-07-04 at 16 13 51

Copy link

netlify bot commented Jul 4, 2025

Deploy Preview for antenna-preview failed. Why did it fail? →

Name Link
🔨 Latest commit 3cf0bba
🔍 Latest deploy log https://app.netlify.com/projects/antenna-preview/deploys/68b014bbe0600400085adc56

@mihow
Copy link
Collaborator

mihow commented Aug 5, 2025

Note: Consider adding a size filter here as well. Start with pixel percent, but if we add a size calibration for each device type (physical dimensions of the size of the target) then the filter can be physical units (centimeters). The goal being to automatically hide any moths/detections that are under X square centimeters.

@annavik
Copy link
Member Author

annavik commented Aug 5, 2025

Note: Consider adding a size filter here as well. Start with pixel percent, but if we add a size calibration for each device type (physical dimensions of the size of the target) then the filter can be physical units (centimeters). The goal being to automatically hide any moths/detections that are under X square centimeters.

Yes I like that idea and I think this view will be the perfect place to add such a filter! I think we should try complete the first 2 filters before we add more though. Same for the "gap between monitoring sessions" setting.

@annavik annavik self-assigned this Aug 5, 2025
@annavik annavik force-pushed the feat/default-filters branch from 9f9fb41 to c79960a Compare August 18, 2025 09:33
@annavik
Copy link
Member Author

annavik commented Aug 18, 2025

One idea on how we could present the default project filters in other views (and make it possible to disable on demand):

Screenshot 2025-08-18 at 16 59 35 Screenshot 2025-08-18 at 16 59 42

@mihow
Copy link
Collaborator

mihow commented Aug 21, 2025

Adding some notes here from our call:

  • This looks great! I like the ability to toggle the default filters on/off as a group from the occurrence view. That seems like a nice way to keep it simple. Having a direct link to the exact settings section where you can change the default filters is great. I think we should use that pattern other places too! (deep linking to settings from relevant contexts)
  • Let's try to merge this work behind a feature flag and then we will implement each filter on the backend in their own tickets (for example Make score threshold a project setting #873)
  • We will need a place for processing settings (default processing pipeline) and other settings like the time gap used to calculate sessions. These are already being used on the backend, but not editable by the user in the UI. It's okay if the settings section isn't perfectly organized, as long as the settings are somewhere and are documented (or linked from relevant contexts!). That's pretty much how every platform is (what is the "File" menu about anyway?). But we can keep those project settings for another ticket and edit them in the Django admin until then.

@annavik
Copy link
Member Author

annavik commented Aug 21, 2025

Adding some notes here from our call:

  • This looks great! I like the ability to toggle the default filters on/off as a group from the occurrence view. That seems like a nice way to keep it simple. Having a direct link to the exact settings section where you can change the default filters is great. I think we should use that pattern other places too! (deep linking to settings from relevant contexts)
  • Let's try to merge this work behind a feature flag and then we will implement each filter on the backend in their own tickets (for example Make score threshold a project setting #873)
  • We will need a place for processing settings (default processing pipeline) and other settings like the time gap used to calculate sessions. These are already being used on the backend, but not editable by the user in the UI. It's okay if the settings section isn't perfectly organized, as long as the settings are somewhere and are documented (or linked from relevant contexts!). That's pretty much how every platform is (what is the "File" menu about anyway?). But we can keep those project settings for another ticket and edit them in the Django admin until then.

Thank you! 🙏 This is fully in line with my thoughts after the call as well. I plan to wrap this PR up at the beginning of next week.

@annavik
Copy link
Member Author

annavik commented Aug 25, 2025

Form is successfully hooked up with backend!

I'm suggesting a slightly different presentation of settings:

  • General -> Project cover
  • Default filters -> Project configuration

My hope is to make things a bit more clear and to allow the settings form to expand a bit. I also added the time gap control, since it was a quick fix.

Screenshot 2025-08-25 at 12 01 52

To discuss today:

  • How you like the suggested settings structure
  • Feature flag strategy

data.append('tag_ids', JSON.stringify(tags.map((tag) => tag.id)))

return axios.post(
mutationFn: ({ projectId, tags }: { projectId: string; tags: Tag[] }) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

Some unrelated cleanup in this file

@annavik annavik force-pushed the feat/default-filters branch from 929aac6 to 72c36ad Compare August 28, 2025 08:34
@annavik
Copy link
Member Author

annavik commented Aug 28, 2025

Closing in favor of #929 and #930

@annavik annavik closed this Aug 28, 2025
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.

2 participants