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
feat: support YAML in flexmeasures add report
command
#752
feat: support YAML in flexmeasures add report
command
#752
Conversation
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…ure/reporting/add-report-support-yml
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…ure/reporting/add-report-support-yml
flexmeasures add report
commanflexmeasures add report
command
…ure/reporting/add-report-support-yml Signed-off-by: Victor <victor@seita.nl>
…ure/reporting/add-report-support-yml Signed-off-by: Victor <victor@seita.nl>
flexmeasures/cli/data_add.py
Outdated
if ("end" not in inputs) and (end is not None): | ||
inputs["end"] = end.isoformat() | ||
if ("resolution" not in inputs) and (resolution is not None): | ||
inputs["resolution"] = pd.Timedelta.isoformat(resolution) |
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 wonder how this behaves for calendar days. Can we add a test for this? We don't need to solve this case immediately, but I'd like to know where we stand.
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 wonder if we should just test pd.Timedelta.isoformat(resolution)
in a DST changing day or a end to end test is needed. What do you think?
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.
Let's go with the former, so just the function.
…ure/reporting/add-report-support-yml Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…port-yml' into feature/reporting/add-report-support-yml Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
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.
Thanks for the revisions.
I noted one accidental file, one potential bug and a request for additional tests. Let's add the changelog entry, too.
flexmeasures/cli/data_add.py
Outdated
if ("end" not in inputs) and (end is not None): | ||
inputs["end"] = end.isoformat() | ||
if ("resolution" not in inputs) and (resolution is not None): | ||
inputs["resolution"] = pd.Timedelta.isoformat(resolution) |
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.
Let's go with the former, so just the function.
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Does this still require an update with regards to the renaming of |
Otherwise, I believe with a changelog entry (main changelog and CLI changelog) this is close to being complete. |
…ure/reporting/add-report-support-yml Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Thanks! The changelog entry includes a reference to PR #751, as well. |
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…ure/reporting/add-report-support-yml Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…ure/reporting/add-report-support-yml
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
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.
Just add the missing changelog entry, and move the current one to #751.
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
…ure/reporting/add-report-support-yml Signed-off-by: Victor <victor@seita.nl>
1e8704e
into
feature/reporting/save-reporters-data-source
* feat: revision to add `attributes` column to the `data_source` table Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add `attributes` column to the DataSource model Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add sensors relationship in DataSource Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: make sensors relationship viewonly Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add report_config to Reporter class Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add PandasReporter report and reporter schemas Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: update fixture by removing beliefs_search_configs and adding input_variables Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add report config to PandasReporter Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add helper methods to DataSource Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: modernize AggregatorReporter Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add attributes hash Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add attributes to the function get_or_create_source Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add attribute hash to get_or_create_source Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: save/fetch data generator to/from data source Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: adapt reporters to use new DataGenerator class Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use default method on load Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: adapt tests of the schemas Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use a DataGenerator with a schema defined Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * changing backref from "dynamic" to "select" Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add hash_attributes static method Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use hash_attributes static method Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: adding attributes_hash to the DataSource unique constraint list Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: add constraint to migration and downgrade Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: only returning keys from the attributes field Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: rename _inputs_schema to _input_schema Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: typing Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: avoid future data leakage Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: rename PandasReporterInputConfigSchema to PandasReporterInputSchema Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: clarify description of the fake_data mock variable Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: fix docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use default value Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: allow creating new attributes with the method `set_attributes` Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: add changelog entry Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: fix docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use default value Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: allow creating new attributes with the method `set_attributes` Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: add changelog entry Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: add reporters and schedulers into the data_generators attribute in the app context Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: raise Exceptions instead of returning None Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: move sensor attribute from config to inputs Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use same structure for data generators and add test Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: use input_resolution instead of resolution Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * doc: update schema docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: rename input_resolution to resolution Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: remove sensor from config Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: add comment Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: remove df_output Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix:. for data in data["data"] haha Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * doc: add docstring to compute and __init__ in DataGenerator Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: rename inputs to input Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: removing constructor Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: improve docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * test: add data to confest Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * test: add test_dst_transition Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: never returning None Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * test: add test to check timely-beliefs resampling and calling an aggregator between to dates with different offsets, in this case, daylight saving transitions. Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * test: change output sensor id Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: add docstring to the data_source propert of the class DataGenerator. Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * docs: edit data_source docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: ranming input_sensors to input_variables Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * rename input to parameters Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * remove unnecessary import Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add save_config attribute Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * remove leftover comment Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add inline comments Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * deprecation message for app.reoprters and app.schedulers Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix typo Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * use data source created by the data generator Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: support YAML in `flexmeasures add report` command (#752) * feat: add pyyaml to the requirements Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: support YAML and add report_config Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: move `types-PyYAML` dependency to the right place Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: use a DataGenerator with defined schemas Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: adapt tests of the schemas Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: add option to open default editor Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: move sensor to input Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: parse resolution properly Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: remove accidentally commited file Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: avoid potential bug Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * rename input to parameters Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add chagelog entry Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add pyyaml to app.txt Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add --save-config to the add_report command Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * improve changelog files Signed-off-by: Victor Garcia Reolid <victor@seita.nl> --------- Signed-off-by: Victor Garcia Reolid <victor@seita.nl> Signed-off-by: Victor <victor@seita.nl> * Polish `PandasReporter` schemas (#788) * add required_input and required_output to PandasReporterConfigSchema and input & outupt to parameters Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * adapt tests Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * implement multiple output and simplify tibber reporter Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix example in the docstring Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * remove max=1 constraint Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * add example for _clean_parameters Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * remove time parameters in input (_clean_parameters method) Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * remove filed added accidentally Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * improve assert Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * update changelog entry Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix changelog Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * Adapt `test_add_report` to use the new field of the `PandasReporter` schema (#789) * fix: typo Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: fetch output sensor only from parameters dict Signed-off-by: F.N. Claessen <felix@seita.nl> * adapt the CLI to deal with multiple output Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix typos Signed-off-by: Victor Garcia Reolid <victor@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl> Signed-off-by: Victor Garcia Reolid <victor@seita.nl> Co-authored-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: Victor Garcia Reolid <victor@seita.nl> Signed-off-by: F.N. Claessen <felix@seita.nl> Co-authored-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: Victor Garcia Reolid <victor@seita.nl> Signed-off-by: Victor <victor@seita.nl> Signed-off-by: F.N. Claessen <felix@seita.nl> Co-authored-by: F.N. Claessen <felix@seita.nl>
This PR adapts the command
flexmeasures add report
to work with the new implementation of theReporter
, subclassing fromDataGenerator
.--reporter-config
to--config
.--inputs
.--edit-config
and--edit-inputs
to open the default editor to editconfig
andinputs
. Similar work in feat: addflexmeasures add schedule generic
command #730config
andinputs
files, keeping the support for JSON.