Skip to content
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

642 add report cli command #659

Merged
merged 100 commits into from May 29, 2023
Merged

642 add report cli command #659

merged 100 commits into from May 29, 2023

Conversation

victorgarcia98
Copy link
Contributor

This PR introduces the command flexmeasures add report which allows to create reports (custom calculations defined in classes of type Reporter) and save them to the database or export them to Excel or CSV. It also includes some flags to define the time scope of the report in some predefined ways: --last-hour, --last-day, ...

Closes #642.

victorgarcia98 and others added 30 commits April 14, 2023 10:50
… report_config schemas.

Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
- Renaming BWV and EB to english words.
- Simplifying calculation (pandas pipeline).
- Adding units to sensors.
- Changing units from EUR/kWh to EUR/MWh
- Adding assert to check maximum error
- deserialize_report_config -> deserialize_reporter_config
- Warning when a string starting with  `@` is used in the method query or eval.
- Making process_pandas_args, process_pandas_kwargs and apply_transformation private methods.

Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
- Output type of compute is BeliefDataFrame
- Added a global input resolution to schem
- ISO datetime and timedeltas
- start, end and input_resolution are considered serialized when passed to the method compute
- assert to check that result resolution = sensor resolution

Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
* No return value

Signed-off-by: F.N. Claessen <felix@seita.nl>

* typo

Signed-off-by: F.N. Claessen <felix@seita.nl>

* plural

Signed-off-by: F.N. Claessen <felix@seita.nl>

* indentation

Signed-off-by: F.N. Claessen <felix@seita.nl>

* fix return type annotations

Signed-off-by: F.N. Claessen <felix@seita.nl>

* format docstring example

Signed-off-by: F.N. Claessen <felix@seita.nl>

* add type annotations

Signed-off-by: F.N. Claessen <felix@seita.nl>

* predefine instance attributes

Signed-off-by: F.N. Claessen <felix@seita.nl>

* remove redundant variable

Signed-off-by: F.N. Claessen <felix@seita.nl>

* grammar

Signed-off-by: F.N. Claessen <felix@seita.nl>

* support aliases

Signed-off-by: F.N. Claessen <felix@seita.nl>

* grammar/typos

Signed-off-by: F.N. Claessen <felix@seita.nl>

* test exact match

Signed-off-by: F.N. Claessen <felix@seita.nl>

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
…rator classes: Reporter, Scheduler, Forecaster.

Signed-off-by: victor <victor@seita.nl>
…compute` method signature.

Signed-off-by: victor <victor@seita.nl>
…e for data generators.

Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
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>
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>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
… value (None)

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>
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>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
* feat: create show reporter command

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

* style: add hint to list reporters

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

* style: add module name
style: print empty string when the author is missing

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

* style: change column order

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

* docs: add entry for PR #686

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

* docs: add command flexmeasures show reporters

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>

---------

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/utils.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
victorgarcia98 and others added 2 commits May 19, 2023 17:12
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
* style: capitalize CSV

Signed-off-by: F.N. Claessen <felix@seita.nl>

* fix: reporter is no longer a required parameter

Signed-off-by: F.N. Claessen <felix@seita.nl>

* style: required parameters on top

Signed-off-by: F.N. Claessen <felix@seita.nl>

* style: fix parameter name in docstring

Signed-off-by: F.N. Claessen <felix@seita.nl>

* fix: avoid converting dt type

Signed-off-by: F.N. Claessen <felix@seita.nl>

* feature: add test case with timezone

Signed-off-by: F.N. Claessen <felix@seita.nl>

* feature: add test case for Pandas structure

Signed-off-by: F.N. Claessen <felix@seita.nl>

* fix: type annotations

Signed-off-by: F.N. Claessen <felix@seita.nl>

* fix: use parameter 'end'

Signed-off-by: F.N. Claessen <felix@seita.nl>

* style: fix type annotation

Signed-off-by: F.N. Claessen <felix@seita.nl>

* style: justified indentation

Signed-off-by: F.N. Claessen <felix@seita.nl>

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
documentation/changelog.rst Outdated Show resolved Hide resolved
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>
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>
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

@victorgarcia98
Copy link
Contributor Author

Thanks for the review!

I'm trying to merge but it's blocked by the condition to not merge with unresolved comments. Checking all the conversations in Files Changed, there's no unresolved comments so I'm selecting the option Dismiss Review to see if that allows the merge.

@victorgarcia98
Copy link
Contributor Author

Thanks for the review!

I'm trying to merge but it's blocked by the condition to not merge with unresolved comments. Checking all the conversations in Files Changed, there's no unresolved comments so I'm selecting the option Dismiss Review to see if that allows the merge.

Instead, I think it would better if any of @nhoening or @Flix6x merges this to bypass the blockage 😄

@Flix6x Flix6x merged commit cc40d37 into main May 29, 2023
6 of 7 checks passed
Reporting backend infrastructure automation moved this from In progress to Done May 29, 2023
@Flix6x Flix6x deleted the 642-add-report-cli-command-2 branch May 29, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Add CLI command flexmeasures add report to compute reports using a Reporter
3 participants