Datatable updation and Plotting from a file in datatable

Hi

I am trying to build a basic CRUD app where some data is input and using the data some plots are generated.

Clone link:

https://anvil.works/build#clone:PL4RM3BSN5W4UFXR=RL3QTSDME2LFYARX5TQFSB57

I have two issues:
a.) Updating a existing row in the data table does not always work. I am not sure if there is a way to generate unique row id but every so often I get “Row does not exist” error. For example, in the clone, if you click on the edit of any row, it works. But if you click on the “Zoom in” button and do update, it does not. Not sure what I am doing wrong.

b.) I have a trajectory file in excel/csv. I would like to do some calculations on this file and plot the outputs. Right now, I am uploading the file, reading it with pandas and returning plotly plot data. But it feels very cumbersome. Is there a more elegant way of doing this? Also, at a later stage if I want to update my calculations, I have to reopen the file from the database and do this all over again. Is it better to store the file as a dataframe/dictionary object directly?

Thanks for your help.

Regards

a) Every row already has a unique id. From Getting One Row from a Table:

Row IDs

Each row of each table has unique ID, which is a string. You can get the ID of any row, and use it to retrieve that row later.

b) Within limits, you can store a dict in a Simple Object column. Behind the scenes (in the database), it’s a JSON document, so you’re largely limited to JSON’s data types in your dict. See Column types

When you zoom, you are copying the row to a dict. It is no longer a row, so has_row returns False. For has_row to work, you have to not convert the row to a dict. Just pass it around as the row itself.