Repository navigation
feat: optional web dashboard for exploring the data (/explore) - #80
Merged
Merged
Conversation
Add an optional dashboard for monitoring the collected data in a
browser. It is enabled in the configuration and is separate from data
collection: it only reads the stored data.
explore:
- enable: true
- refresh: 10
- New module succulent/explore.py (Explorer, a Flask blueprint),
registered by SucculentAPI only when enabled
- Dashboard: latest value per column with its position between min
and max, data quality (measurements, missing values, values outside
min/max, typical interval), a chart per numeric column with min/max
lines, and the latest measurements; time ranges with timestamps,
auto-refresh, CSV export when export is enabled
- Gallery for the image format
- JSON endpoints /explore/api/data (range: 1h, 24h, 7d, 30d, all;
long series are averaged) and /explore/api/images
- Password prompt with a session cookie, so the password is never in
the URL; scripts can use the Authorization/X-API-Key headers;
optional secret_key in the configuration
- No external scripts or fonts, so it works without internet access;
strict Content-Security-Policy; device values are rendered as text
- Light and dark mode, works at phone width
- Document the dashboard (with a screenshot) and add tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCvw8haRnmyrVKrLkz5Yf8
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
An optional web dashboard for monitoring the collected data in a browser, at
/explore. It is off by default and separate from data collection: it is only registered when enabled, and it only reads the stored data.What it shows
In range,Near max/min,Above max/Below min,No reading) and its position betweenminandmax. If a value is missing in the last measurement, the previous value and its time are shown.min/max, typical interval.min/maxas dashed lines and out-of-range points marked. Long ranges are averaged server-side (max. 1000 points) so the page stays fast.imageformat (latest image, earlier images, counts and storage used).Design decisions
succulent/explore.py(Explorer, a Flask blueprint) plus its own templates and static files. The only change to existing code is 10 lines inSucculentAPI.__init__to register it when enabled.textContent), never as HTML.Content-Security-Policy(script-src 'self',style-src 'self', no inline code),nosniff,no-storefor data.HttpOnly,SameSite=Lax), so the password never appears in URLs or browser history.?password=is deliberately not accepted for the dashboard. Scripts can useAuthorization: Bearer/X-API-Key.secret_keyin the configuration keeps sessions across restarts (otherwise a random key per process).Endpoints
GET /exploreGET/POST /explore/login,POST /explore/logoutGET /explore/api/data?range=24hGET /explore/api/imagesimageformat)GET /explore/images/<name>GET /explore/exportTesting
tests/test_explore.pywith 24 tests: configuration (off by default, both config styles, invalid values), page and security headers, data summary, ranges, data without timestamps, averaging, export, password prompt/session/headers, gallery and image serving (only stored images, no traversal).Note
/measurerejects values outsidemin/max, so out-of-range points only appear for data stored before the limits were set or tightened, or imported data. A possible follow-up is to record rejected measurements so the dashboard can show them.Generated by Claude Code