Daily and Monthly json files updation #29
Merged
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.
This pull request includes several changes to the backend and frontend to support fetching and displaying energy usage data. The most important changes include the addition of new JSON files for energy data, updates to backend API endpoints to fetch energy usage, and modifications to the frontend to display this data.
Backend changes:
backend/devices_json.py: AddedBASE_DIR,selectedUserFile,usersDBFile, andselected_user_devicesto manage file paths.backend/energy_json.py: Introducedget_energy_datafunction to fetch energy usage data from JSON files based on the specified time range.backend/fastAPI.py: Added new endpoints/energy_usageand/energy_usage/{time_range}to fetch daily and monthly energy usage data. [1] [2]Frontend changes:
frontend/src/app/dashboard/page.jsx: UpdatedDashboardcomponent to fetch and display energy usage data for daily and monthly time ranges. [1] [2] [3] [4]frontend/src/app/ui/energyChart.jsx: ModifiedEnergyUsageChartcomponent to handle real-time, daily, and monthly energy usage data and display it accordingly. [1] [2] [3]JSON data additions:
backend/energy/daily_energy.json: Added daily energy usage data for March 2025.backend/energy/monthly_energy.json: Added monthly energy usage data for 2024.