H5 and mat files visualisable, read path from workflow.yaml#990
H5 and mat files visualisable, read path from workflow.yaml#990milesAraya merged 2 commits intodevelop-featurefrom
Conversation
| <PlotlyChart data={plotData} layout={layout} /> | ||
| {data.length > 1 && ( | ||
| <Box px={2}> | ||
| <Slider |
There was a problem hiding this comment.
The Play slider's style is slightly different from existing image plots, etc. Is that okay?
*While it may not be extremely important, I think keeping the UI somewhat similar will make it easier for users to understand.
There was a problem hiding this comment.
Replaced the simple with the full PlayBack pattern from ImagePlot — Play/Pause buttons, msec/frame TextField, and the same with marks, valueLabelDisplay="auto", and step={1}.
| const DEFAULT_START_INDEX = 0 | ||
| const DEFAULT_END_INDEX = 10 | ||
|
|
||
| export const StructuredFilePlot = memo(function StructuredFilePlot() { |
There was a problem hiding this comment.
The plotting of various images is good.
Also, it might be useful to display the internal paths of the structured data along with the plot.
*Please skip this suggestion if it's not particularly useful.
There was a problem hiding this comment.
Backend now returns dataset_path (e.g. data/image, data/behavior) in every response. The component shows it as a caption above the plot.
frontend/src/components/Workspace/Visualize/Plot/StructuredFilePlot.tsx
Outdated
Show resolved
Hide resolved
| const DEFAULT_START_INDEX = 0 | ||
| const DEFAULT_END_INDEX = 10 | ||
|
|
||
| export const StructuredFilePlot = memo(function StructuredFilePlot() { |
| <PlotlyChart data={plotData} layout={layout} /> | ||
| {data.length > 1 && ( | ||
| <Box px={2}> | ||
| <Slider |


Content
Summary
GET /outputs/structured/{workspace_id}/{unique_id}/{node_id}) reads the dataset path (hdf5Path/matPath) from the savedworkflow.yamland returns the data with automatic type detection (1D -> bar, 2D -> timeseries, 3D -> images).start_index/end_index) matching the existing TIFF pattern, loading 10 frames at a time to avoid multi-megabyte JSON responses.StructuredFilePlotfrontend component renders the data using Plotly (line chart for timeseries, heatmap with slider for images, bar chart for 1D).Design Decisions
workflow.yamlinstead of re-uploading data -- The workflow config already stores the file path and dataset path (hdf5Path/matPath) for each input node. The endpoint resolves the data at request time from these saved references, avoiding duplication.start_index/end_indexpattern used by the TIFF image endpoint is applied. Default window is 10 frames.ndimdetermined before slicing -- The original array dimensionality is captured before any pagination slicing so the responsedata_typeis always correct.total_framesis returned for 3D data so the frontend knows the full dataset size.itemIdnotfilePath-- Unlike other display data types that use file paths as Redux keys, structured data uses the visualise item ID. This avoids collisions when the same input file appears in multiple visualise items.StructuredFilePlotfollowsImagePlotpatterns -- UsesLinearProgressfor loading,useEffectfor data fetching with the same guard pattern (workspaceId && uid && nodeId), andPlotlyChartfor rendering.Evidence
References
GET /outputs/image/{filepath}?start_index=1&end_index=10Files changed
Backend
studio/app/common/routers/outputs.py-- NewGET /outputs/structured/endpoint with pagination support for 3D data; readshdf5Path/matPathfrom workflow configFrontend
frontend/src/api/outputs/Outputs.ts-- NewStructuredDatatype andgetStructuredDataApifunction withstartIndex/endIndexparamsfrontend/src/store/slice/DisplayData/DisplayDataActions.ts-- NewgetStructuredDataasync thunkfrontend/src/store/slice/DisplayData/DisplayDataSlice.ts-- Reducers for structured data (pending/fulfilled/rejected) and cleanup handling for HDF5/MATLAB typesfrontend/src/store/slice/DisplayData/DisplayDataType.ts-- NewStructuredDisplayDatainterface andstructuredstate fieldfrontend/src/components/Workspace/Visualize/Plot/StructuredFilePlot.tsx-- New component: fetches structured data and renders as timeseries (line), images (heatmap + slider), or bar chartfrontend/src/components/Workspace/Visualize/DisplayDataItem.tsx-- RouteHDF5/MATLABdata types toStructuredFilePlotfrontend/src/components/Workspace/Visualize/VisualizeItemEditor.tsx-- Add HDF5/MATLAB to SaveFig editor casesTests
studio/tests/app/common/routers/test_structured_outputs.py-- New: 11 tests covering HDF5 (1D/2D/3D), MAT files, pagination, default params, and error cases (missing workflow/node/file, bad dataset path, no hdf5Path/matPath)frontend/src/components/Workspace/__tests__/Experiment/ExperimentTable.test.tsx-- Addedstructured: {}to mock DisplayData stateManual Testcases
sample_hdf5.h5-- verify a heatmap image renders with a frame slider (10 frames loaded)sample_matlab.mat-- verify a timeseries line chart renders (500 rows x 8 columns)make test_backend-- all backend tests pass (including 11 structured output tests)make test_frontend-- all 17 frontend test suites pass (79 tests)Unit, Integration, Contract Test Coverage
Others
Difficulties
.env.development) was configured for ports 3001/8001 butdocker-compose.dev.multiuser.ymlmapped port 3000, causing the dev server to be unreachable. This made it appear that code changes weren't taking effect when the user was accessing the app through the backend's production build (port 8000) instead.Risk Assessment
structuredstateStructuredFilePlotcomponentMatGetterMatGetter.data()which is already used by the/mat/endpoint