Migrate clinical-data-enrichments endpoint to clean architecture with ClickHouse support
#11661
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.
Built on top of #11425
Refactor Clinical Data Enrichments
Summary
Refactor clinical data enrichments to follow clean architecture principles, migrating from legacy service layer to domain layer with ClickHouse performance optimizations.
Note
In the event of responses largely differ from legacy responses, it's due to the legacy implementation doesn't unify casing of attribute values, causing inaccurate number of groups, for example:

This is because legacy has both 'PRIMARY_SITE' attribute values of "Ascending Colon" and "Ascending colon" as separate groups, having one more group than needed, thus led to inaccurate calculation results.
Key Changes
Architecture Migration
org.cbioportal.legacy.web.ClinicalDataEnrichmentController+ClinicalDataEnrichmentUtilColumnStoreClinicalDataEnrichmentControllerFetchClinicalDataEnrichmentsUseCase(business logic)ClinicalDataEnrichmentUtil(pure statistical functions)Performance Improvements
Legacy approach - Multiple queries per group:
New approach - Single optimized query:
Impact: Reduces database queries from O(groups × attributes) to O(1)
New Domain Layer
ClinicalDataEnrichment- immutable record (was mutable bean)EnrichmentTestMethod- type-safe enum (was magic strings)FetchClinicalDataEnrichmentsUseCase- encapsulates enrichment workflowClinicalDataEnrichmentUtil- pure statistical functionsRepository Enhancements
fetchClinicalDataSummaryForEnrichments()- batch fetch with UNION querygetClinicalDataCountsForEnrichments()- optimized categorical countsOther Improvements