Repository navigation
Declare discrete values on metadata columns - #135
Merged
kevindetry-milaboratories merged 1 commit intoSep 24, 2026
Merged
Conversation
Every metadata column with at least one value now carries two annotations: - `pl7.app/isDiscreteFilter`: `"true"` - `pl7.app/discreteValues`: the distinct values of the column, as a JSON array of strings Numbers sort in numeric order, other values in string order. Downstream blocks such as Graph Maker and repertoire-labeling can offer the column as a discrete filter or a grouping property without a read of its data. The values come from the block args, so no data resource is read. The set is sorted from Go-map iteration order, never from a pre-sorted list, since `slices.quickSortInPlace` recurses O(n) deep on sorted input. Also includes the `upgrade-sdk` changes and a Tengo unit test for the new functions.
kevindetry-milaboratories
deleted the
kevindetry/metadata-discrete-values
branch
September 24, 2026 10:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every metadata column with at least one value now carries two annotations:
pl7.app/isDiscreteFilter:"true"pl7.app/discreteValues: the distinct values of the column, as a JSON array of stringsNumbers sort in numeric order, other values in string order. Downstream blocks such as Graph Maker and repertoire-labeling can offer the column as a discrete filter or a grouping property without a read of its data.
The values come from the block args, so no data resource is read. The set is sorted from Go-map iteration order, never from a pre-sorted list, since
slices.quickSortInPlacerecurses O(n) deep on sorted input.Also includes the
upgrade-sdkchanges and a Tengo unit test for the new functions.The PR appears safe to merge, with a non-blocking performance and usability concern for high-cardinality metadata columns.
Fix with agent prompt
Summary
This PR derives sorted, distinct metadata values from block arguments and publishes them as PColumn annotations so downstream blocks can configure filters and grouping without reading column data. It also adds Tengo tests and applies the associated Platforma SDK structure and dependency upgrades.
discreteValuesandmetadataColumnSpec, then uses them for exported metadata columns.Important touched terms
MTColumn/ metadata column: A typed per-sample field represented by a sample-ID-to-value map. Its exported specification now receives discrete-value annotations when it contains values.PColumnspecification: The schema describing an exported platform column, including type, domain, axes, and annotations. Metadata PColumn construction is now centralized inmetadataColumnSpec.pl7.app/isDiscreteFilter: An annotation indicating that downstream blocks may treat a column as a discrete filter. It is now set to"true"on every nonempty metadata column.pl7.app/discreteValues: A JSON-encoded array of distinct string representations available in the column. It is now computed from block arguments and attached to the PColumn specification.discreteValues: The new Tengo helper that deduplicates values, skipsundefined, sorts numeric columns numerically, and returns strings.ll.toStrict: The workflow SDK helper used to expose a strict module object. The metadata module now uses it while exporting the new helpers alongsidecreateMetadata..structuremoves from version 2 to version 3.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["Block args: MTColumn.data"] --> B["discreteValues"] B --> C{"Any values?"} C -- Yes --> D["Add isDiscreteFilter and discreteValues annotations"] C -- No --> E["Keep label annotation only"] A --> F["createJsonPColumnData"] D --> G["Exported metadata PColumn"] E --> G F --> G G --> H["Downstream filtering and grouping"]Reviews (1) · Last reviewed commit: "Declare discrete values on metadata colu..."