Skip to content

Conversation

@MCLiii
Copy link
Member

@MCLiii MCLiii commented Mar 19, 2024

Implements API and corresponding graph changes for timeseries forecasting using auto arima, model still needs further tuning.

@sbasu107 sbasu107 requested a review from Copilot June 10, 2025 04:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements timeseries forecasting using auto_arima and integrates corresponding API and graphical changes.

  • Adds a new GET_FORECAST_DATA route in frontend constants.
  • Updates the graph component to fetch and display forecast data with adjusted time bounds and styling.
  • Implements a new backend forecast endpoint and registers it with the component router.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Frontend/src/Components/Shared/misc-constants.js Added GET_FORECAST_DATA route to support forecast API calls.
Frontend/src/Components/Graph/CustomGraph.js Updated graph options and added forecast data fetching and display functionality.
Backend/core/comms.py Modified unpack_data to replace inf values with -10000.
Backend/components/forecast.py Added forecast endpoint using auto_arima for predictions.
Backend/components/component_router.py Included the newly created forecast router.
Comments suppressed due to low confidence (1)

Frontend/src/Components/Graph/CustomGraph.js:129

  • The substring '_forcast' appears to be a misspelling. Consider standardizing this to '_forecast' to maintain consistency with the API route and backend naming.
if (item.dataset.key.indexOf("_forcast") !== -1) {

});
}
}, 10000);
console.log(forcastData);
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or replace the console.log statement used for debugging to avoid unnecessary logging in production code.

Suggested change
console.log(forcastData);
// Removed unnecessary console.log statement for production.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
# if the data is -inf or inf, we set it to -10000
if fields[properties[i]] == float('inf') or fields[properties[i]] == float('-inf'):
fields[properties[i]] = -10000
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using a hardcoded value (-10000) to replace infinity may be confusing. Consider adding a comment or refactoring this logic into a named constant to clarify its purpose and allow for easier adjustments in the future.

Suggested change
# if the data is -inf or inf, we set it to -10000
if fields[properties[i]] == float('inf') or fields[properties[i]] == float('-inf'):
fields[properties[i]] = -10000
# if the data is -inf or inf, we replace it with REPLACEMENT_FOR_INFINITY
if fields[properties[i]] == float('inf') or fields[properties[i]] == float('-inf'):
fields[properties[i]] = REPLACEMENT_FOR_INFINITY

Copilot uses AI. Check for mistakes.
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.

2 participants