Skip to content

feat(visualization): add performance & large dataset handling (#36) - #35

Merged
dsk-dev-ai merged 1 commit into
mainfrom
feat/visualization-performance
Aug 16, 2026
Merged

feat(visualization): add performance & large dataset handling (#36)#35
dsk-dev-ai merged 1 commit into
mainfrom
feat/visualization-performance

Conversation

@dsk-dev-ai

@dsk-dev-ai dsk-dev-ai commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

Implements Phase 6.10 — Visualization Performance & Large Dataset Handling.

What changed

  • Added deterministic downsampling for large scientific datasets.
  • Added peak-preserving coverage aggregation.
  • Added bounded rendering for large heatmaps.
  • Added bounded scatter rendering for distribution charts while preserving outliers.
  • Added bounded rendering for expression series.
  • Added bounded rendering for volcano plots.
  • Optimized distribution grouping to avoid repeated dataset scans.
  • Added performance-focused unit tests for downsampling and aggregation.
  • Added visualization performance documentation and roadmap updates.
  • Preserved the original datasets as the source of truth for interaction, selection, tooltips, and summaries.
  • Preserved accessibility behavior for rendered and decimated visualization elements.

Validation

  • Lint
  • TypeScript checks
  • Tests
  • Turbo build
  • Development server smoke check
  • Final diff review

Constraints

  • No new rendering architecture.
  • No WebGL/WebGPU/Three.js/Cytoscape/D3 additions.
  • No new cache abstraction.
  • Existing visualization data lifecycle remains authoritative.
  • Downsampling is deterministic and documented.
  • No intentional data loss.

Phase

Phase 6.10 — Visualization Performance & Large Dataset Handling

Follow-up

After this PR is merged, the next milestone will be handled separately.

Summary by Sourcery

Improve visualization performance and large dataset handling across scientific charts and network viewer while preserving correctness and accessibility.

New Features:

  • Introduce deterministic downsampling and aggregation utilities for scientific datasets, including coverage bin aggregation and heatmap block averaging.
  • Add bounded rendering behavior for expression charts, volcano plots, distribution scatters, coverage charts, and heatmaps to cap DOM/SVG complexity on large inputs.

Enhancements:

  • Optimize distribution chart grouping and statistics computation with single-pass value grouping to reduce per-render work.
  • Memoize network viewer node and edge elements and refactor their props to minimize unnecessary re-renders on interaction changes.
  • Refine scientific chart components to use memoized, decimated data for rendering while keeping full datasets as the source of truth for tooltips, selection, and summaries.

Documentation:

  • Update visualization roadmap and README to mark Phase 6.10 as implemented and document performance strategies and constraints.
  • Add a dedicated performance documentation page describing data flow, hot spots, downsampling strategies, limitations, accessibility, and future options.

Tests:

  • Add deterministic tests for downsampling utilities covering decimation, coverage column aggregation, and heatmap aggregation behavior.
  • Extend distribution chart tests to cover the new grouped-values helper and ensure consistency with existing group value retrieval.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@sourcery-ai

sourcery-ai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements Phase 6.10 visualization performance work by adding deterministic downsampling/aggregation helpers, capping rendered points/cells across scientific charts, memoizing expensive derivations, and documenting the performance strategy, while keeping underlying data and accessibility behavior unchanged.

Sequence diagram for optimized distribution chart grouping and statistics

sequenceDiagram
  participant Component as DistributionChart
  participant Hook as useDistributionChart
  participant Dist as distribution
  participant Stats as statistics

  Component->>Hook: useDistributionChart(datasetId)
  Hook->>Hook: distributionGroups(data)
  Hook->>Dist: valuesByGroup(data)
  Dist-->>Hook: groupedValues

  loop for each group in groups
    Hook->>Stats: summarize(values)
    Stats-->>Hook: SummaryStatistics
    Hook->>Stats: boxPlotWhiskers(values)
    Stats-->>Hook: Whiskers
  end

  Hook-->>Component: {groups, statistics}
  Component->>Dist: valuesForGroup(dataset, group)
  Dist-->>Component: groupValues
  Component->>Component: decimateItems(groupValues, MAX_SCATTER_POINTS_PER_GROUP)
  Component-->>Component: bounded_scatter_values
  Component-->>Component: render boxplot and jittered points
Loading

File-Level Changes

Change Details Files
Memoized network mark components to reduce re-renders on selection/filter changes.
  • Wrapped EdgeElement and NodeElement in React.memo and changed them to receive primitive props instead of the whole result object.
  • Computed selected state and selection handlers in NetworkGraph and passed them down as props.
  • Kept accessibility behavior (labels, keyboard handling, aria-pressed) unchanged while reducing geometry recomputation.
apps/web/src/components/network/NetworkViewer.tsx
Bound heatmap rendering via block-averaged aggregation while preserving dataset semantics for interaction and detail views.
  • Introduced MAX_HEATMAP_ROWS/COLS and used aggregateHeatmap to produce a bounded render dataset.
  • Used aggregated gridData for SVG rendering, hover tooltip, and summary output with a '(block-summarized for display)' note when active.
  • Refactored HeatmapDetail to read from the rendered gridData matrix and compute cell values/tooltip based on the aggregated dataset.
apps/web/src/components/scientific/Heatmap.tsx
apps/web/src/lib/scientific/downsample.ts
apps/web/src/lib/scientific/downsample.test.ts
Introduced deterministic downsampling and aggregation utilities for large scientific datasets with accompanying tests and documentation.
  • Added decimateItems for stride-based sampling with first/last preservation.
  • Added coverageColumns for peak-preserving pixel-column aggregation of coverage bins.
  • Added aggregateHeatmap for block-averaged heatmap matrices, preserving labels/metadata and missing-value semantics.
  • Documented performance architecture, hot spots, strategies, and limitations in performance.md, and linked it from README/roadmap.
  • Added unit tests for all downsampling helpers to verify bounds, determinism, and correctness.
apps/web/src/lib/scientific/downsample.ts
apps/web/src/lib/scientific/downsample.test.ts
docs/visualization/performance.md
docs/visualization/README.md
docs/visualization/roadmap.md
Capped rendered points in volcano and expression charts using deterministic decimation while keeping full datasets for tooltips and statistics.
  • Added MAX_RENDERED_POINTS and MAX_SERIES_POINTS and used decimateItems to produce rendered subsets for volcano points and expression series.
  • Memoized renderedPoints and renderedSeries in the respective components to avoid redundant recomputation on re-render.
  • Memoized volcano significant count so threshold changes recompute once per change instead of per render.
  • Adjusted series line rendering to consume pre-decimated series arrays rather than the raw dataset.
apps/web/src/components/scientific/VolcanoPlot.tsx
apps/web/src/components/scientific/ExpressionChart.tsx
apps/web/src/lib/scientific/downsample.ts
Improved coverage chart performance via memoized bin filtering and peak-preserving pixel-column aggregation.
  • Memoized per-chromosome bin filtering in CoverageBins.
  • Applied coverageColumns with a MAX_COVERAGE_COLUMNS cap to aggregate dense bin sets into per-pixel columns.
  • Derived SVG points from aggregated columns so both the path and hit targets remain bounded while still showing peak coverage.
apps/web/src/components/scientific/CoverageChart.tsx
apps/web/src/lib/scientific/downsample.ts
Optimized distribution chart grouping and capped scatter rendering while preserving outliers and summary statistics.
  • Added valuesByGroup for single-pass grouping of dataset values by group name, skipping empty groups.
  • Refactored useDistributionChart to compute per-group statistics from groupedValues using summarize and boxPlotWhiskers instead of re-scanning the dataset per group.
  • Capped jitter scatter points per group using decimateItems, always retaining outliers and only sampling non-outlier values.
  • Added tests for valuesByGroup to verify ordering, equivalence to valuesForGroup, and empty-group handling.
apps/web/src/lib/scientific/useDistributionChart.ts
apps/web/src/lib/scientific/distribution.ts
apps/web/src/lib/scientific/distribution.test.ts
apps/web/src/lib/scientific/downsample.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 140095c2-9ef4-431e-9306-fdea89c4c5bf


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the heatmap, HeatmapGrid, hover tooltips, and HeatmapDetail now operate on gridData (possibly aggregated), which contradicts the stated goal that the original dataset remains the source of truth for selection and tooltips; consider deriving detail/tooltips from result.dataset even when rendering an aggregated matrix.
  • In GroupBox for the distribution chart, the scatter decimation keeps all outliers and then samples the rest, but if the number of outliers exceeds MAX_SCATTER_POINTS_PER_GROUP the total rendered points for that group can still exceed the cap; consider enforcing the limit across outliers and non-outliers to keep per-group scatter strictly bounded.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the heatmap, `HeatmapGrid`, hover tooltips, and `HeatmapDetail` now operate on `gridData` (possibly aggregated), which contradicts the stated goal that the original dataset remains the source of truth for selection and tooltips; consider deriving detail/tooltips from `result.dataset` even when rendering an aggregated matrix.
- In `GroupBox` for the distribution chart, the scatter decimation keeps all outliers and then samples the rest, but if the number of outliers exceeds `MAX_SCATTER_POINTS_PER_GROUP` the total rendered points for that group can still exceed the cap; consider enforcing the limit across outliers and non-outliers to keep per-group scatter strictly bounded.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dsk-dev-ai
dsk-dev-ai merged commit 0eb0324 into main Aug 16, 2026
5 checks passed
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.

1 participant