Iāve created some scripts using Python dash library.
It creates graphs using some testing json information(these jsons are results of another Python scripts - letās call them clients).
This part works fine.
Also, I have a REST API which runs on the separate host. It should collect results from clients and displays them using Dash.
My workflow looks like this:
- Iām running scripts on different clients.
- All these clients collect their statistics (and are able to create layouts in dash format, if needed)
- Sends results of execution from each client into REST API (json or dash-layout)
- A well-formatted report should be available using the browser. E.g.:
http://localhost:8050/client_reports/
Itāll be improved, but for the first version it might show the result of the latest client (in the final version all reports from all clients will be available)
So, currently I have:
-
Scripts on clients which runs fine
-
Functionality which generates json or dash-layout statistics (e.g.:
"Div(children=[H1(children='My fantastic report', style={'color': '#7FDBFF', 'textAlign': 'center'}), style={'backgroundColor': '#111111'})"
-
REST API (Flask app) - I can easily add endpoints for GET/POST request with dash-layout string.
-
Dash application which runs on the separate endpoint of my web server with a basic dash-layout.
The question is:
Is there any ability to update dash-layout during runtime?
E.g.: Iāve started my REST API with the base layout.
After then Iāll run my scripts on the client side, collect statistics, send these data into additional endpoint using POST request.
Then there should be some callback, etc. in the dash application side, which serves data using GET requests (it might be implemented in another way, but I think in this direction) and updates:
app.layout = requests.get('http://localhost:8050/client_reports_data/")
And sending new requests via browser into an appropriate endpoint should display updated info:
http://localhost:8050/client_reports/
Any ideas?