-
Notifications
You must be signed in to change notification settings - Fork 5
Apply score threshold filter #944
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
base: main
Are you sure you want to change the base?
Conversation
…ore filters from project settings
…ore filters from project settings
…t, TaxonViewSet, SourceImageViewSet, EventViewSet, and SummaryView
Remove OccurrenceDeterminationScoreFilter to ensure apply_defaults parameter is respected.
✅ Deploy Preview for antenna-preview canceled.
|
…s feature flag is enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if project is None: | ||
return 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition will never be reached because the function signature shows project
as a required parameter without a default value, but the docstring and logic suggest it should handle None values. Either make project
optional with a default of None
or remove this check.
Copilot uses AI. Check for mistakes.
…user and filter_by_score_threshold filters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird since the default score threshold filter is already applied in Line 1387 in 8968940
|
…ab/antenna into feat/apply-score-filter
…Set, SourceImageCollectionViewSet, EventViewSet, and SummaryView
Summary
In #929, we setup a view to make it possible to adjust default filters for a project. In this PR, we apply the filter for score threshold. The changes includes both frontend and backend updates.
Related Issues
Fixes #926
List of Changes
Added
get_default_classification_threshold(project, request)
to read threshold from project settings (falling back to request params ifapply_defaults=false
).Added
filter_by_score_threshold()
filtering queryset method toOccurrenceQuerySet
.Applied default threshold filtering in:
OccurrenceViewSet
TaxonViewSet
SourceImageViewSet
SourceImageCollectionViewSet
EventViewSet
SummaryView
Removed
OccurrenceDeterminationScoreFilter
.Detailed Description
This PR is the first step toward using default project-level settings filters across the platform.
It introduces support for applying the project’s configured default classification score threshold to multiple API endpoints. When a threshold is defined in the project settings, all relevant endpoints (Occurrences, Taxa, Events, Source Images, Collections, and Summary) automatically filter out records below that threshold.
At the same time, flexibility is preserved: users can bypass the defaults by passing
apply_defaults=false
in their request, which reverts filtering behavior back to the per-request classification_threshold parameter.How to Test the Changes
Go to the Project Details admin page and set a default classification score threshold.
Check that the Occurrence, Taxon, Event, and Summary endpoints all respect the threshold.
Add ?apply_defaults=false to API requests and confirm that results are no longer filtered by the project defaults.
Remove the flag (or set apply_defaults=true) and confirm that defaults are applied again.
Screenshots
TBD
Deployment Notes
TBD
Checklist