-
Notifications
You must be signed in to change notification settings - Fork 41
Add support for adding titles to asset page graphs #1125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…Schema and Able to handle both 'sensor' and 'sensors' inputs Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…'sensor' and 'sensors' inputs Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…rs' inputs Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
nd 'sensors' inputs Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this, which indeed is a bit tricky, and I hope I helped to resolve how to go forward with this.
It might be helpful to add simple unit tests for validating and deserializing some example input values for sensors_to_show
using the new Schema (in flexmeasures/data/schemas/tests)
…set-graphs Integrate latest updates from the main branch into the feature branch. This merge brings in recent changes from the main branch, ensuring compatibility and incorporating any improvements or fixes made to the main codebase.
…event From PR #1162 Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…t axis titles Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…ation 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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested, and it works well!
Please add a changelog entry, and Felix gave a hint how to fix tests :)
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…for 'sensors_to_show' Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…sts before PR #1162 resolves file changes Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Description
To allow for custom graph titles for sensors input by the user by modifying the
sensors_to_show
attribute in the attributes section.Files changed:
flexmeasures/data/models/generic_assets.py
:sensors_to_show
attribute to accept dictionaries withtitle
andsensor
keys orsensors
.sensors_to_show
with{'title': 'sensor_title', 'sensor': sensor_id}
or{'title': 'sensor_title', 'sensors': List[sensor_ids]}
.flexmeasures/data/schema_generic_assets.py
:GenericAssetSchema
to create seperateSensorsToShowSchema
.title
andsensor
orsensors
fields in the dictionary.flexmeasures/data/models/charts/belief_charts.py
:chart_for_multiple_sensors
function to handle the new format.flexmeasures/utils/coding_utils.py
:flatten_unique
function to handle the new format and extract sensor IDs from dictionaries withtitle
andsensor
orsensors
keys.Look & Feel
When
{'title': 'sensor_title', 'sensor': sensor_id}
or{'title': 'sensor_title', 'sensors': list[sensor_ids]}
is added tosensors_to_show
, this will set the custom title for the graph of that sensor.How to test
Manually test different JSON attributes in the edit asset sidebar.
Verify that custom titles are correctly applied to the corresponding sensor graphs.
Further Improvements
[] move the parsing functionality from flatten_unique to SensorsToShowSchema.
[] Add test case.
[] Add documentation and update the change-log for this feature.
Related Items
closes #1119