Skip to content

[DT-3313] [5/6] Add filters to the Intellectual Property and Funding Resources tabs - #3940

Merged
kevinmarete merged 8 commits into
developfrom
km-dt-3313-ip-funding-filters
Sep 17, 2026
Merged

kevinmarete merged 8 commits into
developfrom
km-dt-3313-ip-funding-filters

Conversation

@kevinmarete

@kevinmarete kevinmarete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Addresses

DT-3313 — 5 of 6, splitting #3926 per review. Stacked on #3936. Security risk: no.

Summary

The smallest of the asset PRs. Intellectual Property gains Type and Status alongside the Filed Date it already had; Funding Resources gains Funder Name alongside Funding Dates. Same template as #3938 and #3939: options from the full corpus, a matchAny clause, a client-side row predicate.

One thing that isn't purely additive, and is the reason to read the predicates rather than skim them: both previously ended with the date check and returned true early when the range was inactive. That was correct when the date was the tab's only filter. With a second filter on the tab, an inactive range has to fall through to the remaining checks instead of passing the row outright, so both predicates are restructured to run the date check as a block and let the array checks decide.

Mutation-checked: short-circuiting either the ipStatus or the fundingFunderName predicate fails a test.

@kevinmarete kevinmarete changed the title [DT-3313] Add filters to the Intellectual Property and Funding Resources tabs [DT-3313] [5/6] Add filters to the Intellectual Property and Funding Resources tabs Sep 15, 2026
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report for DUOS Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 90.42% 12136 / 13422
🔵 Statements 89.92% 12955 / 14407
🔵 Functions 87.54% 3597 / 4109
🔵 Branches 82.96% 7640 / 9209
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/data_library/filterRegistry.ts 88.42% 86.15% 98.66% 87.86% 225, 303, 560-567, 730-734, 754-768, 784-793, 829-838, 847-861, 916, 952
src/components/data_library/assets/fundingResourceAsset.ts 100% 91.66% 100% 100%
src/components/data_library/assets/intellectualPropertyAsset.ts 100% 92.59% 100% 100%
src/hooks/useLibraryPageState.ts 88.07% 78.33% 82.45% 87.37% 241, 244, 256-260, 266, 303, 318, 338-342
src/hooks/useLibraryUrlState.ts 96.5% 94.68% 100% 96.29% 206, 217-219, 349
src/libs/dataLibraryFilterConfig.ts 100% 100% 100% 100%
src/types/library.ts 100% 100% 100% 100%
Generated in workflow #7261 for commit 73b7c77 by the Vitest Coverage Report Action

@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from c35e67e to 5d53aac Compare September 15, 2026 23:45
@kevinmarete
kevinmarete requested a lite review from Copilot September 15, 2026 23:47
@kevinmarete
kevinmarete force-pushed the km-dt-3313-full-corpus-options branch from 8ac602d to c045362 Compare September 15, 2026 23:53
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 5d53aac to 9c8cf19 Compare September 15, 2026 23:57
@kevinmarete
kevinmarete force-pushed the km-dt-3313-full-corpus-options branch from bbb9e93 to 1bf6217 Compare September 16, 2026 00:27
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 1f63de8 to daa6574 Compare September 16, 2026 00:31
@kevinmarete kevinmarete self-assigned this Sep 16, 2026
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from daa6574 to 8be10ec Compare September 16, 2026 01:17
@kevinmarete
kevinmarete requested a lite review from Copilot and removed request for Copilot September 16, 2026 01:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Remaining findings are minor test-coverage and documentation nits with no approval-blocking issues.

Pull request overview

Adds Type and Status filters for Intellectual Property and Funder Name filtering for Funding Resources.

Changes:

  • Extends filter state, configuration, URL handling, and corpus-derived options.
  • Adds Elasticsearch clauses and client-side row predicates.
  • Expands component, registry, and asset tests.
File summaries
File Description
test/components/data_library/LibraryFilters.spec.tsx Tests new filter sections.
test/components/data_library/filterRegistry.spec.ts Tests query clause paths.
test/components/data_library/assets/intellectualPropertyAsset.spec.ts Tests IP filtering behavior.
test/components/data_library/assets/fundingResourceAsset.spec.ts Tests funding filtering behavior.
src/types/library.ts Defines new filter state and option types.
src/libs/dataLibraryFilterConfig.ts Enables filters per asset tab.
src/hooks/useLibraryUrlState.ts Adds URL parsing and serialization.
src/hooks/useLibraryPageState.ts Derives full-corpus filter options.
src/components/data_library/filterRegistry.ts Defines controls and query clauses.
src/components/data_library/assets/intellectualPropertyAsset.ts Applies IP filtering and normalization.
src/components/data_library/assets/fundingResourceAsset.ts Applies funding filtering and normalization.
Review details

Suppressed comments (1)

