Skip to content

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

Open
aabhinavvvvvvv wants to merge 1 commit into
jlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-642-query-sensors-only-if-exist-v2
Open

feat: query sensors only if they exist, batch sensor data requests#684
aabhinavvvvvvv wants to merge 1 commit into
jlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-642-query-sensors-only-if-exist-v2

Conversation

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor

@aabhinavvvvvvv aabhinavvvvvvv commented Mar 7, 2026

Fixes #642

Re-submission of #650, which was reverted due to a Marshmallow validation error.

Root cause of revert: cellIds was missing from GetSensorDataSchema, causing ValidationError: {'cellIds': ['Unknown field.']} on batch requests. Fixed by adding cellIds = ma.String(required=False, load_default=None) to the schema and making cellId optional.

Summary

  • 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 fetches sensor availability when cells change and skips rendering charts whose sensor type doesn't exist for any selected cell
  • UnifiedChart makes 1 batch request per measurement type instead of 1 request per cell × per measurement

@aabhinavvvvvvv aabhinavvvvvvv force-pushed the fix/issue-642-query-sensors-only-if-exist-v2 branch from 5f21c6d to 8b254ad Compare March 7, 2026 17:59
@jmadden173 jmadden173 added the awaiting-review For PRs that have been looked at and waiting for a review. label Mar 21, 2026
@aabhinavvvvvvv aabhinavvvvvvv force-pushed the fix/issue-642-query-sensors-only-if-exist-v2 branch from 8b254ad to 32c3f68 Compare March 23, 2026 14:19
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 21.68675% with 65 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/pages/dashboard/Dashboard.jsx 13.95% 37 Missing ⚠️
backend/api/resources/cell_sensors.py 26.31% 14 Missing ⚠️
backend/api/resources/sensor_data.py 0.00% 10 Missing ⚠️
frontend/src/services/sensor.js 33.33% 4 Missing ⚠️

❌ Your patch check has failed because the patch coverage (18.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Flag Coverage Δ
backend 70.14% <27.27%> (-0.52%) ⬇️
frontend 50.59% <18.00%> (-1.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/api/__init__.py 80.91% <100.00%> (+0.29%) ⬆️
backend/api/schemas/get_sensor_data_schema.py 100.00% <100.00%> (ø)
...end/src/pages/dashboard/components/chartConfigs.js 100.00% <100.00%> (ø)
frontend/src/services/sensor.js 26.66% <33.33%> (ø)
backend/api/resources/sensor_data.py 22.22% <0.00%> (-4.20%) ⬇️
backend/api/resources/cell_sensors.py 26.31% <26.31%> (ø)
frontend/src/pages/dashboard/Dashboard.jsx 33.09% <13.95%> (-3.51%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor Author

Hey @jmadden173, conflicts are resolved and the branch is rebased onto main. The Codecov report shows low patch coverage — happy to add tests if you'd like. Let me know what you think after review.

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

Labels

awaiting-review For PRs that have been looked at and waiting for a review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query sensors only if they exist

2 participants