-
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
Open
annavik
wants to merge
19
commits into
main
Choose a base branch
from
feat/apply-score-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
52bcb51
feat: exclude score threshold filter from occurrence view
annavik da6cece
feat: exclude score threshold filter from species view
annavik 135408a
feat: exclude score threshold filter from playback view
annavik e52c804
chore: remove unused code
annavik 0dfacf9
feat: inform and link to default filters from list views
annavik 9069b6b
Add get_default_classification_threshold function to apply default sc…
mohamedelabbas1996 d7858db
Add get_default_classification_threshold function to apply default sc…
mohamedelabbas1996 383146d
Apply default classification threshold filter across OccurrenceViewSe…
mohamedelabbas1996 23a7819
Remove debug logs
mohamedelabbas1996 8f73de1
Apply default classification threshold filter to the TaxonViewSet lis…
mohamedelabbas1996 bda0c77
fix: remove OccurrenceDeterminationScoreFilter from filter_backends
mohamedelabbas1996 db69e28
fix: modified the default threshold qs filter method to handle projec…
mohamedelabbas1996 1090eb8
chore: always show default filters form, but hide taxa controls unles…
annavik e310b34
feat: add default classification threshold filtering to SourceImageCo…
mohamedelabbas1996 8968940
Merge branch 'main' into feat/apply-score-filter - stack visible_for_…
mihow cab5ef6
fix: apply score threshold filter when include_unobserved is False
mohamedelabbas1996 8ebf62e
Merge branch 'feat/apply-score-filter' of https://github.com/RolnickL…
mohamedelabbas1996 b0dfee6
test: add tests for project default score threshold filter
mohamedelabbas1996 48bfa18
test: add coverage for default threshold filtering in SourceImageView…
mohamedelabbas1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { | ||
FormActions, | ||
FormRow, | ||
FormSection, | ||
} from 'components/form/layout/layout' | ||
import { useProjectDetails } from 'data-services/hooks/projects/useProjectDetails' | ||
import { ProjectDetails } from 'data-services/models/project-details' | ||
import { | ||
IconButton, | ||
IconButtonTheme, | ||
} from 'design-system/components/icon-button/icon-button' | ||
import { IconType } from 'design-system/components/icon/icon' | ||
import { InputValue } from 'design-system/components/input/input' | ||
import { ChevronRightIcon } from 'lucide-react' | ||
import { buttonVariants, Popover } from 'nova-ui-kit' | ||
import { Link, useParams } from 'react-router-dom' | ||
import { APP_ROUTES } from 'utils/constants' | ||
import { STRING, translate } from 'utils/language' | ||
|
||
export const DefaultFiltersControl = () => { | ||
const { projectId } = useParams() | ||
const { project } = useProjectDetails(projectId as string, true) | ||
|
||
return ( | ||
<div className="flex items-center justify-between pl-2"> | ||
<div className="flex items-center gap-1"> | ||
<span className="text-muted-foreground body-overline-small font-bold pt-0.5"> | ||
{translate(STRING.NAV_ITEM_DEFAULT_FILTERS)} | ||
</span> | ||
{project ? <InfoPopover project={project} /> : null} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
const InfoPopover = ({ project }: { project: ProjectDetails }) => ( | ||
<Popover.Root> | ||
<Popover.Trigger asChild> | ||
<IconButton icon={IconType.Info} theme={IconButtonTheme.Plain} /> | ||
</Popover.Trigger> | ||
<Popover.Content className="p-0"> | ||
<FormSection | ||
title={translate(STRING.NAV_ITEM_DEFAULT_FILTERS)} | ||
description="Data is filtered by default based on global project configuration." | ||
> | ||
<FormRow> | ||
<InputValue | ||
label="Score threshold" | ||
value={project.settings.scoreThreshold} | ||
/> | ||
</FormRow> | ||
<FormRow | ||
style={ | ||
project.featureFlags.default_filters | ||
? undefined | ||
: { display: 'none' } | ||
} | ||
> | ||
<InputValue | ||
label="Include taxa" | ||
value={project.settings.includeTaxa | ||
.map((taxon) => taxon.name) | ||
.join(', ')} | ||
/> | ||
<InputValue | ||
label="Exclude taxa" | ||
value={project.settings.excludeTaxa | ||
.map((taxon) => taxon.name) | ||
.join(', ')} | ||
/> | ||
</FormRow> | ||
</FormSection> | ||
<FormActions> | ||
<Link | ||
className={buttonVariants({ size: 'small', variant: 'outline' })} | ||
to={APP_ROUTES.DEFAULT_FILTERS({ projectId: project.id })} | ||
> | ||
<span>Configure</span> | ||
<ChevronRightIcon className="w-4 h-4" /> | ||
</Link> | ||
</FormActions> | ||
</Popover.Content> | ||
</Popover.Root> | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 makeproject
optional with a default ofNone
or remove this check.Copilot uses AI. Check for mistakes.