Repository navigation
Keep data source attributes in the source lookup and in keep_latest_version - #2867
Open
sankalpsthakur wants to merge 3 commits into
Open
sankalpsthakur wants to merge 3 commits into
sankalpsthakur wants to merge 3 commits into
Conversation
…nd when keeping the latest version get_data_source() now looks for the source without attributes, which is the one it creates, so a sibling recording attributes under the same name, model, version and type no longer makes it raise MultipleResultsFound. keep_latest_version() now groups sources by their attributes as well as their name, type and model, so sources differing only by attributes each keep their data. The members a partial aggregate names as missing do not count, so a complete aggregate still replaces its partial one. Fixes FlexMeasures#2505 Signed-off-by: Sankalp Thakur <[email protected]>
Signed-off-by: Sankalp Thakur <[email protected]>
Documentation build overview
5 files changed ·
|
Signed-off-by: Sankalp Thakur <[email protected]> # Conflicts: # documentation/changelog.rst
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
get_data_source()only looks for the source without attributes, which is the kind it creates, so an attribute-carrying sibling no longer makes it raiseMultipleResultsFound.keep_latest_version()groups sources by (name, type, model, attributes), so sources that differ only by their attributes each keep their data, with versioning still applied within each group. The aggregator'smissing-membersattribute does not count, so a complete aggregate still replaces its partial one.data_generator_configcollapse to the newest one; the reference test is updated to the new grouping._select_latest_version_and_belief_per_event()intime_series.pystill groups without attributes. I left it for a follow-up, happy to add it here if you prefer.Validation
pytest flexmeasures/data/tests/test_data_source.py flexmeasures/data/tests/test_search_postprocessing.py: 49 passed.flexmeasures/data/models/reporting/testsandflexmeasures/data/tests/test_queries.py: 101 passed.black --checkandflake8clean on the changed files.Fixes #2505
AI/LLM disclosure
AI tools assisted with this change; I reviewed it and ran the tests above.