예제 #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, get_defaults())

    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
예제 #2
0
from penn_chime.national_data import get_national_data
from penn_chime.dummy_data import prep_dummy_data
from penn_chime.hc_param_import_export import param_download_widget

# 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
hide_menu_style = """
<style>
#MainMenu {visibility: hidden;}
</style>
"""
st.markdown(hide_menu_style, unsafe_allow_html=True)

d = get_defaults()
p, actuals, mode = display_sidebar(d)
display_app_title()
display_app_description()
display_disclaimer()

if mode == Mode.EMPIRICAL:
    ## Logic to control whether we use county data or actuals. For now we are only using county data.
    # if actuals == None:
    #     # Display a placeholder instructing the user to upload actuals
    #     # so we can run the model and display the projections
    #     display_user_must_upload_actuals()
    # else:
    #     if EmpiricalModel.can_use_actuals(actuals):
    #         # Use Actuals
    #     else:
예제 #3
0
"""
chime_dash/app

dash instance defined here
"""

from dash import Dash
from typing import TypeVar
from chime_dash.app.config import from_object
from penn_chime.settings import get_defaults
from chime_dash.app.components import Body
from chime_dash.app.utils.callbacks import wrap_callbacks

DashAppInstance = TypeVar('DashAppInstance')
DEFAULTS = get_defaults()

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)