コード例 #1
0
ファイル: dash.py プロジェクト: ElPala/Urban_Lab_App
def render_output_panel(country):
    data.process_data(country)
    model = Model(data.dtf)
    model.forecast()
    model.add_deaths(data.mortality)
    result = Result(model.dtf)
    peak_day, num_max, total_cases_until_today, total_cases_in_30days, active_cases_today, active_cases_in_30days = result.get_panel()
    peak_color = "white" if model.today > peak_day else "red"
    panel = html.Div([
        html.H4(country),
        dbc.Card(body=True, className="text-white bg-primary", children=[
            html.H6("Total cases until today:", style={"color": "white"}),
            html.H3("{:,.0f}".format(total_cases_until_today),
                    style={"color": "white"}),

            html.H6("Total cases in 30 days:", className="text-danger"),
            html.H3("{:,.0f}".format(total_cases_in_30days),
                    className="text-danger"),

            html.H6("Active cases today:", style={"color": "white"}),
            html.H3("{:,.0f}".format(active_cases_today),
                    style={"color": "white"}),

            html.H6("Active cases in 30 days:", className="text-danger"),
            html.H3("{:,.0f}".format(active_cases_in_30days),
                    className="text-danger"),

            html.H6("Peak day:", style={"color": peak_color}),
            html.H3(peak_day.strftime("%Y-%m-%d"),
                    style={"color": peak_color}),
            html.H6("with {:,.0f} cases".format(
                num_max), style={"color": peak_color})

        ])
    ])
    return panel