Skip to content

feat(website): add Required Segments filter for multi-segmented viruses#6057

Merged
anna-parker merged 5 commits intomainfrom
feat/segment-presence-filter
Mar 16, 2026
Merged

feat(website): add Required Segments filter for multi-segmented viruses#6057
anna-parker merged 5 commits intomainfrom
feat/segment-presence-filter

Conversation

@anna-parker
Copy link
Copy Markdown
Contributor

@anna-parker anna-parker commented Feb 27, 2026

resolves #5840

Add a new SegmentFilter component to the search form that lets users easily filter for sequence entries that include specific segments of multi-segmented viruses.

Previously, users had to manually set the length filter to > 0 for each segment they wanted to require, which was unintuitive and created a cluttered UI. The new "Required segments" section appears at the top of the Sequence Filters panel (only for multi-segmented organisms) and shows a checkbox per segment. Checking a segment automatically sets length_{segment}From = 1, filtering to entries where that segment is present. Unchecking it clears the constraint.

The filter is rendered only when the underlying length_{segment}From fields exist in the metadata schema, making it a no-op for organisms that haven't configured per-segment length fields.

Screenshot

image

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)

🚀 Preview: https://feat-segment-presence-fil.loculus.org

@claude claude Bot added the website Tasks related to the web application label Feb 27, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 27, 2026

This PR may be related to: #5840 (Create a Segment presence filter checkbox for multi-segmented viruses and remove or decrease the size length check boxes)

@anna-parker anna-parker marked this pull request as ready for review February 27, 2026 14:50
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 27, 2026

Claude finished @anna-parker's task in 2m 46s —— View job


Code Review

  • Gather context
  • Read changed files
  • Analyze code quality, security, performance, testing, documentation
  • Post inline comments
  • Final review summary

The implementation is clean and well-structured. The component correctly guards against non-multi-segmented organisms, uses DisabledUntilHydrated per the project conventions, and gracefully no-ops when length_${segment}From fields aren't in the schema.

Two things worth addressing:

No tests – the PR checklist acknowledges this. Even a single integration test that checks a segment presence checkbox and verifies the URL param / search result count changes would give good confidence.

Hardcoded field name conventionlength_${segmentName}From is assembled inline in two places (lines 32 and 45). If this naming convention ever changes, it'll need updating in multiple places. A small constant or utility would make this more robust.

The two inline comments cover a performance nit (memoising ungroupedMetadataFilters()) and the more significant interaction between the new checkbox and an existing per-segment length filter.

Comment thread website/src/components/SearchPage/SegmentFilter.tsx Outdated
Comment thread website/src/components/SearchPage/SegmentFilter.tsx
@anna-parker
Copy link
Copy Markdown
Contributor Author

bulk revise 2 seqs with files errored on both integration tests, Ive been seeing this fail a lot so I assume its just flake

@anna-parker anna-parker requested a review from rneher February 27, 2026 16:21
@anna-parker anna-parker force-pushed the feat/segment-presence-filter branch from 6c45e88 to 85f9edd Compare March 4, 2026 10:41
anna-parker and others added 4 commits March 5, 2026 15:50
Add a new SegmentFilter component to the search form that lets users
easily filter for sequence entries that include specific segments of
multi-segmented viruses.

Previously, users had to manually set the length filter to > 0 for each
segment they wanted to require, which was unintuitive and created a
cluttered UI. The new "Required segments" section appears at the top of
the Sequence Filters panel (only for multi-segmented organisms) and
shows a checkbox per segment. Checking a segment automatically sets
length_{segment}From = 1, filtering to entries where that segment is
present. Unchecking it clears the constraint.

The filter is rendered only when the underlying length_{segment}From
fields exist in the metadata schema, making it a no-op for organisms
that haven't configured per-segment length fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@anna-parker anna-parker force-pushed the feat/segment-presence-filter branch from 85f9edd to c83cc1a Compare March 5, 2026 14:50
@theosanderson
Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@theosanderson theosanderson added the preview Triggers a deployment to argocd label Mar 13, 2026
Comment thread website/src/components/SearchPage/SearchForm.tsx
Copy link
Copy Markdown
Member

@theosanderson theosanderson left a comment

Choose a reason for hiding this comment

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

nice

@anna-parker anna-parker merged commit ff68124 into main Mar 16, 2026
58 checks passed
@anna-parker anna-parker deleted the feat/segment-presence-filter branch March 16, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Triggers a deployment to argocd website Tasks related to the web application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a Segment presence filter checkbox for multi-segmented viruses and remove or decrease the size length check boxes

2 participants