Skip to content

Commit

Permalink
Merge 9d5c9e7 into e4c77cc
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed May 30, 2023
2 parents e4c77cc + 9d5c9e7 commit 41d1e9c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flexmeasures/data/models/reporting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def fetch_data(
)

# store data source as local variable
for source in bdf.sources.unique():
for source in bdf.sources.unique().dropna():
self.data[f"source_{source.id}"] = source

# store BeliefsDataFrame as local variable
Expand Down
6 changes: 6 additions & 0 deletions flexmeasures/data/models/reporting/pandas_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def deserialize_config(self):
# extract PandasReporter specific fields
self.transformations = self.reporter_config.get("transformations")
self.final_df_output = self.reporter_config.get("final_df_output")
self.output_event_resolution = self.reporter_config.get(
"output_event_resolution"
)

def _compute(
self,
Expand Down Expand Up @@ -84,6 +87,9 @@ def _compute(
]
final_output = tb.BeliefsDataFrame(timed_beliefs)

if self.output_event_resolution:
final_output.event_resolution = self.output_event_resolution

return final_output

def get_object_or_literal(self, value: Any, method: str) -> Any:
Expand Down
3 changes: 3 additions & 0 deletions flexmeasures/data/schemas/reporting/pandas_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from timely_beliefs import BeliefsDataFrame

from flexmeasures.data.schemas import DurationField


class PandasMethodCall(Schema):

Expand Down Expand Up @@ -74,6 +76,7 @@ class PandasReporterConfigSchema(ReporterConfigSchema):

transformations = fields.List(fields.Nested(PandasMethodCall()), required=True)
final_df_output = fields.Str(required=True)
output_event_resolution = DurationField(required=False)

@validates_schema
def validate_chaining(self, data, **kwargs):
Expand Down

0 comments on commit 41d1e9c

Please sign in to comment.