Example #1
0
def create_app(context: str = 'prod') -> DashAppInstance:
    """
    create_app initializes the app instance

    Args:
        context (str, optional): One of either 'prod', 'dev', 'testing.
        Defaults to 'prod' where dash.Dash.run_server(debug=False).
        Change to 'dev' or 'test' to set debug to true.

    Returns:
        Env: Config variables based on context argument received
        DashAppInstance: Dash instance with appropriate configuration settings
    """

    Env = from_object(context)

    LANGUAGE = Env.LANG
    body = Root(
        LANGUAGE,
        Parameters.create(os.environ, []),
    )

    App = Dash(
        __name__,
        external_stylesheets=body.external_stylesheets,
        external_scripts=body.external_scripts,
    )

    App.title = Env.CHIME_TITLE
    App.layout = body.html
    wrap_callbacks(App)

    return Env, App
Example #2
0
from penn_chime.models import SimSirModel
from penn_chime.charts import (
    build_admits_chart,
    build_census_chart,
    build_descriptions,
    build_sim_sir_w_date_chart,
    build_table,
)

# This is somewhat dangerous:
# Hide the main menu with "Rerun", "run on Save", "clear cache", and "record a screencast"
# This should not be hidden in prod, but removed
# In dev, this should be shown
st.markdown(hide_menu_style, unsafe_allow_html=True)

d = Parameters.create(os.environ, [])
p = display_sidebar(st, d)
m = SimSirModel(p)

display_header(st, m, p)

st.subheader("New Admissions")
st.markdown(
    "Projected number of **daily** COVID-19 admissions. \n\n _NOTE: Now including estimates of prior admissions for comparison._"
)
admits_chart = build_admits_chart(alt=alt,
                                  admits_floor_df=m.admits_floor_df,
                                  max_y_axis=p.max_y_axis)
st.altair_chart(admits_chart, use_container_width=True)
st.markdown(
    build_descriptions(chart=admits_chart,
Example #3
0
def test_cypress_defaults():
    """Ensure the cypress defaults have been updated."""
    # TODO how to make this work when the module is installed?
    _ = Parameters.create({"PARAMETERS": "./defaults/cypress.cfg"}, [])