Closed VictorKwong closed 1 week ago
Added JSON export functionality for sensor data with options for real-time and historical data selection. Implemented date filtering, error handling for empty datasets, and server issues, ensuring seamless download of well-structured JSON files.
Export Sensor Data as JSON
User Story
As a user, I want to export my sensor data as a JSON file so that I can integrate it with other systems or use it for API-driven analysis.
Description
This use case involves allowing users to export their sensor data (temperature, humidity, and moisture) as a JSON file. Users can export either real-time or historical data for use in other systems or for further analysis. The JSON file should be well-structured and include all relevant data fields (timestamp, temperature, humidity, and moisture).
Acceptance Criteria
Testing
Normal Flow of Events
The user logs into their account and navigates to the dashboard. The user selects a date range (for historical data) or chooses to export real-time data. The user clicks the "Export as JSON" button. The system generates a JSON file with the selected sensor data. The user downloads the JSON file to their device, and the data is correctly formatted.
Alternate/Exceptional Flows:
S-1: No data available for export
The user selects a date range where no data is available. The system displays a message: "No data available for export" and disables the export button.
S-2: JSON export fails due to server issues
The system fails to generate a JSON file due to a server issue. The system displays an error message: "Failed to export data. Please try again later."