Skip to content

feat(labs): add biomarker filtering and sorting - #1370

Merged
MBombeck merged 1 commit into
MBombeck:mainfrom
ferges123:feature/biomarker-filter-sort
Nov 11, 2026
Merged

MBombeck merged 1 commit into
MBombeck:mainfrom
ferges123:feature/biomarker-filter-sort

Conversation

@ferges123

Copy link
Copy Markdown
Contributor

Summary

  • Add biomarker filtering by search text, date range, reference-range status, and category, with sorting controls in a single responsive filter rail.
  • Keep filter and sort state synchronized with the URL, including safe cleanup of stale parameters after preferences load.
  • Preserve legacy local list preferences during server carry-over and calculate visible group status/counts consistently when filters are active.
  • Update translations, UI guidance, changelog, and the Labs OpenAPI description.

Validation

  • Labs browser tests: 18 passed across 3 files.
  • Labs list and filter unit tests: 43 passed across 3 files.
  • Module-list preference tests: 12 passed.
  • Focused ESLint: passed.
  • pnpm typecheck: passed.

@ferges123
ferges123 marked this pull request as ready for review November 10, 2026 20:00

@MBombeck MBombeck left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks a lot for this, @ferges123. A filter rail is what the labs list needs once it grows past a screenful, and the translations in all ten languages are a real piece of work. I've approved the CI runs.

I'd like to take it. A few things first, roughly in order of how much they matter:

  1. Groups collapse while filtering. With groupsOpen: "flagged", openByDefault is computed from the filtered rows. Filter for "in range", or search for an unremarkable marker, and you get closed headers while the counter says there are matches. The browser test at lab-list-url-sync.browser.test.tsx:520 pins that. With any filter active, every group that has a match should open.
  2. The date filter only looks at the latest reading (lab-list-filters.ts:196-201), but the label says "Date range". A marker measured inside the range and again later drops out. I'd rename it to "Last measured" so it says what it does.
  3. The sort pill. Settings > Labs already has a saved sort order (labs-settings.tsx). The pill adds a second one that is URL-only and lost on the next visit. Also, isFiltered ignores it but "Reset" resets it. I'd drop the pill and keep the list sorted the way Settings says.
  4. The API description in src/lib/openapi/routes/labs.ts loses the status rule and the sentence that a client never rebuilds category, order or status. The iOS app relies on that wording. Please keep it as it was and add a line saying a filtered subset is summarised by the same rule.
  5. src/lib/module-list-prefs.ts: the entry?.saved check and the legacy-preference precedence change all three lists (labs, illness, checkups), not just this one. It may well be right, but it's a separate change. Could you split it into its own PR with a sentence on what it fixes?
  6. Small ones: please drop the /plans/ line from .gitignore, since it's local to your setup. Use "…" in the search placeholder like the rest of en.json. Move the UrlFilterSyncOptions interface above the hook's JSDoc in use-url-filter-sync.ts, so the comment documents the hook.

You don't need to bother with formatting or with the conflicts with the next release. Prettier flags eleven files, and release/v1.47.2 adds a saved category order (categoryOrder) to the same preferences. I'll resolve both when I merge. Your category filter already reads the server's ordered categories, so the two fit together.

If you'd rather I make these changes myself on top of your commit, just say so. Your authorship stays either way. If I haven't heard back by Friday, I'll take it from there so it makes the next patch.

@MBombeck

Copy link
Copy Markdown
Owner

@ferges123 I went ahead and did the review changes myself, so this makes it into 1.47.2, which ships tomorrow. Your commit is merged as it is into the release branch (release/v1.47.2, merge f20efca), and this PR will show as merged once the release lands on main.

On top of it: groups with a match stay open while filtering, the date filter is now called "Last measured", the sort pill is gone (the saved sort from Settings applies), the API description is back with one added sentence, and the list-preference precedence change is left out for now. I also moved the search field beside the filter rail for phones, fixed typed characters getting lost while the URL caught up, kept focus in the field around clear and /, swapped reversed date links, and made the search ignore accents.

Thanks a lot for this one. It's a big, careful piece of work, and the tests made the follow-ups easy. You'll be in the release notes.

@MBombeck MBombeck mentioned this pull request Nov 11, 2026
@MBombeck
MBombeck merged commit a486c3c into MBombeck:main Nov 11, 2026
29 of 31 checks passed
@ferges123

Copy link
Copy Markdown
Contributor Author

Thanks! I've just started using your app and hadn't noticed the sort and grouping option earlier. Thanks for a great application.

@MBombeck

Copy link
Copy Markdown
Owner

@ferges123 This shipped in v1.47.2 and this PR now shows as merged with your commit. Thanks again for the work and the tests.

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