Exemple #1
0
def plot_total_cases(country):
    data.process_data(country)
    model = Model(data.dtf)
    model.forecast()
    model.add_deaths(data.mortality)
    result = Result(model.dtf)
    # Python function to plot active cases
    return result.plot_total(model.today)
Exemple #2
0
def plot_active_cases(country):
    data.process_data(country)
    model = Model(data.dtf)
    model.forecast()
    model.add_deaths(data.mortality)
    result = Result(model.dtf)
    # Python function to render output panel
    return result.plot_active(model.today)
Exemple #3
0
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