Column Row Pipeline Roadmap
Status: Implementation roadmap for Column Row Pipeline Design.
Phases 1-6 and 9a-9g are implemented. Phase 7 and preset-library work (Phase 10) remain planned.
This roadmap breaks the per-column row-pipeline refactor into small, testable steps. The design goal is to let each tensor column derive its own row-aligned gather inputs through TransformPipelines while keeping GatherResult a container/direct-gather executor rather than a pipeline runner.
End State
The refactor is complete when:
ColumnRecipehas an optionalrow_pipeline_jsonfield.- TensorDesign JSON parse/serialize round-trips
row_pipeline_json. - Empty
row_pipeline_jsonpreserves the current full-interval behavior. - A row pipeline can produce
DigitalIntervalSerieswindows that are passed toGatherResultas prepared windows. - A column pipeline can receive row-specific values through
PipelineValueStore, such as one normalization event per row. - Per-column gather geometry can differ across columns while row identity and
RowDescriptorremain tied to the original row source. - Onset-window spike presence and onset-sampled analog covariates are expressible in JSON.
- Common workflows are available through discoverable presets so users do not need to remember raw transform or binding keywords.
- The temporary
pipeline_json"offset"sample-at-offset path is removed or replaced by row-pipeline behavior. - Tests cover identity behavior, onset windows, point sampling, overlapping windows, cross-timeframe gather, and invalid row-count changes.
Current Inventory
Implemented foundations:
GatherResult::create(source, windows, alignment_points)accepts prepared windows and optional alignment events for existing direct-gather consumers.GatherResult::fromRows()andfromRowsLike()support row-aligned DataObject results from external pipeline helpers.DigitalIntervalSeries::createOverlapping()preserves overlapping gather windows.IntervalToEventconverts interval rows to events.EventToIntervalconverts events to overlapping windows.PruneOverlappingIntervalsprovides explicit keep-first overlap pruning.buildIntervalPipelineProvider()gathers over interval rows and applies range reductions.buildPipelineColumnProvider()handles timestamp-row columns.TensorDesignBuilderbuilds lazy-column tensors from JSON.ColumnRecipe::row_pipeline_jsonis parsed and serialized.resolveIntervalGatherWindows()resolves identity andDigitalIntervalSeriesrow-pipeline output.buildProviderFromRecipe()uses row-pipeline windows for interval-row columns.- Digital event/interval views expose
ClockTicks-based API-facing elements. PipelineValueStorestoresClockTicks, andNormalizeTimeParamsV2::alignment_timeisClockTicks.gatherAndExecutePipeline()executes JSON-loaded pipeline steps, including container steps, on each gathered row before applying the terminal range reduction.NormalizeDigitalEventSeriesRelativenormalizes a gatheredDigitalEventSeriesinto relativeClockTicksstorage while preserving eventEntityIds.ColumnRecipe::pipeline_value_bindingsis parsed, serialized, and used to bind one row-alignedDigitalEventSeriesvalue intoPipelineValueStoreper tensor row.- Direct binding sources from DataManager keys and derived binding sources using
source_pipeline_jsonare supported when they resolve to row-alignedDigitalEventSeriesobjects. - Interval-row columns can dispatch
DigitalEventSeriesrow-pipeline output as sample times for timestamp-style providers. ShiftDigitalEventSeriesshiftsDigitalEventSeriessample times and replaces the temporary top-levelpipeline_json"offset"compatibility path.- Angle-at-contact-onset point sampling is tested through TensorDesign JSON in the whisker-contact scenario.
- Contact-aligned spike presence is tested through TensorDesign JSON in the whisker-contact scenario.
Known gaps:
- There is no row-pipeline caching.
- UI does not expose row-pipeline configuration.
- The Phase 9c column recipe preset registry exists with a compiled preset set and TensorDesigner Add Preset… support.
- The Phase 9d design authoring preset registry exists with a compiled
whisker_contact_feature_tablepreset and TensorDesigner Apply Table Preset… support. - There is no broader preset JSON/file library yet.
Phase 1: Baseline Tests — Done
Goal: lock down current behavior before adding row-pipeline dispatch.
Tasks:
- Add or verify tests for interval-row tensors gathering over the full row interval.
- Add or verify tests for
interval_propertycolumns. - Add or verify tests for timestamp row columns.
- Add a characterization test for the current
pipeline_json"offset"behavior if it must remain during the transition. - Confirm cross-timeframe interval-row gather behavior through
GatherResultquery conversion.
Exit criteria:
- Existing JSON without
row_pipeline_jsonis covered. - Current behavior can be compared against the post-refactor identity path.
Suggested test areas:
tests/TensorDesign/tests/TransformsV2/TensorColumnBuilders tests- Whisker-contact scenario tests
Phase 2: Add Recipe Field And JSON Round Trip — Done
Goal: make row_pipeline_json part of the data model without changing provider behavior.
Tasks:
- Add
std::string row_pipeline_jsontoColumnRecipe. - Parse
columns[].row_pipeline_jsoninTensorDesignBuilder. - Serialize
row_pipeline_jsononly when non-empty, unless existing conventions prefer explicit empty fields. - Update docs for
TensorDesignBuilder.qmdandTensorColumnBuilders.qmd. - Add JSON parse/serialize tests.
Exit criteria:
- Existing JSON remains valid.
- New JSON round-trips
row_pipeline_json. - No provider behavior changes yet.
Phase 3: Row Pipeline Execution Skeleton — Done
Goal: execute an empty or identity row pipeline and route through existing providers.
Tasks:
- Define the row-pipeline execution boundary in TensorColumnBuilders or a small helper.
- Treat empty
row_pipeline_jsonas identity. - For interval row sources, identity returns the original
DigitalIntervalSeriesas prepared windows. - Verify row count matches the original row source.
- Keep
interval_propertycolumns on their current no-gather path.
Exit criteria:
- Identity row-pipeline output produces exactly the same values as current full-interval gather.
- No new transform requirements are introduced.
Phase 4: DigitalIntervalSeries Output Dispatch — Done
Goal: support row pipelines that output prepared DigitalIntervalSeries windows.
Tasks:
- Execute row pipelines that return
DigitalIntervalSeries. - Require output size to match original row count.
- Pass the output as prepared windows to the existing interval gather provider path.
- Preserve the original
RowDescriptorfrom the row source. - Ensure overlapping output windows are not merged.
- Add tests using
EventToIntervalover event row sources orIntervalToEventfollowed byEventToIntervalwhere possible.
Exit criteria:
- A column can gather over row-pipeline-produced windows.
- Overlapping windows produce one tensor row per original row.
- Cross-timeframe gather still passes through
GatherResultconversion.
Phase 5: Iterable PipelineValueStore Bindings
Status: done. The gathered-row execution path supports container-step pipelines before terminal range reduction, NormalizeDigitalEventSeriesRelative provides container-level DigitalEventSeries -> DigitalEventSeries normalization, and pipeline_value_bindings supplies row-specific ClockTicks values through PipelineValueStore.
Goal: supply per-row values to pipeline_json transforms through the existing TransformsV2 PipelineValueStore mechanism without making row_pipeline_json responsible for normalization markers.
Motivating example: gather Spikes into one DigitalEventSeries per trial/contact interval, then execute a TransformPipeline containing NormalizeTime on each gathered row. The normalization time comes from a row-aligned DigitalEventSeries, such as ContactOnset, or from Contact -> IntervalToEvent(start). The event for row i is written into PipelineValueStore as ClockTicks and bound to the NormalizeTime parameter for row i.
Tasks:
Completed tasks:
- Allow gathered row execution to run JSON-loaded container steps before terminal range reduction.
- Add
NormalizeDigitalEventSeriesRelativeas the container-level normalize transform for gatheredDigitalEventSeriesrows. - Cover container-step-before-reduction behavior with a TensorColumnBuilders test using
EventCountInWindowafter normalization. - Define a JSON schema for iterable bindings from DataObjects into
PipelineValueStorekeys:pipeline_value_bindings[]withsource_key, optionalsource_pipeline_json, andstore_key. - Support direct iterable sources from DataManager keys with implicit identity source pipeline.
- Support derived iterable sources from a DataManager key plus
source_pipeline_json. - Start with
DigitalEventSeriesbinding intoPipelineValueStoreasClockTicksfrom the event returned byDigitalEventSeries::view(). - Defer
DigitalIntervalSeriesbinding. UseIntervalToEventinsource_pipeline_jsonfor start/end/center selection. - Build one store value per tensor row from the resolved iterable DataObject.
- Inject the current row’s values into
PipelineValueStorebefore applyingpipeline_jsonparameter bindings. - Verify a normalize-time transform uses the bound store value, not the gather window start.
- Add raster/PSTH-style tests where spikes are gathered in trial windows and normalized to a separate event per row.
- Add row-count mismatch tests for direct iterable sources.
Exit criteria:
- Per-row transforms can consume a marker that is outside the gathered DataObject through parameter bindings.
- Trial-relative transforms can consume correct marker times.
- Iterable binding sources are explicit and row-count checked.
- Direct-key iterable bindings and key-plus-pipeline iterable bindings are both covered by tests.
NormalizeTimeaccepts aClockTicksbinding and subtracts in clock-tick coordinates.- Phase 5 tests use the same DataObject
view()element types that normal TransformPipeline execution uses.
Settled design choices:
- Iterable binding declarations live on
ColumnRecipe, besidepipeline_json. source_pipeline_jsonuses the samePipelineDescriptorschema asrow_pipeline_jsonandpipeline_json.- Iterable binding
store_keyvalues must not overwrite other keys; duplicates are rejected. - Temporal iterable values should be bound as
ClockTicks, not rawTimeFrameIndexvalues. PipelineValueStorestoresClockTicksdirectly.NormalizeTimeParamsV2::alignment_timeisClockTicksand binds throughClockTicksReflector.NormalizeClockTicksValueV2is the canonical pipeline transform for DigitalEventSeries value projections;ClockTicksWithIdis reduced toClockTicksby the projection helper before pipeline execution.NormalizeDigitalEventSeriesRelativeis the canonical container-level transform when the gathered row should remain aDigitalEventSerieswith relativeClockTicksvalues before reduction or export.- Existing
PipelineValueStore, parameter bindings, and gather extension helpers should be reused or generalized to bind iterable values per row. - User-facing presets should hide the distinction between
ClockTicksWithIdandClockTicksnormalize transforms whenever possible.
Phase 6: Timestamp And Point Sampling — Done
Goal: replace the temporary "offset" sample-at-offset path with row-pipeline-driven point sampling.
Tasks:
- Support row pipelines that produce
DigitalEventSeriessample times without interval windows. - Route event output to timestamp/sample provider behavior.
- Define how optional offsets are expressed as transforms rather than top-level ad hoc JSON.
- Remove the
pipeline_json.find("\"offset\"")compatibility path fromTensorDesignBuilder::buildColumnProvider()once tests cover the replacement. - Add angle-at-onset tests for the whisker-contact scenario.
Exit criteria:
- Point sampling is expressible through row-pipeline JSON.
- The offset string-search path is gone.
- Existing sample-at-offset behavior is preserved where intended.
Implemented notes:
resolveIntervalRowPipelineGeometry()resolves interval-row pipelines to eitherDigitalIntervalSeriesgather windows orDigitalEventSeriessample times.buildProviderFromRecipe()routesDigitalEventSeriesrow-pipeline output to timestamp/sample provider behavior when the column pipeline has no terminal range reduction.ShiftDigitalEventSeriesexpresses sample offsets as a regular TransformPipeline step.- The old top-level
pipeline_json"offset"detection path has been removed. - Tests cover provider-level analog sampling at interval starts, shifted sample times, and TensorDesign JSON replacing the old offset behavior.
Phase 7: Optional Additional Row Transforms
Goal: add only the transforms needed by concrete analyses.
Candidate transforms:
IntervalShiftfor lag/lead interval windows.- Data-derived event transforms that produce one event per row from a row interval plus another source object.
- Optional fused convenience transforms if repeated JSON patterns become too verbose.
Tasks:
- Add one transform at a time under
src/TransformsV2/algorithms/. - Ensure output DataObjects preserve or intentionally set
TimeFrame. - Use
DigitalIntervalSeries::createOverlapping()for window-like interval outputs. - Add focused transform tests.
- Add one TensorDesign integration test per new analysis pattern.
Exit criteria:
- New transforms are generally useful outside TensorDesign.
- TensorDesign does not gain tensor-specific geometry enums.
Phase 8: Whisker-Contact Integration — Done
Goal: prove the design on the motivating analysis table.
Status: done for the motivating whisker-contact feature table. TensorDesign JSON covers full-contact curvature, full-contact spike count, contact-onset spike presence, and angle-at-onset point sampling. Trial-relative raster/PSTH examples are now tracked as preset/example-library work in later phases rather than as a blocker for this integration phase.
Tasks:
Extend the whisker-contact scenario with contact onset features.Done for onset spike presence.Add a full-contact curvature column.Done.Add a spike-in-onset-window column.Done.Add an angle-at-onset column after timestamp/sample row-pipeline dispatch is implemented.Done.Verify row count, row descriptors, and expected values.Done.Update scenario documentation with valid JSON.Done.
Exit criteria:
- Contact-aligned spike presence is built through production TensorDesign code.
- Angle-at-contact-onset point sampling is built through production TensorDesign code.
- The JSON example in the whisker-contact scenario documentation is a working example of the motivating feature table.
Test Coverage Notes
Current row-pipeline coverage is split across four files:
tests/TransformsV2/test_tensor_column_builders.test.cppcovers the TransformsV2 provider layer,resolveIntervalGatherWindows()behavior, and Phase 5 direct/derivedpipeline_value_bindingsexecution.tests/TensorDesign/test_tensor_design_builder.cppcovers TensorDesign JSON parsing, serialization, JSON-to-tensor builds, and Phase 5 end-to-end bound normalization through fully specified JSON.tests/TransformsV2/test_tensor_whisker_contact_scenario.cppcovers programmatic provider/lazy tensor construction over the whisker-contact fixture.tests/TensorDesign/test_tensor_whisker_contact_scenario.cppcovers the TensorDesign JSON path over the same fixture, including contact-aligned spikes.
The two whisker-contact files are not exact duplicates. They exercise different architectural layers. The older TransformsV2 file does not validate row_pipeline_json; it remains useful as lower-level integration coverage, though it may be a candidate for reduced assertions if runtime becomes an issue.
Potential stale or missing coverage after Phase 8:
DigitalEventSeriesrow-pipeline output rejection is covered at the row-geometry/helper layer; add a TensorDesign JSON-level rejection test if error messages become part of the user contract.- Add explicit tests for malformed but non-empty
row_pipeline_jsonat the TensorDesign JSON build layer if not already covered by provider tests. - Add a derived binding row-count mismatch test if direct mismatch coverage is not considered sufficient.
- Add cache behavior tests when row-pipeline caching is introduced.
Phase 9a: TimeFrame Row Source — Done
Goal: allow tensors with one row per index in a named TimeFrame, without requiring a synthetic data object.
Status: done. TensorDesign supports row_type: "timeframe" with row_source.time_key, and TensorDesigner exposes a TimeFrame Rows mode populated from DataManager::getTimeFrameKeys().
Tasks:
- Add
RowType::TimeFrameor equivalent to TensorDesign row source parsing. - Extend row-source JSON with a
time_keyfield distinct fromdata_key. - Build row descriptors from every index in the selected
TimeFrame. - Add TensorDesigner UI support for a TimeFrame Rows mode populated from
DataManager::getTimeFrameKeys(). - Keep Timestamp Rows data-object based (
DigitalEventSeries) and clarify Derived from Source as “derive rows from timestamps in a data object”. - Add tests for TimeFrame rows sampling analog data.
- Add UI tests that TimeFrame row sources appear separately from timestamp-event row sources.
Implemented notes:
- TensorDesign JSON uses
row_source.time_keyfor TimeFrame rows. serializeDesignJson()omitsdata_keyfor TimeFrame row sources.- Backend tests cover parsing, serialization, and analog sampling over all TimeFrame rows.
- TensorDesigner load-config tests cover building a tensor from TimeFrame rows.
Exit criteria:
- Users can build frame-aligned tensors directly from a TimeFrame key.
- TensorDesigner no longer implies that a
DigitalEventSeriesis the only way to create timestamp-like rows. - Existing timestamp and derived-from-source behavior is unchanged.
Phase 9b: Point And Keypoint Column Primitives — Done
Goal: support common keypoint feature tables without tensor-specific geometry enums.
Status: done. PointCoordinate converts PointData to RaggedAnalogTimeSeries using a coordinate parameter, and TensorDesign JSON can build x/y keypoint columns over TimeFrame rows.
Tasks:
- Add
PointCoordinateas a parameterized container transform (PointData -> RaggedAnalogTimeSeries) withcoordinate = x | y. - Register the transform with TransformsV2 JSON loading and parameter schema infrastructure.
- Add transform tests for point coordinate extraction.
- Document timestamp sampling semantics for
RaggedAnalogTimeSeriesoutput: single-keypoint data uses the first/only value; multi-point-per-time data needs an explicit policy before broad use. - Add TensorDesign tests for
PointDatarows fromDerivedFromSourceproducing x/y columns. - Add TensorDesign tests for TimeFrame rows sampling
PointDatainto x/y columns after Phase 9a. - Add interval-row tests reducing point coordinate values with a standard range reduction.
- Add TensorDesigner UI/load-config tests for a PointData x/y tensor once TimeFrame rows are available.
Implemented notes:
PointCoordinateis implemented as one container transform withcoordinate = X | Y.- TensorDesign tests cover TimeFrame rows sampling one-keypoint-per-time
PointDatainto x/y columns. - Sparse TimeFrame sampling is covered for analog data and produces
NaNwhere no source sample exists. - Additional DerivedFromSource, interval-reduction, and TensorDesigner UI tests remain useful follow-up coverage but are not required to prove the primitive path.
Exit criteria:
- A
PointDatakeypoint can produce scalar x and y tensor columns through normal TransformPipeline JSON using one parameterized transform. - Multiple keypoint tables can be represented by repeating the same primitive column recipes.
- The primitive transforms remain useful outside TensorDesign.
Phase 9c: Column Preset Registry And Expansion
Goal: provide friendly recipe generators that expand user-supplied parameters into raw ColumnRecipe objects, avoiding manual embedded JSON authoring. Presets are for authoring convenience; saved designs remain expanded raw TensorDesign JSON.
Status: done. ColumnRecipePresetRegistry is implemented in src/TensorDesign with the Phase 9c compiled preset set. Focused expansion tests cover raw recipe output, TensorDesign JSON tests verify both JSON-authored preset invocations and selected expanded presets through buildTensorFromDesignJson(), and TensorDesigner exposes Add Preset… to append expanded raw recipes. This phase does not add preset files or user/bundled preset catalogs; those are Phase 10.
Tasks:
Add aStarted with a TensorDesign-side registry.ColumnRecipePresetRegistryor equivalent registry in the TensorDesign/TransformsV2 boundary.Define preset descriptors with name, display name, description, parameter schema, source (Started for compiled presets.Built-inorUser), and expansion function/template.Preset expansion must return a list ofDone in the expansion type.ColumnRecipes, not a single recipe, so grouped features can be appended atomically.Add presets for the initial common workflows:Done.mean over intervalDone.event count over intervalDone.event presence around interval startDone.analog sample at interval startDone.point x/y for one keypointDone.point x/y for multiple keypointsDone.point x/y sampled at interval startDone.raster events relative to interval startDone.trial-relative event times using NormalizeTime with row-specificDone asClockTicksbindingstrial_relative_event_count_from_interval_start.
Expand preset JSON into rawDone for compiled built-in presets inColumnRecipefields before provider construction.parseDesignJson().Add tests that preset expansion produces the same tensor values as equivalent raw recipes.Done through focused expansion tests and TensorDesign JSON build tests.Add TensorDesigner UI support for Add Preset… that appends all expanded columns.Done.Save expanded raw recipes only after presets are applied; preset invocations are not required for execution.Done throughTensorDesigner::toJson()/serializeDesignJson().Reject duplicate preset IDs across built-in and user presets for the initial implementation.Done for registry registration.
Exit criteria:
- Users can express the whisker-contact examples without raw transform names.
- Users can add keypoint x/y column groups without manually authoring repeated
PointCoordinatepipelines. - Presets are discoverable from a registry that can be reused by documentation and UI.
- Raw JSON remains available for advanced workflows.
- Saved designs remain reproducible expanded TensorDesign JSON and do not depend on the preset registry at load time.
Phase 9e: Decoupling Row Modifiers and Column Aggregators
Status: done.
Goal: Prevent combinatorial explosion of monolithic presets (e.g., analog_sample_at_interval_start, event_presence_around_interval_start) by splitting the registry into two composable domains: Row Modifiers and Column Aggregators.
Tasks:
IntroduceDone. RowModifiers also support emittingRowModifierRegistry. This registry provides descriptors that outputrow_pipeline_jsonand declare the resulting Effective Row Type (e.g., Interval -> Event, Interval -> Interval).pipeline_value_bindings.IntroduceDone.ColumnAggregatorRegistry. This registry provides descriptors that outputpipeline_jsonand optionalpipeline_value_bindings. These are filtered based on the Effective Row Type and Target Data Type.RefactorDone. Handled natively inColumnRecipePresetRegistry(or create a UI “Stitcher” equivalent) to seamlessly combine a selected Row Modifier and a Column Aggregator into one or moreColumnRecipes.TensorDesignBuilderjson parsing.Carefully untangle multi-input presets (likeDone.multi_point_xy_at_interval_start):The UI Stitcher must handle cases where the Column Aggregator accepts a list ofsource_keys(e.g., multiple keypoints).For each input key, the Stitcher generates a distinctColumnRecipe, applying the samerow_pipeline_json(from the Row Modifier) to each.
Create a two-step UX flow in TensorDesigner:(Deferred to UI layer)Step A (Optional): Select a Row Modifier (filtered by top-level row strategy).Step B (Required): Select a Target Data Series and Column Aggregator (filtered by the Effective Row Type from Step A).
Write tests ensuring that a composed Modifier + Aggregator yields the exact same JSON as the older monolithic presets.Done.
Exit criteria:
- Users can independently mix and match row gather geometry (like “Onset Window”) with data extraction logic (like “Mean”, “Event Count”) without requiring a custom C++ preset for every combination.
- Multi-input workflows (like expanding 5 keypoints at interval onset) remain fully supported and generate the correct Nx2
ColumnRecipes. - The UI successfully hides the complexity of building two coordinated JSON pipelines.
Phase 9f: Two-Step UI Column Stitcher
Status: planned.
Goal: Provide an intuitive UI in TensorDesigner for building modular columns without requiring users to write raw JSON or use monolithic presets. This phase implements the frontend encapsulation of Phase 9e’s decoupled backend.
Tasks:
- Backend Registry Metadata (UI-Independent):
- Introduce an
EffectiveRowTypeenum (e.g.,Interval,Event) in the C++ backend. - Update
RowModifierDescriptorto declare itsoutput_row_type. - Update
ColumnAggregatorDescriptorto declare itssupported_row_types(e.g., Event Rate only supportsInterval). - Add query methods to the registries (e.g.,
ColumnAggregatorRegistry::getAggregatorsFor(AggregatorQueryContext)) so the UI remains stateless and driven purely by the backend composition rules.
- Introduce an
- Create a Two-Step Column Builder Dialog (replacing or augmenting the existing
ColumnConfigDialog).- Step A: Row Modification (Optional). Prompt: “Do you want to modify the row before extracting data?”
- Populate a dropdown from the
RowModifierRegistry. - Internally track the Effective Row Type resulting from this modifier (queried from the backend descriptor).
- Populate a dropdown from the
- Step B: Data Aggregation (Required). Prompt: “What data do you want to extract?”
- Populate a dropdown from the
ColumnAggregatorRegistry, dynamically filtered by querying the backend with the Effective Row Type from Step A.
- Populate a dropdown from the
- Step A: Row Modification (Optional). Prompt: “Do you want to modify the row before extracting data?”
- The “Custom/Raw” Escape Hatch:
- In Step B (or as a top-level toggle), include an “Advanced / Custom Pipeline” option.
- When selected, instead of showing a preset
AutoParamWidget, the UI embeds the fullTransformPipelineEditor(or a raw JSON text box). - This allows users to author completely novel aggregations block-by-block without needing a preset to exist.
- Implement the UI Stitcher logic. When the user confirms the dialog, generate the
ColumnRecipeby:- Calling
expand()on the selected descriptors. - Stitching them together into a final set of
ColumnRecipes, just as the JSON backend does, and appending them to theTensorDesignercolumn list.
- Calling
- Add frontend tests for the UI Stitcher logic to ensure that selecting specific combinations yields the exact same raw
ColumnRecipes as the JSON backend.
Exit criteria:
- Users can mix and match row geometries (Step A) with data extraction logic (Step B) using a guided, wizard-like UI.
- The UI safely prevents illegal combinations (e.g., Range Reduction on an Event row) by filtering Step B options based on Step A’s output.
- Combinatorial explosion of UI presets is completely eliminated; the UI is highly composable.
- The
TensorDesignerlist view accurately displays the generated columns.
Phase 9g: Polymorphic Preset Architecture and JSON DTOs
Status: done.
Goal: Refactor the monolithic ColumnRecipePresetRegistry into a modular architecture that separates behavioral execution (the Strategy pattern) from serialization (Flat DTOs for reflect-cpp). This allows complex presets to be defined in their own C++ files with custom UI callbacks, while enabling simple presets to be data-driven.
Tasks:
- Define Polymorphic Interfaces:
- Create
IRowModifierandIColumnAggregatorbase classes replacing thestd::functionstructs. - Include standard metadata methods (
id(),parameters(),expand()). - Include optional UI hook methods (e.g.,
virtual std::vector<std::string> getDynamicOptions(std::string const& field_name) const) to support dynamicAutoParamcombo boxes without hardcoding UI logic into the registry.
- Create
- Refactor Existing Complex Presets:
- Extract complex presets (like
MultiPointXyAggregator) into their own.hpp/.cppfiles implementing the new interfaces. - Update the registry to store
std::unique_ptr<IColumnAggregator>andstd::unique_ptr<IRowModifier>.
- Extract complex presets (like
- Define Flat DTOs for JSON Presets:
- Create
JsonColumnPresetDto(and a Row Modifier equivalent) as flat, inheritance-free structs designed specifically forreflect-cppparsing. These structs will holdid,ParameterSchema, and raw JSON template strings (e.g.,pipeline_json_template).
- Create
- Implement the JSON Preset Strategy:
- Create a
JsonColumnAggregator : public IColumnAggregatorclass that accepts a parsedJsonColumnPresetDtoin its constructor. - Implement
expand()to perform simple string replacement, injecting user-provided parameters into the DTO’s JSON templates.
- Create a
Exit criteria:
- The registry monolithic file is eliminated; presets are modularized into independent files.
reflect-cppserialization boundaries are strictly separated from C++ behavioral polymorphism.- Custom C++ presets can provide specialized UI behaviors (like populating data keys) via interface methods.
- The foundation is laid to load simple presets from JSON files (Phase 10).
Phase 11: Documentation And UI Follow-Up
Goal: update public developer docs and decide how users configure row pipelines.
Tasks:
- Update
TensorDesignBuilder.qmdwith the implementedrow_pipeline_jsoncontract. - Update
TensorColumnBuilders.qmdwith provider dispatch behavior. - Update
tensor_stack.qmdstatus language. - Update test scenario docs.
- Add UI support for browsing bundled and user column presets in TensorDesigner, with raw JSON available as an advanced option.
Exit criteria:
- Docs clearly distinguish implemented behavior from future work.
- UI work can proceed without changing the core data model.
Verification Checklist
- Existing JSON without
row_pipeline_jsonproduces unchanged tensors. - Empty
row_pipeline_jsonis identity. row_pipeline_jsonround-trips through parse and serialize.- DIS row-pipeline output must match source row count.
- DES sample-time output must match source row count.
- Iterable binding sources must match source row count.
- Overlapping windows remain separate rows.
- Generated gather windows use
IntervalLayout::Overlappingwhere needed. - PipelineValueStore-backed normalization uses the marker for the current row, not the gather window start.
- Cross-timeframe gathers match expected source query bounds.
interval_propertycolumns remain source-gather-free.- The offset string-search compatibility path is removed after replacement.
- Preset expansion and equivalent raw recipes produce the same values.
- Bundled and user preset library entries load and expand correctly.
Suggested Build And Test Commands
Determine the configured CMake preset from out/build/ before running these commands.
List candidate tests:
ctest --preset linux-clang-release -N | grep -i "tensor"Run focused TensorDesign tests:
ctest --preset linux-clang-release --output-on-failure -R "TensorDesign|TensorColumnBuilders|whisker_contact" > test_log.txt 2>&1After C++ changes, run clang-format and clang-tidy on touched C++ files following the repository development workflow.