Skip to content

feat(model): add filterToAnchorPartitions option to getAnchoredPColumns#1514

Open
PaulNewling wants to merge 5 commits intomainfrom
pnewling/allow-dataset-sample-selection
Open

feat(model): add filterToAnchorPartitions option to getAnchoredPColumns#1514
PaulNewling wants to merge 5 commits intomainfrom
pnewling/allow-dataset-sample-selection

Conversation

@PaulNewling
Copy link

@PaulNewling PaulNewling commented Mar 13, 2026

Summary

Adds a filterToAnchorPartitions option to ResultPool.getAnchoredPColumns.

When set to true, the method derives the unique axis-0 partition keys from the resolved anchor column(s) and injects a pl7.app/axisKeys/0 annotation onto each returned column spec. findLabelsForColumnAxis respects this annotation, so graph-maker sample dropdowns are scoped to samples actually present in the selected dataset rather than all samples in the originating samples & data block.

Motivation

Blocks that accept a dataset reference (e.g. a MiXCR clonotyping output) and pull upstream sampleId-keyed metadata via getAnchoredPColumns face a subtle scoping problem: the upstream samples & data block publishes label and metadata columns covering all of its samples, not just the subset that ended up in any one downstream dataset. Without this option, graph-maker shows the full sample list in its dropdowns, including samples that have no data in the selected dataset.

Currently we are attempting to work around this issue with a work around:

  1. Running an extra pt join step in the workflow to produce a dataset-filtered label column.
  2. Manually chaining .filter((c) => c.spec.name !== 'pl7.app/label') on the getAnchoredPColumns result in the model.

This has potential possibilities to strip labels and pollute downstream data if set incorrectly though.

(See this PR as an example of a workaround step - LINK)

filterToAnchorPartitions replaces pattern 2 with a single declarative option, and enables the exclude option to cleanly own the label-exclusion intent. The sampleId values themselves are never modified, so downstream blocks that join on the original IDs continue to work correctly.

Changes

  • sdk/model/src/render/api.ts:
    • new filterToAnchorPartitions field on UniversalPColumnOpts
    • private deriveAnchorPartitionKeys helper
    • updated getAnchoredPColumns implementation.

Images

Screenshot 2026-03-12 at 11 35 54 AM Screenshot 2026-03-13 at 10 13 11 AM

When set, derives unique axis-0 partition keys from the resolved anchor
column(s) and injects a pl7.app/axisKeys/0 annotation onto each returned
column spec. findLabelsForColumnAxis respects this annotation, so
graph-maker sample dropdowns only show keys present in the anchor dataset
rather than all keys in the originating samples block.
Signed-off-by: Paul Newling <paulnewling@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a filterToAnchorPartitions option to the ResultPool.getAnchoredPColumns method, addressing a common issue where downstream blocks displayed samples not relevant to the current dataset. By automatically deriving unique axis-0 partition keys from anchor columns and applying a pl7.app/axisKeys/0 annotation, this change ensures that UI components like graph-maker dropdowns accurately reflect only dataset-scoped samples. This enhancement streamlines data presentation and eliminates the need for manual filtering workarounds, improving data consistency and user experience.

Highlights

  • New Option for getAnchoredPColumns: Introduced a filterToAnchorPartitions option to the ResultPool.getAnchoredPColumns method.
  • Scoped Graph-Maker Dropdowns: Enabled graph-maker sample dropdowns to be scoped to only samples actually present in the selected dataset, preventing irrelevant samples from appearing.
  • Annotation for Axis Keys: Injected a pl7.app/axisKeys/0 annotation onto returned column specs when filterToAnchorPartitions is true, restricting the visible axis-0 key range.
  • Simplified Data Filtering: Replaced previous manual workarounds, such as extra pt join steps or chaining .filter calls, with a single declarative option.
Changelog
  • .changeset/filter-anchor-partitions.md
    • Added a new changeset file detailing the filterToAnchorPartitions option.
  • sdk/model/src/render/api.ts
    • Imported getUniquePartitionKeys from pcolumn_data.
    • Added the filterToAnchorPartitions property to the UniversalPColumnOpts interface, including JSDoc documentation.
    • Implemented a new private helper method deriveAnchorPartitionKeys to collect unique axis-0 partition keys from resolved anchors.
    • Modified getAnchoredPColumns to apply the filterToAnchorPartitions logic, annotating column specifications with pl7.app/axisKeys/0 if the option is enabled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: d21b2f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@platforma-sdk/model Minor
@milaboratories/pl-model-middle-layer Patch
@milaboratories/pf-driver Patch
@milaboratories/pl-middle-layer Patch
@milaboratories/uikit Patch
@platforma-sdk/ui-vue Minor
@milaboratories/milaboratories.monetization-test.model Patch
@milaboratories/milaboratories.monetization-test.ui Patch
@milaboratories/milaboratories.ui-examples.model Patch
@milaboratories/milaboratories.ui-examples.ui Patch
@milaboratories/milaboratories.ui-examples Patch
@milaboratories/milaboratories.pool-explorer.model Patch
@milaboratories/milaboratories.pool-explorer Patch
@platforma-sdk/block-tools Patch
@platforma-sdk/test Minor
@milaboratories/milaboratories.pool-explorer.ui Patch
@milaboratories/milaboratories.monetization-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a filterToAnchorPartitions option to getAnchoredPColumns, which is a useful feature for scoping data based on anchor partitions. The implementation is mostly solid, but I've found a potential logic issue when no partition keys are found, which could lead to incorrect behavior in downstream consumers. I've also suggested a small improvement for maintainability. Overall, these are valuable changes.

…tion

Signed-off-by: Paul Newling <paulnewling@gmail.com>
@PaulNewling
Copy link
Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a filterToAnchorPartitions option to getAnchoredPColumns to scope partition keys based on anchor columns. The implementation is logical and correctly handles data readiness by propagating undefined. I have two suggestions for minor improvements: one to remove a redundant line of code for simplification, and another to add an early return for a micro-optimization. Please see the detailed comments.

@PaulNewling PaulNewling requested a review from dbolotin March 13, 2026 17:35
@PaulNewling PaulNewling marked this pull request as ready for review March 13, 2026 17:35
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.50%. Comparing base (06ddea8) to head (d21b2f7).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sdk/model/src/render/api.ts 87.50% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1514      +/-   ##
==========================================
+ Coverage   54.37%   54.50%   +0.13%     
==========================================
  Files         242      242              
  Lines       13686    13701      +15     
  Branches     2820     2827       +7     
==========================================
+ Hits         7442     7468      +26     
+ Misses       5310     5291      -19     
- Partials      934      942       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Paul Newling <paulnewling@gmail.com>
Signed-off-by: Paul Newling <paulnewling@gmail.com>
@dbolotin dbolotin requested a review from AStaroverov March 14, 2026 12:08
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