DT-3206 - Replace fuzzy study description matches with tags - #3927
Merged
Merged
Conversation
ncalvanese1
requested review from
fboulnois and
kevinmarete
and removed request for
a team
September 14, 2026 19:57
…ucture - Remove tests expecting both match_phrase and terms in description-based libraries - Update tests to validate tags-only queries now that study.description matching has been removed - Add test for using StudyDataEsFields.TAGS_KEYWORD constant for proper field references - Keep specific tests for broad (institution + tags) and anvil (single tag) libraries - Import StudyDataEsFields for consistent field reference usage
…d approach Replace brittle implementation-specific tests with flexible constraint-based tests: - Remove tests that expected specific library query structures - Add constraint tests that enforce Elasticsearch best practices: - All terms queries use .keyword suffix for case-sensitive matching - No conflicting field variants (e.g., study.data.tags vs study.data.tags.keyword) - All bool queries have valid structure with single query type per clause - Keep library-specific test only for 'broad' (has semantic/business logic reason) - Tests now validate "rules" rather than "shapes", allowing query structure flexibility - Future library additions or refactors won't break tests unless constraints are violated
- Add missing trailing commas on lines 308 and 311 to fix @stylistic/comma-dangle lint errors - Update "all queries with terms use .keyword suffix" test to accept any .keyword-suffixed field (e.g., both data.tags.keyword and study.data.tags.keyword) - This allows different fields to serve different purposes while maintaining the constraint - Uses regex pattern matching to validate .keyword suffix regardless of field path
Contributor
Coverage Report for DUOS Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
- Add parentheses around arrow function parameter on line 240 (arrow-parens) - Add parentheses around arrow function parameters on lines 263, 287, 290, 309, and 312 for consistency - Ensures all arrow functions with curly braces have proper parentheses per @stylistic/arrow-parens rule
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Addresses
DT-3206 -- Replacing data library study description logic with tags.
Summary
Data library search definitions previously used search terms in the study description field, which had the potential for turning up a large number of false positives. Now that study tags have been implemented, we have gone through the data library logic and switched most data libraries to use tags instead of study descriptions, and have added tags where appropriate to ensure the libraries that shouldn't change have remained consistent.
Also, as part of this work, refactored
libraryVersions.spec.tsto use constraint-based testing rather than structure-specific assertions. Tests now validate Elasticsearch best practices (e.g.,.keywordsuffix usage, valid query structures) instead of expecting specific library configurations. This makes tests future-proof—library query structures can change freely as long as architectural constraints are maintained, eliminating test breakage from routine refactors.Have you read Terra's Contributing Guide lately? If not, do that first.