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

Support power figures through the API #38

Closed
nhoening opened this issue Feb 19, 2021 · 2 comments
Closed

Support power figures through the API #38

nhoening opened this issue Feb 19, 2021 · 2 comments
Assignees
Labels

Comments

@nhoening
Copy link
Contributor

To empower third-party app building on top of FlexMeasures, we'll make it possible to load our figures through the FlexMeasures API.

This ticket is about the most important figure (power data). It establishes the new practice that the ui package also offers API endpoints, something which we will build out more powerful in the future (see below).

The new endpoint

Here is how the endpoint will look:

GET /charts/data/power

with a JSON body including details about which dataset to load:

{
    "resource": ....,
    "start_time": ...,
    "end_time": ....,
    "resolution": ...,
    "consumption_as_positive": true
}

The endpoint returns custom Javascript and HTML data (TODO: figure out how to send that safely through HTTP). Developers will then only need to include Bokeh CSS and JS in their HTML and the figure will show.

The new endpoint will use data.services.analytics.get_power_data and ui.views.analytics.make_power_figure.

It will be added to the API routes. I checked, and this is compatible with our plans to document all API endpoints with OpenAPI using the ApiSpec package (see #17).

Future work: more powerful chart API and more responsive figures

For the record, we have ongoing efforts for a more powerful charts API, like this:

GET /chart/<data_structure>/<chart_type>/<dataset_name>/<agg_demand_unit>

where developers can configure charts aspects of the charts. It will be based on Vega-Lite instead of Bokeh.

Data will then be loaded with a second endpoint, which allows for more interactive apps. See the charts-api branch.

@nhoening nhoening self-assigned this Feb 20, 2021
@create-issue-branch
Copy link
Contributor

Branch issue-38-Support_power_figures_through_the_API created!

@nhoening
Copy link
Contributor Author

closed by #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant