Ejemplo n.º 1
0
def get_test_vol(show_plot=False, show_table=False):
    test_metrics_file = "./data/TABLE_DAILY_TESTING_METRICS.csv"
    test_metrics_headers = [
        "Total", "PCR_Tests", "Antigen_Tests", "Pos_Percent"
    ]

    test_metrics_daily_df = load_ncdhhs_data(test_metrics_file,
                                             test_metrics_headers,
                                             show_table=False)

    test_metrics_weekly_df = aggregate_weekly(test_metrics_daily_df,
                                              'Total',
                                              show_table=False)

    test_metrics_lowess_df = dataframe_lowess(test_metrics_weekly_df,
                                              y_col_name='Total',
                                              x_col_name='Week',
                                              frac_in=0.1,
                                              show_plot=show_plot,
                                              show_table=False)

    test_metrics_lowess_df.iat[0, 2] = test_metrics_lowess_df.iat[0, 0]

    adj_index = test_metrics_lowess_df.index
    adj_index.strftime('% B % d, % Y, % r')
    test_metrics_lowess_df['DateString'] = adj_index

    if show_table:
        print(test_metrics_lowess_df)

    return test_metrics_lowess_df
Ejemplo n.º 2
0
def get_hospital_stats(show_plot=False, col_select = 'Inpatient_Beds_Used'):
	hospital_stats_file = "./data/HOSPITAL_BEDS_VENTILATORS.csv"
	hospital_stats_headers = ["Vents_Used", "Vents_Avail","ICU_Beds_Used", 
								"ICU_Beds_Empty_Staffed", "Inpatient_Beds_Used", 
								"Inpatient_Beds_Empty_Staffed"]	

	hospital_stats_daily_df = load_ncdhhs_data(hospital_stats_file,
												hospital_stats_headers,
												show_table=False)

	# Drop all rows with NaN
	hospital_stats_daily_df = hospital_stats_daily_df.dropna(axis=0, how='any')

	# Create a sequence of integers to reference as week from start
	hospital_stats_daily_df['Day'] = range(1,len(hospital_stats_daily_df) + 1)

	# Add in unstaffed - this is probably not quite right - but close	
	hospital_stats_daily_df["ICU_Unstaffed"] = 1039
	hospital_stats_daily_df["Inpatient_Beds_Unstaffed"] = 4295


	hospital_stats_daily_lowess_df = dataframe_lowess(hospital_stats_daily_df,
												y_col_name= col_select,
												x_col_name='Day',
												frac_in=0.3,
												show_plot=show_plot,
												show_table=False)
	adj_index = hospital_stats_daily_lowess_df.index
	adj_index.strftime('% B % d, % Y, % r')
	hospital_stats_daily_lowess_df['DateString'] = adj_index

	return hospital_stats_daily_lowess_df
Ejemplo n.º 3
0
def get_deaths(show_plot=False, show_table=False):
    cases_deaths_file = "./data/TABLE_DAILY_CASE&DEATHS_METRICS.csv"
    cases_deaths_headers = ["Cases", "PCR", "Antigen", "Deaths"]
    cases_deaths_daily_df = load_ncdhhs_data(cases_deaths_file,
                                             cases_deaths_headers,
                                             show_table=show_table)

    deaths_weekly_df = aggregate_weekly(cases_deaths_daily_df,
                                        'Deaths',
                                        show_table=show_table)

    deaths_lowess_df = dataframe_lowess(deaths_weekly_df,
                                        y_col_name='Deaths',
                                        x_col_name='Week',
                                        frac_in=0.2,
                                        it_in=0,
                                        show_plot=show_plot,
                                        show_table=show_table)
    deaths_lowess_df = deaths_lowess_df.drop(deaths_lowess_df.index[[0, 1]])

    deaths_lowess_df['Week'] = range(1, len(deaths_lowess_df) + 1)

    adj_index = deaths_lowess_df.index
    adj_index.strftime('% B % d, % Y, % r')
    deaths_lowess_df['DateString'] = adj_index

    if show_table:
        print(deaths_lowess_df)

    return (deaths_lowess_df)
Ejemplo n.º 4
0
def get_hospital_metrics(show_plot=False, col_select="Hospitalizations"):
	hospital_metrics_file = "./data/HOSPITAL_METRICS_STATE.csv"
	hospital_metrics_headers = ["Hospitalizations", "ICU", "Confirmed", "Suspected"]

	hospital_metrics_daily_df = load_ncdhhs_data(hospital_metrics_file,
												hospital_metrics_headers,
												show_table=False)

	# Drop all rows with NaN
	hospital_metrics_daily_df = hospital_metrics_daily_df.dropna(axis=0, how='any')

	# Create a sequence of integers to reference as week from start
	hospital_metrics_daily_df['Day'] = range(1,len(hospital_metrics_daily_df) + 1)	

	hospital_metrics_daily_lowess_df = dataframe_lowess(hospital_metrics_daily_df,
												y_col_name=col_select,
												x_col_name='Day',
												frac_in=0.1,
												show_plot=show_plot,
												show_table=False)

	adj_index = hospital_metrics_daily_lowess_df.index
	adj_index.strftime('% B % d, % Y, % r')
	hospital_metrics_daily_lowess_df['DateString'] = adj_index

	return hospital_metrics_daily_lowess_df