How to modifiy data points values in a database by click on a plotly graph

Hello dear community,

I am looking for a clever/interactive way to modify the wrong values in a database by clicking on the plotly graph showing them. In other words, I want to add a sort of data modification zone, preferably on top of my plotly graphs (maybe a form with submit button or so … ? )
For now, I am able to access the data point informations when clicking on it using the clickData property of the graph.
Here is a simplified version of the callback function I used.

@app.callback(
    Output('output', 'children'),
    [Input('graph_interaction', 'clickData')])
def update_output(clickData):
    if clickData:
        point_index = clickData['points'][0]['pointIndex']
        point_value = clickData['points'][0]['y']
        print(clickData)

        # update the point value in the database using SQLAlchemy
        # ...

        return 'You clicked on data point {} with value {}'.format(point_index, point_value)
    return ''

Any insights on how to add a modification area (form ?) to interact with the database and modify wrong values ?
Thank you

Hello @AitAhmed,

Your idea sounds good.

A form where you populate the info and then you can change it, would work nicely. You could even pull extra data from the database if you wanted to.