The more flat file structure works, thank you. My project directory is now essentially the same as above.
However, I have still not achieved my goal of filtering a dataframe [rather than a specific graph]. My use case is as follows:
A switch [eventually a number of switches] that filter the data based on a mask that is applied to the frame. In this case, the feature is “ac”, which has values of either 0 or 1. The default is for the mask to be > -1, and when the switch is turned, the mask becomes > 0.
ac_switch = html.Div([
html.P("air conditioning"),
daq.BooleanSwitch(on=False, color="purple", id="ac_bool")
], className="navbar_flex_baby flex_daddy space_between")
the callback is meant to perform this action:
@callback(
Output(component_id="placeholder", component_property="children"),
Input(component_id="ac_bool", component_property="on")
)
def update_bool(on):
if on:
ac_flag = 0
else:
ac_flag = -1
with the output specified as a placeholder and the real change happening to the ac_flag directly. The mask is listed below the callback, though I have tried both above and below to no avail.
mask1 = (df["ac"] > ac_flag)
mask2 = (df["wheelchair"] > wheelchair_flag)
mask3 = (df["parking"] > parking_flag)
mask4 = (df["garden"] > garden_flag)
mask5 = (df["wine"] > wine_flag)
mask6 = (df["terrace"] > terrace_flag)
mask7 = (df["valet"] > valet_flag)
mask8 = (df["vegetarian"] > vegetarian_flag)
mask9 = (df["counter"] > counter_flag)
mask10 = (df["view"] > view_flag)
mask11 = (df["noshoes"] > noshoes_flag)
mask12 = (df["cashonly"] > cashonly_flag)
mask13 = (df["sake"] > sake_flag)
df = df[mask1
& mask2
& mask3
& mask4
& mask5
& mask6
& mask7
& mask8
& mask9
& mask10
& mask11
& mask12
& mask13
]
df_filtered = df
The file structure of this is as below:
Project
| - load_data.py
| - filter_dataframe.py `[just the applicable component and callback]`
| - featureengineering.py
| - components.py
| - index.py
| - server.py
| - app.py
The data imports from the top file to the bottom file in that list, until it reaches index.py, at which point both server and index are imported to app.py, and app.py is run. The app loads fine. But the updated dataframe is not being passed on to the components.
Any ideas on why this callback is not registering?