Skip to content

feat: query sensors only if they exist, batch sensor data requests#650

Merged
aleclevy merged 5 commits into
jlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-642-query-sensors-only-if-exist
Mar 5, 2026
Merged

feat: query sensors only if they exist, batch sensor data requests#650
aleclevy merged 5 commits into
jlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-642-query-sensors-only-if-exist

Conversation

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor

Summary

Fixes #642

The dashboard was rendering all 14 chart types unconditionally for every selected cell, firing up to 14 × N API requests on each cell selection — most returning empty data. This PR adds a sensor existence check and batch data fetching to eliminate wasted requests.

  • Add GET /api/cell-sensors/ endpoint returning which sensor names exist per cell
  • Extend GET /api/sensor/ to accept cellIds (comma-separated) for batch queries, returning data grouped by cell in a single response
  • Dashboard now fetches sensor availability when cells change and skips rendering charts whose sensor type doesn't exist for any selected cell
  • UnifiedChart now makes 1 batch request per measurement type instead of 1 request per cell × per measurement

@aleclevy aleclevy merged commit c98547b into jlab-sensing:main Mar 5, 2026
1 of 2 checks passed
@aleclevy
Copy link
Copy Markdown
Contributor

aleclevy commented Mar 6, 2026

@aabhinavvvvvvv This pr caused an api issue to arise with Marshmallow 'cellIDs'

marshmallow.exceptions.ValidationError: {'cellIds': ['Unknown field.']}

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor Author

@aleclevy the root cause was that cellIds was missing from GetSensorDataSchema, causing Marshmallow to reject it. I've fixed this in the new PR #684 by adding cellIds = ma.String(required=False, load_default=None) to the schema and making cellId optional as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query sensors only if they exist

2 participants