Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ tests/.env
*.orig
*.log
*.pot

# Local test/demo databases (created by examples and tests)
*.sqlite
*.sqlite-journal
*.sqlite-wal
*.sqlite-shm
__pycache__/*
.cache/*
.*.swp
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,23 @@ See [examples/datatool_dashboard.py](examples/datatool_dashboard.py) for a full

To regenerate the screenshots after UI changes, see [docs/generate_screenshots.py](docs/generate_screenshots.py).

### Export

A toolbar at the top of the plot card exports the currently plotted data and
plot (requires the `export` extra):

- **Download CSV / XLSX** - a unit-aware [pint-pandas](https://github.com/hgrecco/pint-pandas)
table (one column per series, its unit written in a dedicated header row via
`dequantify()`), matching exactly what is plotted (unit conversion +
normalization). Rows are capped at `EXPORT_MAX_ROWS` (default 1,000,000) via
uniform downsampling.
- **Download plot (HTML)** - a standalone interactive Bokeh document
(`bokeh.embed.file_html`). PNG is available from the Bokeh toolbar's save tool.

The rendered figures are exposed via `view.figures` so a host app can add its
own annotations; `view.export_series()` returns the plotted series as tidy
records.

## Server-side downsampling

Large time series are downsampled on the server so the plot only transports the
Expand Down Expand Up @@ -332,6 +349,21 @@ regenerate these screenshots.
pip install opensemantic.base # models only
pip install opensemantic.base[controller] # + aiosqlite, postgrest
pip install opensemantic.base[view] # + panel, bokeh, panelini, pint
pip install opensemantic.base[export] # + pandas, pint-pandas, openpyxl (data/plot export)
```

### Running the examples

```bash
git clone https://github.com/OpenSemanticWorld-Packages/opensemantic.base-python.git
cd opensemantic.base-python
pip install -e .
pip install opensemantic.base[controller] opensemantic.base[view] opensemantic.base[export]
pip install opensemantic.characteristics.quantitative # typed characteristics
pip install nest-asyncio # examples/datatool_dashboard.py
pip install PyJWT # examples/downsample_demo.py (needs a database)

panel serve examples/datatool_dashboard.py --dev
```

## Testing
Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ view =
panelini
pint

# Data/plot export from the dashboard views (unit-aware CSV/XLSX + plot HTML).
export =
pandas
pint-pandas
openpyxl

# Add here test requirements (semicolon/line-separated)
testing =
setuptools
Expand Down
Loading
Loading