flexmeasures.data.services.data_ingestion

Logic around data ingestion (jobs)

Functions

flexmeasures.data.services.data_ingestion.add_beliefs_to_database(data: BeliefsDataFrame | list[BeliefsDataFrame], forecasting_jobs: list[Job] | None = None, save_changed_beliefs_only: bool = True) str

Save sensor data to the database and optionally enqueue forecasting jobs.

This function is intended to be called as an RQ job by an ingestion queue worker, but can also be called directly (e.g. as a fallback when no workers are available).

Parameters:
  • data – BeliefsDataFrame (or list thereof) to be saved.

  • forecasting_jobs – Optional list of forecasting Jobs to enqueue after saving.

  • save_changed_beliefs_only – If True, skip saving beliefs whose value hasn’t changed.

Returns:

Status string, one of: - ‘success’ - ‘success_with_unchanged_beliefs_skipped’ - ‘success_but_nothing_new’