Skip to content

Conversation

i-am-leslie
Copy link

@i-am-leslie i-am-leslie commented Oct 13, 2025

Fix #11640

Migrate Mutation to Clean Architecture with ClickHouse Support

This PR refactors mutation data endpoints from legacy architecture to clean architecture with ClickHouse support, as part of the broader backend migration to ClickHouse and clean architecture patterns

ARCHITECTURAL CHANGES

Usecase Layer

FetchAllMetaMutationsInProfileUseCase- Use case for retrieving MetaMutation data
FetchAllMutationsInProfileUseCase- Use case for retrieving Mutation data
GetMutationDataUseCases- provides a centralized way to access and utilize the use cases

Repository

MutationRepository- Interface that defines the methods for retrieving data from the repository

Infrastructure

ClickhouseMutationMapper- Maps the repository methods to the ClickhouseMutationMapper.xml file
ClickhouseMutationRepository- Implements the MutationRepository methods used to communicate with the database using ClickhouseMutationMapper.

Rest Layer

ColumnMutationController- New @Profile("clickhouse") rest controller supporting retrieval of Mutation and MutationMeta data

MapStruct Integration

  • MutationMapper: Main mapper with computed uniqueKey fields
  • AlleleSpecificCopyNumberMapper: Nested object transformation
  • GeneMapper : Nested object transformation

###Simple Flow Diagram
Screenshot 2025-08-17 at 5 37 49 PM

Limitations

In the effort to reduce the number of joins and ensure the population of all required fields needed for the Mutation object in SUMMARY and DETAILED projections, I faced a cartesian effect due to no unique combination of values in genomic_event_derived. Please take a look at this draft PR for more details #11650

Reviewer Notes
Please feel free to review the overall structure and approach. Feedback on the direction, naming, or anything architectural is welcome, especially in the use case logic, queries and dependency setup.

… for grouping profiles and removing duplicates
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.

Migrate mutations endpoint to clean architecture with ClickHouse support

3 participants