feat(view): export plotted data (CSV/XLSX) and plot (HTML) - #5
Merged
Conversation
Add a dashboard-level Export section (compact collapsible card in Plot Controls) with three FileDownload actions on BaseDataView: - Download CSV / XLSX: a unit-aware, pint-pandas table of every checked channel. Numeric channels become pint columns (in the selected display unit); text-log channels become plain object columns; a tolerant dequantify writes a two-row (label, unit) header. Rows are capped at EXPORT_MAX_ROWS via uniform downsampling. Composite sub-fields get unique labels, with a dedupe safety net so duplicate names cannot collapse a column into a DataFrame. - Download plot (HTML): a standalone interactive Bokeh file. Figures are rebuilt fresh and detached (a model may live in only one document) and pinned to a fixed frame size so they render outside a sizing container. The log console is embedded below the plots as a width-matched, scrollable Div. Views supply export_series() (tidy records) and _make_figures/ _export_figures hooks; the public figures property still exposes the live figures for host annotation. Export deps (pandas, pint-pandas, openpyxl) are an optional 'export' extra, imported lazily; buttons disable with a hint when absent. Tests: unit tests for the DataFrame build, dequantify, row cap, text column and label dedup; Playwright browser tests that download the CSV and HTML and assert the unit header, text channel, embedded log console and a rendered (non-collapsed) plot. Browser tests self-skip without Playwright/Chromium. Local *.sqlite databases are gitignored.
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.
Summary
Adds a dashboard-level Export section (compact collapsible card in Plot Controls) to the archive views (
DataToolView,ProcessObjectView;LiveDataToolViewkeeps working) with threeFileDownloadactions onBaseDataView. Additive and backward compatible.Download CSV / XLSX
A unit-aware pint-pandas table of every checked channel:
_dequantifywrites a two-row(label, unit)header; column keys stay unit-free.EXPORT_MAX_ROWS(1,000,000) via uniform downsampling (logged).Download plot (HTML)
A standalone interactive Bokeh file:
Div.Extensibility
Views supply
export_series()(tidy records) and_make_figures/_export_figureshooks; the publicfiguresproperty still exposes the live figures for host annotation. Export deps (pandas,pint-pandas,openpyxl) are an optionalexportextra, imported lazily; buttons disable with a hint when absent.Tests
dequantify, row cap, text column, label dedup.*.sqlitedatabases are gitignored.Browser testing surfaced (and this PR fixes) three real bugs: composite-label column collapse, the
file_htmlshared-document error, and the collapsed standalone-HTML plot frame.Notes
Follow-up (tracked separately): factor the pint/CSV table logic into a generic
TabularDatabase inopensemantic.coreand reuse it from both this export andopensemantic.characteristics.quantitative.