Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1f53e91
perf: load only the data each asset chart type draws
Ahmad-Wahid Oct 31, 2026
20fc90e
Stop a running replay before switching charts, and name the companion…
Ahmad-Wahid Oct 31, 2026
0b6bf8b
api/v3_0/tests: isolate asset chart data tests with fresh_db
Copilot Oct 31, 2026
9974e13
Load the companion graphs the Charge Points chart draws, whatever the…
Flix6x Nov 2, 2026
320bfb7
Name the asset chart data test module after its fresh_db fixture
Flix6x Nov 2, 2026
b3a8fe3
Accept chart-type on chart_data without a snake_case alias
Flix6x Nov 2, 2026
4349787
Give the chart-type field of chart_data an example
Flix6x Nov 2, 2026
399ed9f
End the :param and :returns lines of chart_sensors with punctuation
Flix6x Nov 2, 2026
d9bca97
Hand the fast chart the Charge Points chart titles from the Python co…
Flix6x Nov 2, 2026
3c590f3
Merge branch 'chart-type-registry' into 2790-on-registry
Flix6x Nov 2, 2026
7466400
Load an asset's chart data by the registry's layout of the chart type…
Flix6x Nov 2, 2026
a7fa042
Hand the fast chart the Charge Points chart's names from the registry…
Flix6x Nov 2, 2026
71af2bd
Name the chart types in the chart_data change log entry by their publ…
Flix6x Nov 2, 2026
18d3be4
Let an asset's fast chart fail loudly without the Charge Points chart…
Flix6x Nov 2, 2026
a8ffb3b
Inline only the data of the sensors a chart type draws, in an asset c…
Flix6x Nov 2, 2026
cee0bd2
Note in the changelog what else holds only a chart's own data now, an…
Flix6x Nov 2, 2026
5346fa1
Note in the API changelog that an asset chart with its data inlines o…
Flix6x Nov 2, 2026
ddc2b6e
Drop a double space from the AssetChartTypeField docstring
Flix6x Nov 2, 2026
a0e25f4
Test that the Charge Points chart's names passed in drive the fast chart
Flix6x Nov 2, 2026
5249165
Leave chart-type on chart_data out of the API docs, for the asset pag…
Flix6x Nov 2, 2026
9249775
Record #2790's final head 5249165a4 as merged, which main holds as sq…
Flix6x Nov 3, 2026
36b3321
Merge branch '2790-on-registry', letting asset chart data rest on the…
Flix6x Nov 3, 2026
4b53db7
Fill in the PR number in the changelog entry
Flix6x Nov 3, 2026
d270088
Merge chart-type-registry, bringing in v1.1.0 from main and the API s…
Flix6x Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions documentation/api/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ API change log
v3.0-35 | XX, 2026
""""""""""""""""""
- ``GET /api/v3_0/assets/<id>/chart`` now takes the public names of the asset chart types as ``chart-type``: ``default`` (the default) and ``charge-point-sessions``. The values it took so far, ``chart_for_multiple_sensors`` and ``chart_for_chargepoint_sessions``, are still accepted, as legacy values for ``default`` and ``charge-point-sessions``, respectively.
- ``GET /api/v3_0/assets/<id>/chart_data`` now accepts ``chart-type``, as ``GET /api/v3_0/assets/<id>/chart`` does, with the same values, and then returns only the data that chart type draws. For ``default``, that leaves out the sensors which appear only in a graph titled "Charge Point sessions"; for ``charge-point-sessions``, it is the charging-session sensors, ``charge points power`` from "Power flow by type", and the "Prices" sensors. An unknown ``chart-type`` gets a ``422``. Without ``chart-type``, or with an empty one, it returns the data of every sensor in the asset's ``sensors_to_show``, as before.
- ``GET /api/v3_0/assets/<id>/chart`` with ``include-data`` now likewise inlines only the data of the sensors the chosen chart type draws, where it used to inline the data of every sensor in the asset's ``sensors_to_show``. Without ``chart-type``, that is the ``default`` chart type.

v3.0-34 | November 05, 2026
""""""""""""""""""""""""""""
Expand Down
1 change: 1 addition & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ v1.2.0 | December xx , 2026
New features
-------------
* Asset and sensor charts have public chart type names (``default`` and ``charge-point-sessions`` for assets; ``bar-chart``, ``histogram``, ``daily-heatmap`` and ``weekly-heatmap`` for sensors), which the chart endpoints document and check, while they still accept the names they took so far; plugins can register their own asset and sensor chart types, which the asset and sensor pages offer where they apply [see `PR #2803 <https://www.github.com/FlexMeasures/flexmeasures/pull/2803>`_]
* The data of an asset's chart can be asked for by the public chart type names, of the built-in chart types and of those that plugins register, and holds only the data of the sensors that chart type draws, also in an asset chart's CSV export and in a chart requested with its data from the API [see `PR #2805 <https://www.github.com/FlexMeasures/flexmeasures/pull/2805>`_]

Infrastructure / Support
-------------------------
Expand Down
23 changes: 9 additions & 14 deletions flexmeasures/api/v3_0/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class AssetChartDataKwargsSchema(EventWindowSchema, BeliefTimeFilterSchema):
"use_latest_version_per_event": "use-latest-version-per-event",
"most_recent_beliefs_only": "most-recent-beliefs-only",
"compress_json": "compress-json",
"chart_type": "chart-type",
}

use_latest_version_per_event = fields.Boolean(
Expand All @@ -289,15 +290,15 @@ class AssetChartDataKwargsSchema(EventWindowSchema, BeliefTimeFilterSchema):
description="If true, compress the JSON response.",
),
)
# For the asset page only, so left out of the API docs (see AssetChartDataOpenAPISchema):
# it takes the public chart type names the asset page sends, and the names of the chart functions it sent in v1.1.0,
# but is not yet validated against the registry of asset chart types (see issue #2802).
chart_type = fields.Str(
chart_type = AssetChartTypeField(
data_key="chart-type",
required=False,
accept_legacy_names=True,
empty_means_absent=True,
metadata=dict(
description="Return only the data that this chart type draws, e.g. 'default' or 'charge-point-sessions'; without it, return the data of every sensor in the asset's sensors_to_show.",
example="default",
description=f"Return only the data of the sensors that this chart type draws: {describe_asset_chart_types(include_legacy_names=True)}. "
"Without it, or with an empty value, return the data of every sensor in the asset's sensors_to_show.",
example=DEFAULT_ASSET_CHART_TYPE,
),
)

Expand Down Expand Up @@ -329,16 +330,10 @@ def __init__(self, *args, **kwargs):


class AssetChartDataOpenAPISchema(AssetChartDataKwargsSchema):
"""Doc-only variant of `AssetChartDataKwargsSchema`; see `AssetChartOpenAPISchema`.

It also hides `chart_type`, which only the asset page uses for now.
"""
"""Doc-only variant of `AssetChartDataKwargsSchema`; see `AssetChartOpenAPISchema`."""

def __init__(self, *args, **kwargs):
kwargs["exclude"] = list(kwargs.get("exclude", [])) + [
"beliefs_after",
"chart_type",
]
kwargs["exclude"] = list(kwargs.get("exclude", [])) + ["beliefs_after"]
super().__init__(*args, **kwargs)


Expand Down
Loading
Loading