jlab-sensing / DirtViz

DirtViz is a project to visualize data collected from sensors deployed in sensor networks.
https://dirtviz.jlab.ucsc.edu/
MIT License
4 stars 8 forks source link

Implemented Raw Data Export for Multiple Cells #204

Closed ay-bh closed 3 months ago

ay-bh commented 4 months ago

Implemented enhancements to the "export to csv" functionality on the dashboard. With this update, users can now export raw data for multiple cells as separate CSV files, addressing the issue where previously only aggregated hourly data could be exported for a single cell, resolves #203.

Changes Made:

  1. Added a resample query parameter to the backend API endpoint /api/cell/data/${cellId}, allowing the API to handle raw data export when resample=none is specified. This parameter is used to determine whether to perform data resampling or to fetch raw data.

  2. Updated the backend database models to handle the new resample logic.

  3. Revised the getCellData schema to include the resample parameter, enabling front-end requests to specify the desired resampling strategy.

  4. Altered the front-end logic in DownloadBtn.jsx to pass the resample=none parameter when initiating the data download, ensuring that raw data is exported.

Testing Performed:

Manual testing was conducted to ensure the new functionalities work as expected. This includes:

EDIT: It also closes #210

ay-bh commented 3 months ago

marshmallow is already imported with ma so we could use ma.validate instead

@aaron-wu1 We need to import validate directly to access Marshmallow's validation functions, which aren't available as attributes of the Marshmallow instance (ma).