✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Dash not updating source data with interval

Hi guys, hope you can help me out with a problem here, I am trying to call an API every 33 minutes to update the data in my app, here is a problem, obviously it works in the virtual environment every time i run the server but when i pass the interval to the callback function nothing seems to happen,

api_response = requests.get( ‘https://services9.arcgis.com/pJENMVYPQqZZe20v/arcgis/rest/services/province_daily_totals/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=json’)
bc = json_normalize(api_response.json()[‘features’])

then i do some data aggregations and end up with a df, none of this is in a function, they are more like global variable, when the interval get to the callback function:

[Output(component_id=‘slider-graph’, component_property=‘figure’), Output(‘second-result’, ‘children’),
Output(‘third’, ‘children’), Output(‘fourth’, ‘children’), Output(‘charts’, ‘style’), Output(“fifth”, ‘children’)],
[Input(component_id=‘input’, component_property=‘value’), Input(‘interval-component’, ‘n_intervals’)]
def update(value, n_intervals):
x = bc[bc[‘attributes.Province’] == value][‘attributes.SummaryDate’]
y = bc[bc[‘attributes.Province’] == value][‘attributes.DailyTotals’]
y2 = bc[bc[‘attributes.Province’] == value][‘attributes.DailyRecovered’]

if value:
   return something
elif value is None or n_interval:
   """so basically if there is no selection do not show up the entire section or charts"""

the problem is i also have a n user interaction dropdown menu, but i would not want to hit the API after they select the dropdown value but only with the interval, is there a way to call the API only in the interval time but the data can be available all the time for the user interaction?