Pick already fixed version
@@ -14,11 +14,7 @@ from chime_dash.app.components.tool_details import ToolDetails
from chime_dash.app.components.intro import Intro
from chime_dash.app.components.visualizations import Visualizations
-from chime_dash.app.utils import (
- get_n_switch_values,
- parameters_deserializer,
- prepare_visualization_group,
-)
+from chime_dash.app.utils import get_n_switch_values, parameters_deserializer, prepare_visualization_group
from chime_dash.app.utils.callbacks import ChimeCallback
from penn_chime.models import SimSirModel
@@ -49,23 +45,24 @@ class Index(Component):
pars = parameters_deserializer(pars_json)
model = SimSirModel(pars)
viz_kwargs = dict(
- labels=pars.labels, table_mod=7, max_y_axis=pars.max_y_axis,
+ labels=pars.labels,
+ table_mod=7,
+ max_y_axis=pars.max_y_axis,
)
result.extend(self.components["intro"].build(model, pars))
result.extend(self.components["tool_details"].build(model, pars))
for df_key in ["admits_df", "census_df", "sim_sir_w_date_df"]:
- df = model.__dict__.get(df_key, None) if model is not None else None
+ df = None
+ if model:
+ df = model.__dict__.get(df_key, None)
result.extend(prepare_visualization_group(df, **viz_kwargs))
return result
- super().__init__(
- language,
- defaults,
- [
+ super().__init__(language, defaults, [
ChimeCallback( # If user toggles show_additional_projections, show/hide the additional intro content
changed_elements=OrderedDict(show_tool_details="value"),
dom_updates=OrderedDict(more_intro_wrapper="hidden"),
- callback_fn=Index.toggle_tool_details,
+ callback_fn=Index.toggle_tool_details
),
ChimeCallback( # If user toggles show_tables, show/hide tables
changed_elements=OrderedDict(show_tables="value"),
@@ -74,7 +71,7 @@ class Index(Component):
new_admissions_table_container="hidden",
admitted_patients_table_container="hidden",
),
- callback_fn=Index.toggle_tables,
+ callback_fn=Index.toggle_tables
),
ChimeCallback( # If the parameters or model change, update the text
changed_elements=OrderedDict(pars="children"),
@@ -91,10 +88,9 @@ class Index(Component):
SIR_table="children",
SIR_download="href",
),
- callback_fn=handle_model_change_helper,
- ),
- ],
+ callback_fn=handle_model_change_helper
)
+ ])
self.components = OrderedDict(
header=Header(language, defaults),
intro=Intro(language, defaults),
@@ -108,16 +104,22 @@ class Index(Component):
"""
content = Main(
className="py-5",
- style={"marginLeft": "320px", "marginTop": "56px"},
- children=[
- Container(
- children=self.components["header"].html
+ style={
+ "marginLeft": "320px",
+ "marginTop": "56px"
+ },
+ children=
+ [Container(
+ children=
+ self.components["header"].html
+ self.components["intro"].html
+ self.components["tool_details"].html
- )
- ]
+ )]
+ self.components["visualizations"].html
- + [Container(children=self.components["footer"].html)],
+ + [Container(
+ children=
+ self.components["footer"].html
+ )],
)
return [content]
