We are building quite an extensive app that allows a user to upload his own set of data to complement the one we provided.
Since the user data must be protected, we plan to store it in a dataframe that would be called based on the user IP retrieved with the help of flask. However this data should exist only as long as the user is connected to the app which is not the case with my solution. On top of that, the data must be accessible through several tabs in our tab.
Is there a better solution to do what I am trying to do and matching my constraints?
Thanks a lot!
PS: that’s just insane what you can do with dash, and so easy to use once you understand callbacks, keep going with the great work!
However, I am not quite sure I am understanding properly.
The idea is to attribute to each user a unique session id, that is stored in a hidden div. That means that each sessions should have different hidden div children, am I right? When I am doing this, I find the same session_id for all my sessions.
I used the same layout as yours:
def serve_layout():
# User specific ID
session_id = str(uuid.uuid4())
print(session_id)
return html.Div([html.Div(session_id, id='session-id', style={'display': 'none'}),])
app.layout = serve_layout()
Using your example directly, I see the same exact results in both session. Am I missing something obvious?
On top of that, I carry objects instead of dataframe. Would that work too, it seems that you pass it to JSON format and serialize the data.
Finally, I don’t quite get where the data get removed once the session is over. I assume it is hidden in the decorator @cache.memoize(). But since you have one master dataframe containing the data of all user, this dataframe never gets destroyed. What am I missing to understand that point?
The method with str(uuid.uuid4()) was somehow constantly giving me the same ID to each sessions.
The problem I have is that I am using tabs, and need to keep user specific data accessible to each tab.
I already use a global variable that is shared everywhere and modify nowhere so that users do not interacts with each other and that contains data accessible to everyone, the ‘base’ data.
I wish to have a second object containing user specific data that can be passed around.
I tried your method on many attempts but never succeeded to pass it to all Tabs. What would be the best way to do so? Keeping the data in a div, and how would I do that properly? Doing so, I wouldn’t have to use the cache and knowing the IP, right? Is there a better way?