Hi,
I’ve a data cube with a “Python Data Generation” node that calls an api, what I need to do is pass a value to the “Python Data Generation” that will be passed to the api call as a parameter. The “Python Data Generation” script is:
import requests
import json
import datetime
from pandas.io.json import json_normalize
url = ‘http://pedroccpimenta.somee.com/sciame/consumodia.asp?CPE=’ + $local$
res = requests.get(url)
json_content = json.loads(res.text)
df = json_normalize(json_content[‘dados’])
df[‘data’] = df[‘dia’].apply(lambda x: datetime.datetime.fromtimestamp(int(x)).date())
df = df.drop([‘dia’], axis=1)
return df
The $local$ is a placeholder connected to a bridge parameter.
I’ve a dashboard with a visualization that uses the data cube with the “Python Data Generation” and another that has all the possible values for the $local$. Given this, I need to create a filter interaction that will pass the selected element to the underlying data cube (the one that has the “Python Data Generation”) to the $local$ placeholder to filter the api return based on the selected element.
PS: The visualization that has all the possible values for $local$ comes from another data cube.
How can I achieve this?
Thanks,
Luis Silva