src/pages/dashboard.py
def load_day_change(time_series_dict, keys, granularity, country=None):
    """
    Function computes the delta change in confirmed, deaths, recovered and active cases over a single day

    :param time_series_dict: dict
    :param keys: list
    :param granularity: str
    :param country: str
    :return: plotly.figure
    """
    response_dict = {}
    PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
    local_css(PATH + "/style.css")
    curr = 0
    prev = 0
    for key in keys:
        if granularity == "Country":
            _, temp = plot_timeline(time_series_dict[key], key, country=country)
        else:
            _, temp = plot_timeline(time_series_dict[key], key)
        prev = temp.iloc[-2, -2]
        curr = temp.iloc[-1, -2]
        if (curr - prev) >= 0:
            arrow = "&uarr;"
        else:
            arrow = "&darr;"
        response_dict[key] = [arrow, abs(curr - prev)]

    val = response_dict["Confirmed"][1] - response_dict["Deaths"][1] - response_dict["Recovered"][1]
    if val >= 0:
        response_dict["Active"] = ["&uarr;", abs(val)]
    else:
        response_dict["Active"] = ["&darr;", abs(val)]

    st.write("\n")
    st.write("\n")
    t = (
        f"<div><span class='highlight blue'>Active:  <span class='bold'>{response_dict['Active'][0]} {response_dict['Active'][1]}</span> </span>"
        f"<span class='highlight orange'>Confirmed:  <span class='bold'>{response_dict['Confirmed'][0]} {response_dict['Confirmed'][1]}</span> </span>"
        f"<span class='highlight red'>Deaths:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Deaths'][1]}</span> </span> "
        f"<span class='highlight green'>Recovered:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Recovered'][1]}</span> </span></div>")

    st.markdown(t, unsafe_allow_html=True)

    Function computes the delta change in confirmed, deaths, recovered and active cases over a single day

    :param time_series_dict: dict
    :param keys: list
    :param granularity: str
    :param country: str
    :return: plotly.figure
    
Function computes the delta change in confirmed, deaths, recovered and active cases over a single day
Function computes the delta change in confirmed deaths recovered and active cases over a single day
def load_day_change(time_series_dict, keys, granularity, country=None):
    response_dict = {}
    PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
    local_css(PATH + "/style.css")
    curr = 0
    prev = 0
    for key in keys:
        if granularity == "Country":
            _, temp = plot_timeline(time_series_dict[key], key, country=country)
        else:
            _, temp = plot_timeline(time_series_dict[key], key)
        prev = temp.iloc[-2, -2]
        curr = temp.iloc[-1, -2]
        if (curr - prev) >= 0:
            arrow = "&uarr;"
        else:
            arrow = "&darr;"
        response_dict[key] = [arrow, abs(curr - prev)]
    val = response_dict["Confirmed"][1] - response_dict["Deaths"][1] - response_dict["Recovered"][1]
    if val >= 0:
        response_dict["Active"] = ["&uarr;", abs(val)]
    else:
        response_dict["Active"] = ["&darr;", abs(val)]
    st.write("\n")
    st.write("\n")
    t = (
        f"<div><span class='highlight blue'>Active:  <span class='bold'>{response_dict['Active'][0]} {response_dict['Active'][1]}</span> </span>"
        f"<span class='highlight orange'>Confirmed:  <span class='bold'>{response_dict['Confirmed'][0]} {response_dict['Confirmed'][1]}</span> </span>"
        f"<span class='highlight red'>Deaths:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Deaths'][1]}</span> </span> "
        f"<span class='highlight green'>Recovered:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Recovered'][1]}</span> </span></div>")
    st.markdown(t, unsafe_allow_html=True)
def load_day_change ( time_series_dict , keys , granularity , country = None ) : response_dict = { } PATH = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , '../../' ) ) local_css ( PATH + "/style.css" ) curr = 0 prev = 0 for key in keys : if granularity == "Country" : _ , temp = plot_timeline ( time_series_dict [ key ] , key , country = country ) else : _ , temp = plot_timeline ( time_series_dict [ key ] , key ) prev = temp . iloc [ - 2 , - 2 ] curr = temp . iloc [ - 1 , - 2 ] if ( curr - prev ) >= 0 : arrow = "&uarr;" else : arrow = "&darr;" response_dict [ key ] = [ arrow , abs ( curr - prev ) ] val = response_dict [ "Confirmed" ] [ 1 ] - response_dict [ "Deaths" ] [ 1 ] - response_dict [ "Recovered" ] [ 1 ] if val >= 0 : response_dict [ "Active" ] = [ "&uarr;" , abs ( val ) ] else : response_dict [ "Active" ] = [ "&darr;" , abs ( val ) ] st . write ( "\n" ) st . write ( "\n" ) t = ( f"<div><span class='highlight blue'>Active:  <span class='bold'>{response_dict['Active'][0]} {response_dict['Active'][1]}</span> </span>" f"<span class='highlight orange'>Confirmed:  <span class='bold'>{response_dict['Confirmed'][0]} {response_dict['Confirmed'][1]}</span> </span>" f"<span class='highlight red'>Deaths:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Deaths'][1]}</span> </span> " f"<span class='highlight green'>Recovered:  <span class='bold'>{response_dict['Deaths'][0]} {response_dict['Recovered'][1]}</span> </span></div>" ) st . markdown ( t , unsafe_allow_html = True )
Function computes the delta change in confirmed, deaths, recovered and active cases over a single day
Function computes the delta change in confirmed deaths recovered and active cases over a single day
"""
    Function computes the delta change in confirmed, deaths, recovered and active cases over a single day

    :param time_series_dict: dict
    :param keys: list
    :param granularity: str
    :param country: str
    :return: plotly.figure
    """
None
time_series_dict
None
keys
None
granularity
None
country
None