Repository navigation
Feat: reporter output source type - #2804
Conversation
An output-source-type in the reporter config (e.g. forecaster, for a sum of forecasts) replaces the class default 'reporter'. The field has no default, so configs that leave it out dump unchanged and existing sources keep their attributes hash. MemberFilterSchema now derives from Schema, as a member filter is no reporter config. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…r, too A reporter configured to save under a forecaster-type source left that source unable to set its reporter up again, because only the registry named by the source's type was looked in. A data generator found that way is only accepted if its config says to save under the source's type. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
The aggregator looked for its partial aggregates, and the sensor status for the members they left out, among reporter-type sources only. A report saved under another type (see output-source-type) would leave a stale partial aggregate as the latest belief, and drop the missing-members warning. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
The sources API gets a generator_type filter, matching sources by model against the registered data generators of that kind. The automation source picker uses it instead of the source type, so a report automation can pick an aggregator saving under a forecaster-type source, and a forecast automation no longer lists such a source, which it would refuse. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Includes when not to set output-source-type, and that a forecast whose "auto" entry filters sources does not leave out forecasters by default. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…nerator that does not exist Field names reach the wire with dashes. A typo such as generator-type=reportr now gets a 422, rather than an empty list that reads as if no source matched. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…urce types Judging every source type for missing members, rather than reporters only, had the status look the sensor's sources up again for each type. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Covers the source and its hash when the field is left out, the label, refusing an unknown type, leaving the aggregated forecast out of the training data of a forecast, setting the reporter up again from its source, report automations (API and plugin handler), partial aggregates and their status, and the generator-type filter. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…s missing members The status looked the sensor's sources up for the stalenesses, and again for the missing members. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…other type The check ran only for a data generator found among the other kinds, so a reporter-type source with a config naming the forecaster type set its reporter up, which then went on recording reports under it. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
A source of another type, such as a demo script, can carry a model named after a data generator, but it stores no data generator to set up. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
The output-source-type of a reporter config and the generator-type filter of the sources API share one validator. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…r anyway A config saying 'reporter' now has the source of the same config without it, rather than a source of its own that would split the sensor's reports, and leave partial aggregates of the old source unsuperseded. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Flix6x
left a comment
There was a problem hiding this comment.
Thanks Mohamed! I went through this on an isolated instance (the PR merged with today's main): the CLI, the sources API, a report automation through the API and through the UI, and the sensor page as the toy user. It works as described: the sum of the houses' forecasts is saved under a forecaster source, the tooltip says so, the community's forecast no longer trains on it, explicitly setting reporter keeps the old source, unknown values are refused, and reruns and automations find the reporter behind a forecaster-type source while forecast paths refuse it.
Going through it, though, we ended up questioning the approach itself: asking users to stamp the output type by hand. Below is where we landed, and how we got there.
Needs a change
-
Let the AggregatorReporter derive the output type from its inputs, and drop
output-source-type.
The PR keeps the type explicit because tariff reports also record values about the future that are known prices, not forecasts. That argues against deriving the type from belief horizons, but not against deriving it from the inputs' source types: a sum that includes a forecast is a forecast. Per event, by the beliefs that went into it:- any belief from a
forecastersource → the event is saved under a forecaster-type source; - otherwise, any belief from a
schedulersource → scheduler-type; - otherwise → reporter-type (other source types, such as
useror a script, count like measurements).
No belief horizons in this rule. Why this order: FlexMeasures acts on a source type in two places, forecast training (which leaves out
forecastersources from the target) and the status page (which expectsforecasterandschedulersources to deliver ahead of time). A sum containing a forecast is no ground truth, so it must not become a training target, which is #2785 itself. We see the three kinds as making different claims: a forecaster predicts, a scheduler prescribes, and a reporter derives, making no claim of its own, so its output should inherit the kind of its inputs.The aggregator already records per event under more than one source (partial aggregates in group mode), so a per-event type fits its design. Nobody has to remember a setting, which is what #2785 was about. With that,
output-source-typehas no use left but mislabeling, so please drop it: adding it later stays compatible, removing it after a release does not. Keep the other half of the PR, setting up a reporter again from a forecaster-type source, and refusing such a source on forecast paths.Someone who would rather have a report with a gap than a forecast without one can leave forecasts out of the inputs; the partial-aggregate handling then takes over. Later, the same idea could extend to other reporters per run (e.g. a
PandasReporterstamping by the types of the beliefs it loaded), but not in this PR. - any belief from a
-
Replace the
generator-typefilter withdata-generator, matched case-insensitively and including subclasses.
How we got there:typeandgenerator-typetake the same words (forecaster,reporter,scheduler) for two different things, what the data counts as versus what computed it, and the listing's existing filter is a baretype, so the two read alike. Meanwhile, automations already takedata-generatorwith a class name (AggregatorReporter), andGET /sources/<id>shows adata_generatorentry. Filtering on the class and its subclasses gives one key and one vocabulary:data-generator=AggregatorReporterlists only sums, and with case-insensitive matchingdata-generator=reportersimply matches the base classReporter, without extra aliases. It can work fromapp.data_generatorswithissubclass, matched againstDataSource.modelas the PR already does for a kind. Better to settle the name now, before the filter is released. -
Docs, along with 1 and 2:
- the example sums house forecasts without
output-source-type, and explains that the sum takes its type from its inputs (the rule above); the note on when to set the field goes; - a short paragraph on source type versus data generator, with the
data-generatorfilter, e.g. a forecaster-type source made by a reporter; - the example writes
source_typeswhile the text sayssource-types: please use the spelling the text and the API use; - the note that a forecast whose
"auto"entry filters sources must leave out forecasters itself stays.
- the example sums house forecasts without
-
flexmeasures add report --sourcecrashes with anAttributeErrorwhen no reporter can be set up from the source, asget_data_generatorreturnsNoneand the command doesn't check. This predates the PR, but it's a few lines: print an error naming the source and abort, as the command already does for an invalid period, plus a test. -
Changelogs. None of the three is touched. The main changelog needs an entry under v1.2.0, and the API changelog one for the final spec (the
data-generatorfilter onGET /sources).
Suggestions
- Sums saved before this change stay reporter-type and keep feeding the community's forecast training. One docs sentence saying to delete them, e.g. with
flexmeasures delete beliefs --source <id>, would help. - The automation source picker's placeholder, "Search by id, name or data generator class ...", could become "Search by id, name or data generator".
- A follow-up issue, not this PR:
DataSource.description("FlexMeasures's AggregatorReporter forecaster" next to "FlexMeasures's AggregatorReporter model") reads like two different generators, and with per-event types one aggregator gets sources of up to three types. The description is used in the API, the chart legend and tooltips, and the status page, so it deserves a redesign of its own.
Not this PR: the source details modal's layout (added to #2866), and the snake/kebab mix in ?only_latest=false&generator-type=reporter (added to #2540).
…ad of an output-source-type config field A sum that includes a forecast is a forecast, so the AggregatorReporter now saves each event under a forecaster-type source if any belief that went into it came from a forecaster, under a scheduler-type source if any came from a scheduler, and under a reporter-type source otherwise. Nobody has to remember a setting, and the field had no use left but mislabelling, so it is dropped before it is released. Partial aggregates follow the same rule, and a complete aggregate supersedes a partial one of any type this report saves under. A reporter is still set up again from a forecaster-type source, and refused on forecast paths. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…tor-type `data-generator` takes the class name that automations and the source details already use, matched case-insensitively and including subclasses, so `data-generator=Reporter` lists every report and `data-generator=AggregatorReporter` only the sums, whatever their type. The automation source picker uses it, and its placeholder no longer says "class". Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
… reporter from it The command crashed with an AttributeError on None instead. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Also explain source type versus data generator with the new filter, and how to recompute sums saved as reports before this change. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
|
@Flix6x Agreed on deriving the type: the aggregator now saves each event by its inputs (forecaster > scheduler > reporter), partial aggregates included, and |
Flix6x
left a comment
There was a problem hiding this comment.
Thanks Mohamed, the source type now follows the data, exactly as we had in mind, and all eight points of my last review are addressed. I went through it again on an isolated instance at the PR head (4a4560363): the CLI, the sources API, report automations and the UI, as the toy user and as an admin.
What I checked
- With only
method: sum, a sum of the houses' forecasts is saved under a forecaster-type source, a sum of their meter readings under a reporter-type one, and a report over House A's readings and House B's forecasts splits per event: yesterday (House A only) as a report, from today on as a forecast. A forecast of the community leaves only the forecaster-type sums out of its training data. - A config that still has
output-source-typeis refused as an unknown field. flexmeasures add report --sourceon a forecaster-type sum recomputes, and measurements then go to the reporter-type source; on a source without a reporter it names the source and aborts.- Forecast automations still refuse the aggregator's source; report automations accept it, and their runs save per event too.
data-generator=AggregatorReporterlists both sums and leaves a demo script carrying that model name out;data-generator=reportermatches every report; the automation source picker usesForecasterandReporter.- The docs (rule, why, source type vs. data generator), the delete note and the placeholder are in. On
source_types: you're right, the reporter'sinputonly takes the underscore spelling today, so the example is correct as it stands (but see point 8). - The eight touched test files pass here.
Requested changes
Most of these are about making the new behaviour understandable to users who don't know the difference between a data source and a data generator.
- Merge main: the PR now conflicts with it in
documentation/changelog.rst,documentation/api/change_log.rst,flexmeasures/api/v3_0/tests/test_automations_api.pyandflexmeasures/ui/templates/assets/asset_automations.html. - Move the API changelog entry to v3.0-37. It sits under v3.0-35, which was released on November 11 (with v1.1.1); v3.0-37 is main's upcoming version. The main changelog entries under v1.2.0 are fine as they are.
- Explain the 422 for a forecast automation in the user's terms. Setting one up from the aggregator's forecaster-type source gives
Data source 6 does not store a forecaster.To a user who sees a source of type forecaster, that is an arbitrary wall, and we can't assume they know the difference between a source and a data generator. Please put it simply and say exactly what to change, e.g.Source 6 is not a forecaster, but a reporter computing sums of forecasts. To use this source, set the automation type to "reporting". - Refuse a
data-generatorname that matches nothing. An unknown name now gives an empty list, so that sources of an uninstalled plugin can still be found by its name. But when the name matches no installed data generator and no source has it as its model (a typo likedata-generator=nonsense), please answer with a 422 naming the problem, e.g.Unknown data generator 'nonsense': no installed data generator or existing source has that name.That is one extra check (does any source have one of the matched models), and an installed generator without sources keeps returning an empty list. - Fix the tooltip of "Existing data source" (
asset_automations.html, from #2584). It says: "The automation then records what it computes under that same source, alongside the data it already holds." That is unclear (which data, on which sensor?), and with this PR it is no longer true for the aggregator, whose runs can save under a sibling source of another type. For example: "Optional. Reuse the data generator and configuration of an existing data source, instead of setting the two fields below. The results are saved on the sensor named in the parameters, under that source or, if the data calls for another source type, a matching source of the same data generator." - Show, don't hide, the summed forecast in a forecasting picker. With type forecasting, the source picker leaves out the aggregator's forecaster-type source, so a user who sees summed forecasts on the sensor can't find their source and doesn't learn why. Please list it greyed out, with the same message as in point 3 ("Source 6 is not a forecaster, but a reporter computing sums of forecasts. To use this source, set the automation type to "reporting"."), or with a one-click switch to reporting.
- Docs: say why the forecasting tools refuse such a source. In
documentation/features/reporting.rst, "A reporter can also be set up again from such a source, for instance withflexmeasures add report --source <id>, while the forecasting CLI, API and automations refuse it." leaves the reader wondering why a forecaster-type source is refused by forecasting. For example: "Such a source stores a reporter, not a forecaster, so use it to set up a report, for instance withflexmeasures add report --source <id>; the forecasting CLI, API and automations don't accept it." - Accept kebab-case in a reporter's
input, too. While we document these fields more, let's let the reporter'sInputschema (flexmeasures/data/schemas/io.py) take both spellings: kebab-case as the documented one (source-types,exclude-source-types,most-recent-beliefs-only, ...), snake-case still accepted for existing configs (apre_loadmapping would do, refusing a field given in both spellings). And update the docs that advertise the snake-case spelling (reporting.rst,data-pipelining.rst,toy-example-reporter.rst, the tutorial 5 script). This can be a follow-up issue (see also #2540), but then please give it milestone v1.2.0, so it lands in the same version as this PR.
Something we'll pick up ourselves
A rerun from a forecaster-type source on measurements now (rightly) saves under the reporter-type source, and a mixed run under two sources, while flexmeasures add report only says how many beliefs it recorded. We'll add an info-level line saying which source(s) and type(s) a report was saved under (a warning would fire on every mixed run). Not a blocker for this PR.
Follow-up issue (point 8 of my last review: the source description)
Could you open it? Next to the description ("FlexMeasures's AggregatorReporter forecaster" vs "... model"), it could cover a related thing I noticed: an automation lists a single source, while its runs can save under up to three, one per type. Two report automations computing the same sum showed different sources (one set up from the forecaster-type source, one from a data generator and config, which got the reporter-type source), and the second one's forecasts went to the forecaster-type source it doesn't list. Everything is saved correctly; only what an automation shows is off.
It could also consider deriving an automation's type from its source when a source is given (a source that stores a reporter → reporting), refusing only an explicit mismatch, so this wall mostly disappears. That would mean dropping load_default="forecasting" for type in AutomationCreationSchema and falling back to forecasting only when no source is given.
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…e takes it A forecaster-type sum of forecasts stores a reporter, so a forecast automation refuses it; the refusal now says so in the user's terms, and to set the automation type to reporting. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
A name that is neither an installed data generator nor the model of a source the user can list, such as a typo, now gets a 422 rather than an empty list. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
A report from the aggregator can be saved under a sibling source of another type, so the tooltip no longer says that results always go under the picked source. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…picker Such a source is of type forecaster but stores a reporter, so a forecast automation cannot use it; rather than leaving it out, the picker lists it greyed out, saying why and which automation type takes it. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
|
Main is merged, and the API entry now sits under v3.0-38, since v3.0-37 went out on Nov 29. The forecast-automation 422 now says what the source is and to set the type to "reporting". The forecast picker lists such a source greyed out with that same message, and an unknown |
Flix6x
left a comment
There was a problem hiding this comment.
Thanks Mohamed, all eight points of my last review are in. I checked them at d63d1bed2, together with #2948 on top:
- Main is merged, and the
data-generatorentry sits under v3.0-38, which is right, as v3.0-37 shipped on November 29. - A forecast automation set up from a sum of forecasts now gets a 422 that says what the source is and to pick "reporting". The reverse case says "forecasting".
data-generator=nonsensegets a 422, while an installed generator without sources still lists none.- The "Existing data source" tooltip and the docs sentence read well.
- The forecasting source picker lists the summed forecast greyed out, saying why.
- #2946 and #2947 are filed, and the touched tests pass here, as does CI.
One related thing went to #2948 instead: flexmeasures add forecasts --source on such a source crashed with an AttributeError. I pushed a refusal in the automation's words there (f0b0767), with a test.
Keeps both tests at the end of reporting/tests/test_aggregator.py: the one from #2804 and the DST test from this PR. Signed-off-by: F.N. Claessen <claessen@seita.nl>
…tor types Since #2804, an AggregatorReporter saves each event under the type of its inputs, so one reporter records as a forecaster, a reporter or a scheduler. Families of sources were keyed by name, type and model, which split such a reporter into unrelated sources: its versions were not compared, a complete aggregate did not replace a partial one of the same belief time (the higher source id decided), and a search naming both preferred whichever came first. - source_family: name and model, plus the type unless it is a data generator's type; used by _select_latest_version_and_belief_per_event, keep_latest_version and the aggregator's superseding lookup. - Sensor.search_data_sources returns sources in id order, not in whatever order the database returns. - The superseding lookup goes back to one_deterministic_belief_per_event (reverting aafbbef's workaround), which test_a_complete_forecast_supersedes_a_partial_report_recorded_since now passes on its own, too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
* Fill segment overlaps with bfill(axis=1) instead of fillna(method=), which pandas 3 removed * Write hourly resolutions in test fixtures as 1h, because pandas 3 no longer accepts 1H Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Count whole-day resolutions as calendar days in date ranges and resampling Pandas 3 reads timedelta(days=1) as a frequency of a fixed 24 hours, so daily steps would no longer land on local midnights after a DST change, as they did under pandas 2. This would undo #2907 for the GET sensor data endpoint, for example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Return a Timestamp from apply_offset_chain when given a Timestamp A pd.Timestamp is also a datetime, so it was returned as a datetime. With pandas 3's zoneinfo timezones, such a datetime in an hour that a DST change repeats never equals a time in another timezone (PEP 495). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Convert datetimes and timedeltas to epoch values from nanoseconds explicitly Pandas 3 no longer stores them in nanoseconds by default, so chart data and compressed belief records got timestamps in seconds instead of milliseconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Parse timedeltas explicitly before converting their time unit Under pandas 3, text divided by a Timedelta leaves an object dtype rather than floats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Stack annotations that end at the same time, also on pandas 3 Pandas 3 left the grouping column out of each group, and ignored the chained assignment that collected the contents (Copy-on-Write), so only the first annotation's content was shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Index Series by position with iloc, and keep float columns float Pandas 3 reads series[3] as a label rather than a position, and refuses to set a float into an integer column rather than upcasting it. In the storage scheduler, the constant penalty for preferring a full storage sooner was read with iloc[0][0]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Avoid what pandas 3.1 deprecates for pandas 4, so the logs are not flooded with Pandas4Warnings No more inplace reset_index, set_index or rename, positional arguments of sum, implicit sorting in concat, implicit date formats in to_json, Timestamp.utcnow or the d unit alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Changelog entry for pandas 3 support, which includes #2932 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Write epoch milliseconds into JSON records ourselves, as pandas 3.1 deprecates its epoch date format DataFrame.to_json(date_format="epoch") warns on every call under pandas 3.1, and pandas 3 floors negative durations where pandas 2 truncated them toward zero. Converting datetime and timedelta columns to milliseconds ourselves keeps the JSON for charts and annotations exactly as pandas 2 wrote it, without a warning per request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Require timely-beliefs 5.0.0, the first release that supports pandas 3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Lock pandas 3.1.2, so CI and the Docker image run on pandas 3 pyproject still allows pandas 2 (pandas>=2.2.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Changelog: pandas 3 is now the locked version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Rename to_calendar_frequency to to_calendar_offset, and document it as a stepping stone It returns an offset, not a frequency. Its docstring now says it keeps the pandas 2 behaviour rather than converting correctly: a timedelta cannot tell P1D from PT24H, so both count as calendar days, until FlexMeasures keeps nominal and absolute durations apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Test that whole-day resolutions step by calendar days across DST These tests fail on pandas 3 without to_calendar_offset: daily steps would fall at 23:00 after DST ends, and the day DST ends would no longer add up 25 hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Point to_calendar_offset to the issues about nominal durations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v3WRq4uE4AaVmZiHWA Signed-off-by: F.N. Claessen <claessen@seita.nl> * Drop initialize_index's branch for pandas < 1.4, which FlexMeasures no longer supports, and say why timely-beliefs 5.0.0 is required Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl> * Find the partial aggregate a report supersedes by belief time, whatever order its sources come in The lookup used one_deterministic_belief_per_event, which between sources of different types keeps the one listed first. That order came from the database, so a complete forecast saved before could hide a partial report recorded since, and test_a_complete_forecast_supersedes_a_partial_report_recorded_since failed whenever it ran on its own (and once in CI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl> * Count a data generator's sources as one family across the data generator types Since #2804, an AggregatorReporter saves each event under the type of its inputs, so one reporter records as a forecaster, a reporter or a scheduler. Families of sources were keyed by name, type and model, which split such a reporter into unrelated sources: its versions were not compared, a complete aggregate did not replace a partial one of the same belief time (the higher source id decided), and a search naming both preferred whichever came first. - source_family: name and model, plus the type unless it is a data generator's type; used by _select_latest_version_and_belief_per_event, keep_latest_version and the aggregator's superseding lookup. - Sensor.search_data_sources returns sources in id order, not in whatever order the database returns. - The superseding lookup goes back to one_deterministic_belief_per_event (reverting aafbbef's workaround), which test_a_complete_forecast_supersedes_a_partial_report_recorded_since now passes on its own, too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl> --------- Signed-off-by: F.N. Claessen <claessen@seita.nl> Co-authored-by: Furqan Khan <236162110+furqan-khan07@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Description
A community's forecast can be made by summing its houses' forecasts with the
AggregatorReporter, but the sum was saved under areportersource. So FlexMeasures treated it as a report: the chart's tooltip saidType: reporter,source-types: ["forecaster"]filters didn't find it, and a forecast of the community sensor was trained on it, because the forecasting pipeline only leaves out forecaster sources.This PR lets the reporter config say what its report is. For example, with
{"method": "sum", "output-source-type": "forecaster"}the community's sum is saved under a
forecastersource (Type: forecasterin the chart's tooltip), found by forecaster filters, and left out of the community sensor's training data.Saving a report under another source type
output-source-type: any registered kind of data generator (forecaster,reporter,scheduler, or one a plugin adds). An unknown value is refused, naming the valid ones.reporter, keeps the reporter's source as it was: the field has no default andreporteris dropped on load, so existing configs hash the same and keep their sources. Setting another type for an existing reporter starts a new source.Setting the reporter up again from its source
forecasterwith modelAggregatorReporternow finds its reporter, so automations and report reruns keep working. When a source's model is not among the data generators of its own type, the other kinds are searched too. A model found under more than one other kind is refused as ambiguous.forecastersource whose config has nooutput-source-type.AggregatorReporteras a forecasting model. Those still refuse such a source; report paths accept it.Partial aggregates
reporter. It looks the sensor's sources up once, for the stalenesses and the missing members of every type.Picking such a source for a report automation
GET /api/v3_0/sourcesgets agenerator-typefilter: sources whose data generator is of that kind, whatever type they are saved under, e.g.generator-type=reporterlists aforecaster-typeAggregatorReportersource and leaves out aTrainPredictPipelineone. Sources of a non-generator type, such as a demo script named after a reporter, are left out, and an unknown kind gets a 422.The automation source picker uses it instead of the source type, so report automations can pick such a source, and forecast automations no longer list it (they would refuse it).
Docs: a reporting example summing house forecasts into a community forecast, when not to set
output-source-type, and that a forecast whose"auto"entry filters sources doesn't leave out forecasters by default.Behaviour changes
MemberFilterSchema(the aggregator'smembersfilter) derives fromSchemainstead ofReporterConfigSchema, so it doesn't acceptoutput-source-type. It had no other fields from that base.Look and feel
The same hour of a community's summed forecast, before (
Type: reporter) and after (Type: forecaster):Before
After
New automation → Reporting: before, the picker lists only the reporter-type sum; after, the forecaster-type sum, too:
Before
After
New automation → Forecasting: before, the picker lists the summed forecast, which a forecast automation then refuses; after, only the real forecaster:
Before
After
How to test
Or by hand: create a report automation with the
AggregatorReporter, config{"method": "sum", "output-source-type": "forecaster"}, summing two sensors' forecasts ("source_types": ["forecaster"]on each input). After Run now, hovering the output sensor's chart showsType: forecasterfor the sum, and New automation → Reporting lists the source in the picker.Further improvements
"auto"entry filters the target's sources still uses those filters as given, so it may need"exclude-source-types": ["forecaster"]added. This is documented, not changed.Related Items
closes #2785
Sign-off