I am sharing a dataframe using a hidden div ‘twitter_data_df’ in the index file.
Now in one of my apps the only 3 callbacks react to the dataframe whereas other callbacks are not even activated.
@app.callback(Output('output','children'),
[Input('twitter_data_df','children'),])
def update_data(df):
print('File Loaded Successfully')
return 'File Loaded Successfully'
@app.callback(Output('posts','children'),
[Input('twitter_data_df','children')])
def update_posts(df):
if df is None:
raise PreventUpdate
print('Post Initiated')
df = pd.read_json(df,orient='split')
return df['tweet_id'].nunique()
@app.callback(Output('users','children'),
[Input('twitter_data_df','children')])
def update_users(df):
if df is None:
raise PreventUpdate
df = pd.read_json(df,orient='split')
return df['author_id'].nunique()
@app.callback(Output('engagement','children'),
[Input('twitter_data_df','children')])
def update_engagement(df):
if df is None:
raise PreventUpdate
df = pd.read_json(df,orient='split')
return df['favourite_count'].sum()
@app.callback(Output('retweets','children'),
[Input('twitter_data_df','children')])
def update_retweet(df):
if df is None:
raise PreventUpdate
df = pd.read_json(df,orient='split')
return df['retweet_count'].sum()
The first callback update_data is not initiated. Only the next three callbacks are initiated. This applies to all the other callbacks also. Only these 3 out of 10 callbacks are activated.