Feat/forecast source filtering#2347
Conversation
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Documentation build overview
13 files changed ·
|
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
|
Reviewed and manually tested this PR Manual test commands: export TARGET_SENSOR_ID=313
export REGRESSOR_SENSOR_ID=259
export SELECTED_SOURCE_ID=1212
export OTHER_SOURCE_ID=868
export TRAIN_START=2026-04-21T00:00:00+00:00
export FORECAST_START=2026-04-24T00:00:00+00:00
# Plain ID still works
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --future-regressors "$REGRESSOR_SENSOR_ID" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H
# JSON references work through all regressor options
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --future-regressors "[{\"sensor\": $REGRESSOR_SENSOR_ID, \"sources\": [$SELECTED_SOURCE_ID]}]" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --past-regressors "[{\"sensor\": $REGRESSOR_SENSOR_ID, \"exclude-source-types\": [\"forecaster\"]}]" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --regressors "[{\"sensor\": $REGRESSOR_SENSOR_ID, \"sources\": [$SELECTED_SOURCE_ID, $OTHER_SOURCE_ID]}]" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H
# Empty sources should not fall back to all sources
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --future-regressors "[{\"sensor\": $REGRESSOR_SENSOR_ID, \"sources\": []}]" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H --missing-threshold 0.5
# Queue boundary: terminal 1
uv run flexmeasures jobs run-worker --queue forecasting --without-scheduler --name manual-forecast-worker
# Queue boundary: terminal 2
uv run flexmeasures add forecasts --sensor "$TARGET_SENSOR_ID" --future-regressors "[{\"sensor\": $REGRESSOR_SENSOR_ID, \"sources\": [$SELECTED_SOURCE_ID]}]" --train-start "$TRAIN_START" --start "$FORECAST_START" --duration PT1H --max-forecast-horizon PT1H --forecast-frequency PT1H --as-jobResults:
Targeted automated checks also passed: |
|
@Flix6x follow-up question: should we warn when selected regressor sources collide? For example, if a config uses Suggestion:
|
|
Without a precedence rule, what is the current behaviour, does it crash? |
It does not crash. When two selected sources provide values for the same regressor with the same |
Description
regressors,future-regressors, andpast-regressorsto accept either plain sensor IDs orSensorReferenceSchemaobjects.sources,source-types,exclude-source-types, andsource-accountfilters when loading regressor beliefs.documentation/changelog.rstLook & Feel
Plain sensor IDs remain supported:
Source-filtered sensor references can be passed as JSON through the existing options:
flexmeasures add forecasts \ --sensor 2092 \ --regressors '[{"sensor": 2093, "sources": [12, 13]}]'The same structure supports the other
SensorReferenceSchemafilters:{ "sensor": 2093, "source-types": ["forecaster"], "exclude-source-types": ["user"], "source-account": [4] }How to test
Relevant automated tests:
Manual checks performed:
sourceslist selects no beliefs.Further Improvements
Related Items
Closes #2337
Sign-off