Skip to content

Feat/dataplatform save#111

Open
PavanRaghavendraKulkarni wants to merge 35 commits intomainfrom
feat/dataplatform-save
Open

Feat/dataplatform save#111
PavanRaghavendraKulkarni wants to merge 35 commits intomainfrom
feat/dataplatform-save

Conversation

@PavanRaghavendraKulkarni
Copy link
Contributor

@PavanRaghavendraKulkarni PavanRaghavendraKulkarni commented Feb 12, 2026

Description

This PR introduces the implementation for saving generated forecasts to the Data Platform.

The forecast saving logic has been added and integrated into the application flow to ensure forecasts are persisted after generation. The changes improve the overall pipeline by enabling reliable downstream consumption of forecast data.

Key changes include:

  • Implemented forecast saving to the Data Platform

  • Integrated save logic into the main forecast execution flow

  • Refactored related code for better structure and readability

  • Added necessary dependency updates

  • Added unit and integration tests to validate save behaviour

  • Improved error handling around the save process

Fixes #163

How Has This Been Tested?

  • Added unit tests covering the forecast save logic

  • Added integration tests to verify forecasts are correctly constructed and sent to the Data Platform

  • Ran the application locally to confirm:

  • Forecast generation works as expected

  • Save calls are triggered successfully

  • No runtime or validation errors occur

  • Performed a basic sanity check to confirm forecast values are correctly passed through the save pipeline

    • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

…ward compatibility; remove outdated test files
@PavanRaghavendraKulkarni PavanRaghavendraKulkarni marked this pull request as ready for review February 18, 2026 05:44
Comment out the load_dotenv function call to prevent loading environment variables from .env.local.
Removed unused dotenv import statement.
metadata = Struct(fields={"legacy_uuid": Value(string_value=legacy_uuid)})

req = dp.CreateLocationRequest(
location_name=f"synced_site_{legacy_uuid[:8]}",
Copy link
Contributor

Choose a reason for hiding this comment

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

get name from legacy_sites

Copy link
Contributor

Choose a reason for hiding this comment

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

this should work if all names are unique

try:
await save_forecast_to_dataplatform(
forecast_df=forecast_values_df,
location_uuid=UUID(str(forecast_meta["location_uuid"])),
Copy link
Contributor

Choose a reason for hiding this comment

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

check if we need str here

torchvision = [
{ index = "pytorch-cpu" },
]
dp-sdk = { url = "https://github.com/openclimatefix/data-platform/releases/download/v0.16.0/dp_sdk-0.16.0-py3-none-any.whl" }
Copy link
Contributor

Choose a reason for hiding this comment

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

upgrade to 0.19.3

Comment on lines +207 to +217
# DP validates version with a restricted charset; normalize local package versions
# (which may contain e.g. '+' build metadata) to a compatible value.
app_version = "".join(
ch if (ch.isalnum() or ch in "._-") else "."
for ch in raw_version.lower()
)
while ".." in app_version:
app_version = app_version.replace("..", ".")
app_version = app_version.strip("._-")
if len(app_version) < 2:
app_version = "0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure we need this, we just know the version needs to be X.Y.Z

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

Comments