Skip to content

fix(assets): select one deterministic belief per event in KPI endpoint (#2471) - #2488

Closed
taran-dev4u wants to merge 1 commit into
FlexMeasures:mainfrom
taran-dev4u:fix/kpi-single-deterministic-belief-per-event
Closed

fix(assets): select one deterministic belief per event in KPI endpoint (#2471)#2488
taran-dev4u wants to merge 1 commit into
FlexMeasures:mainfrom
taran-dev4u:fix/kpi-single-deterministic-belief-per-event

Conversation

@taran-dev4u

Copy link
Copy Markdown
Contributor

Closes #2471.

In [GET] /assets/<id>/kpis, sensor.search_beliefs was called with most_recent_beliefs_only=True without setting one_deterministic_belief_per_event=True. For sensors with multiple data sources reporting beliefs about the same event, beliefs across all sources were retained and summed together, causing event values to be double counted.

This adds one_deterministic_belief_per_event=True to the KPI search query so only a single deterministic belief per event is included in the aggregation, and adds a regression test in test_assets_api.py.

FlexMeasures#2471)

Signed-off-by: Taran Mamidala <mamidalataran6333@gmail.com>
@taran-dev4u
taran-dev4u force-pushed the fix/kpi-single-deterministic-belief-per-event branch from ed66ca9 to 1d4e193 Compare September 7, 2026 16:07
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #34435308 | 📁 Comparing 1d4e193 against latest (46ad3ae)

  🔍 Preview build  

2 files changed
± changelog.html
± api/v3_0.html

@Flix6x

Flix6x commented Sep 9, 2026

Copy link
Copy Markdown
Member

Thanks for taking this on, and for spotting the same root cause we did — the missing one_deterministic_belief_per_event=True is exactly right.

A fix for #2471 was already in flight in #2472, which has since been merged, so this one is superseded. Closing, but the contribution is appreciated — hope to see you in another issue!

@Flix6x Flix6x closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A KPI sums across data sources, so one event reported twice is counted twice

2 participants