fixed: variant count endpoint was returning a count including non-distinct variants #573
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.
This pull request refactors the variant counting logic in the
src/mavedb/routers/statistics.pyfile to improve performance and fix the count of variants. The main changes are explicitly querying against distinct variant identifiers and the introduction of a fast path for total counts, which avoids unnecessary grouping and aggregation when not requested, and a clearer separation between grouped and ungrouped queries.Performance and Query Logic Improvements:
variant_countsandmapped_variant_countsfunctions to quickly return the total distinct count when no grouping is requested, reducing query complexity and improving performance. [1] [2]