src/hooks/useLibraryPageState.ts:265

  • These new option mappings are only exercised with empty arrays by the existing useLibraryPageState fixtures; the hook tests cover the analogous workspace path but never provide IP or funding buckets or assert these three option lists. A wrong response key or omission from CORPUS_DERIVED_OPTION_ASSETS would therefore leave the new panels empty while the current tests still pass. Add a focused hook test with IP and funding buckets (including an active own filter) and assert the complete option lists.
      ipType: uniqueValues(intellectualPropertyItems.map(item => item.type)),
      ipStatus: uniqueValues(intellectualPropertyItems.map(item => item.status)),
      fundingFunderName: uniqueValues(fundingResourceItems.map(item => item.funderName)),
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/components/data_library/LibraryFilters.spec.tsx Outdated
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 8be10ec to 4e50cf2 Compare September 16, 2026 01:54
@kevinmarete
kevinmarete force-pushed the km-dt-3313-full-corpus-options branch from fe3f3e3 to d518a95 Compare September 16, 2026 01:57
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch 2 times, most recently from 92078e5 to 240d915 Compare September 16, 2026 02:26
@kevinmarete
kevinmarete force-pushed the km-dt-3313-full-corpus-options branch from 6089499 to f2c1770 Compare September 16, 2026 02:49
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 240d915 to e851f27 Compare September 16, 2026 02:58
@kevinmarete
kevinmarete marked this pull request as ready for review September 16, 2026 03:08
@kevinmarete
kevinmarete requested a review from a team as a code owner September 16, 2026 03:08
@kevinmarete
kevinmarete requested review from fboulnois and otchet-broad and removed request for a team September 16, 2026 03:08
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch 2 times, most recently from 8fe421d to d5b7a5a Compare September 16, 2026 16:13
@kevinmarete
kevinmarete changed the base branch from km-dt-3313-full-corpus-options to km-dt-3313-presentation-publication-filters September 16, 2026 16:13
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from b20707d to 42c44dc Compare September 16, 2026 16:22
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch 2 times, most recently from a92aedd to 364c713 Compare September 16, 2026 17:19
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 364c713 to 50608d5 Compare September 16, 2026 17:38

@fboulnois fboulnois left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One suggestion:

1. New URL params have no round-trip test coverage: test/hooks/useLibraryUrlState.spec.tsx

The three new URL params (ipType, ipStatus, fundingFunderName) have no parse/serialize round-trip coverage, unlike every sibling filter added earlier in this stack.

A wrong or duplicated param string in ARRAY_FILTER_PARAM_CONFIG type-checks fine (only key is typed) and would silently clobber another filter's query param on share/restore.

Fix: add round-trip cases for the three new params, matching the existing sibling coverage.

@kevinmarete

Copy link
Copy Markdown
Contributor Author

Fixed in 19170c5c, thanks.

Added parse/serialize/clear cases for ipType, ipStatus and fundingFunderName, matching the sibling coverage.

Also added a pass for the collision specifically: no per-key test can catch a duplicated param, since each key still round-trips fine in isolation while quietly clobbering its sibling. That one writes every array filter at once and reads them all back. Pointing fundingFunderName at ipType's param fails it; a plain typo fails the per-key cases.

Comment thread src/components/data_library/filterRegistry.ts Outdated
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from 4021a3c to b129468 Compare September 17, 2026 17:50
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 19170c5 to ea019e8 Compare September 17, 2026 17:50
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from b129468 to 99c81a3 Compare September 17, 2026 17:59
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from ea019e8 to 2a353c6 Compare September 17, 2026 17:59
Base automatically changed from km-dt-3313-presentation-publication-filters to develop September 17, 2026 18:07
kevinmarete and others added 8 commits September 17, 2026 14:08
Intellectual Property gains Type and Status alongside the Filed Date it
already had; Funding Resources gains Funder Name alongside Funding Dates.

Both row predicates are restructured so the date check no longer returns
early: with a second filter on the tab, an inactive date range has to fall
through to the remaining checks rather than passing the row outright.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three checkbox keys were missing from `CHECKBOX_FILTER_KEYS`, so
LibraryFilters fell through to `null` and none of the sections appeared. Both
tabs' existing date ranges were already registered.

Tests now assert the rendered panel and each clause's Elasticsearch field path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The option lists are built from trimmed values while these predicates
compared raw ones, so selecting an option built from `"  Patent "` dropped
the only row that produced it. Both tabs also join
CORPUS_DERIVED_OPTION_ASSETS, since their options are read off the corpus now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adding the IP filters put 'Status' on both ipStatus and clinicalTrialStatus, so
a clinical-trial status set on its own tab rendered as a chip identical to the
Intellectual Property tab's own section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Only `key` is typed in ARRAY_FILTER_PARAM_CONFIG, so a mistyped or duplicated
`param` type-checks and loses the filter — or a sibling's — on share or reload.

Round-trip the three new params the way their siblings are covered, and add a
pass that writes every array filter at once and reads them all back, which
catches a collision no per-key case can see.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
These three are controlled vocabularies whose options are read off the corpus,
but match_phrase admits any value containing the phrase, so selecting IP Type
"Provisional Patent" also matched a study holding only a "Provisional Patent
Application". That study entered the shared studies aggregation the Studies and
Datasets badges count straight from, while only the Intellectual Property grid
dropped the row in its own exact re-check.

Match the keyword subfield instead, as the presentation and publication filters
already do, so the clause and the row predicate agree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 2a353c6 to 73b7c77 Compare September 17, 2026 18:08
@sonarqubecloud

Copy link
Copy Markdown

@otchet-broad otchet-broad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@kevinmarete
kevinmarete merged commit 94436b6 into develop Sep 17, 2026
16 checks passed
@kevinmarete
kevinmarete deleted the km-dt-3313-ip-funding-filters branch September 17, 2026 19:15
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.

4 participants