예제 #1
0
def main():
    if not os.path.isdir('html_temp'):
        os.mkdir('html_temp')
    df_states = common.make_dataframe(get_state_data())
    df_us = common.make_dataframe(get_us_data(), us=True)
    for i in [('deaths', 'states_deaths.html'),
              ('cases', 'states_cases.html')]:
        grid = all_states(df_states, df_us, key_territory='state', key=i[0])
        script, div = components(grid)
        html = get_html(script, div, the_type='deaths')
        with open(os.path.join('html_temp', i[1]), 'w') as write_obj:
            write_obj.write(html)
예제 #2
0
def make_rt_html(window = 3):
    window = int(variables.values['rt_window'])
    if not os.path.isdir('html_temp'):
        os.mkdir('html_temp')
    df_states = common.make_dataframe(get_state_data(test = False))
    #make CSV
    rates(df_states,  min_value = 0, window = window)
    date = datetime.datetime.now()
    for i in [('deaths', 'states_deaths_rt.html', 'Death Rate', 'deaths', ), 
            ('cases', 'states_cases_rt.html', 'Cases Rate', 'cases')]:
        grid = all_states(df_states = df_states, key = i[0], min_value = 0, 
                window = window)
        script, div = components(grid)
        html = get_html(script, div, date, i[2], the_type = i[3])
        with open(os.path.join('html_temp', i[1]), 'w') as write_obj:
            write_obj.write(html)
예제 #3
0
def make_washington_graphs():
    if not os.path.isdir('html_temp'):
        os.mkdir('html_temp')
    df_states = common.make_dataframe(get_state_data())
    df_counties = make_dataframe_wash_order()
    p_counties = common.graph_wash_county_order(df=df_counties,
                                                start=3,
                                                plot_height=450,
                                                line_width=40)
    df_state = df_states[(df_states['state'] == 'Washington')]
    p_all = common.incidents_over_time_bar(df_state,
                                           key='deaths',
                                           window=3,
                                           plot_height=600,
                                           plot_width=600,
                                           title=None)
    grid = gridplot([p_all, p_counties], ncols=4)
    script, div = components(grid)
    html = get_html(script, div, title='Washington')
    with open('html_temp/wa', 'w') as write_obj:
        write_obj.write(html)
예제 #4
0
def main(window=3):
    df_countries = common.make_dataframe(get_country_data(test=False),
                                         country=True)
    rates(df_countries, min_value=0, window=window)
    grid = all_countries(df=df_countries,
                         key='deaths',
                         min_value=0,
                         window=window)
    grid2 = all_countries(df=df_countries,
                          key='cases',
                          min_value=0,
                          window=window)
    show(grid2)
    return
    script, div = components(grid)
    script2, div2 = components(grid2)
    with open('html_temp/states_deaths_rt.js', 'w') as write_obj:
        write_obj.write(script)
    with open('html_temp/states_deaths_rt.div', 'w') as write_obj:
        write_obj.write(div)
    with open('html_temp/states_cases_rt.js', 'w') as write_obj:
        write_obj.write(script2)
    with open('html_temp/states_cases_rt.div', 'w') as write_obj:
        write_obj.write(div2)
예제 #5
0
def main():
    df_states_week = get_state_data_week()
    df_states_day = common.make_dataframe(get_state_data_day())
    all_states(df_week=df_states_week, df_day=df_states_day)
예제 #6
0
def main():
    df_states = common.make_dataframe(common.get_state_data())
    grid = all_states(df_states)
    show(grid)