diff --git a/dashboard/statistics_funcs.py b/dashboard/statistics_funcs.py index 5404823..3767d42 100644 --- a/dashboard/statistics_funcs.py +++ b/dashboard/statistics_funcs.py @@ -411,7 +411,11 @@ def create_rev_date(row): # it needs to be here rather than in the main script: -gdfs_dict = get_gdfs_dict() +gdfs_dict = get_gdfs_dict(include_all_data_dummy=True) + +# # for the inclusion of all data: +# gdfs_dict["all_data"] = None + updating_dicts = {} for category in paths_dict["data"]: diff --git a/dashboard/statistics_generation.py b/dashboard/statistics_generation.py index 57c9fae..bd017ae 100644 --- a/dashboard/statistics_generation.py +++ b/dashboard/statistics_generation.py @@ -18,6 +18,9 @@ create_folder_if_not_exists(os.path.join(statistics_basepath, category)) create_folder_if_not_exists(os.path.join(statistcs_specs_path, category)) + if category == "all_data": + continue + # creating a ref to improve readability cat_gdf = gdfs_dict[category] update_df = updating_dicts[category] @@ -28,9 +31,9 @@ if "LineString" in geom_type_dict[category]: create_length_field(cat_gdf) - create_weblink_field(cat_gdf) - elif "Point" in geom_type_dict[category]: - create_weblink_field(cat_gdf, "Point") + # create_weblink_field(cat_gdf) + # elif "Point" in geom_type_dict[category]: + # create_weblink_field(cat_gdf, "Point") # uncertain about polygon cases # elif (: @@ -40,42 +43,41 @@ # create_weblink_field(gdfs_dict[category]) if "survey:date" in cat_gdf.columns: - cat_gdf["Year of Survey"] = cat_gdf["survey:date"].apply(get_year_surveydate) - # updating info: - update_df["month_year"] = ( - update_df["rev_month"].map("{:02d}".format) - + "_" - + update_df["rev_year"].astype(str) - ) + # # updating info: + # update_df["month_year"] = ( + # update_df["rev_month"].map("{:02d}".format) + # + "_" + # + update_df["rev_year"].astype(str) + # ) - update_df["year_month"] = ( - update_df["rev_year"].astype(str) - + "_" - + update_df["rev_month"].map("{:02d}".format) - ) + # update_df["year_month"] = ( + # update_df["rev_year"].astype(str) + # + "_" + # + update_df["rev_month"].map("{:02d}".format) + # ) - update_df.sort_values("year_month", inplace=True) + # update_df.sort_values("year_month", inplace=True) - # Fill missing values with a default (e.g., 1 for month or day) TODO: move to data adaptation script - update_df["rev_year"] = ( - update_df["rev_year"].fillna(default_missing_year).astype(int) - ) - update_df["rev_month"] = ( - update_df["rev_month"].fillna(default_missing_month).astype(int) - ) - update_df["rev_day"] = update_df["rev_day"].fillna(default_missing_day).astype(int) + # # Fill missing values with a default (e.g., 1 for month or day) TODO: move to data adaptation script + # update_df["rev_year"] = ( + # update_df["rev_year"].fillna(default_missing_year).astype(int) + # ) + # update_df["rev_month"] = ( + # update_df["rev_month"].fillna(default_missing_month).astype(int) + # ) + # update_df["rev_day"] = update_df["rev_day"].fillna(default_missing_day).astype(int) - update_df["rev_date_obj"] = update_df.apply(create_rev_date, axis=1) + # update_df["rev_date_obj"] = update_df.apply(create_rev_date, axis=1) - update_df["age_years"] = ( - pd.Timestamp(datetime.today()) - update_df["rev_date_obj"] - ).dt.days / 365.25 + # update_df["age_years"] = ( + # pd.Timestamp(datetime.today()) - update_df["rev_date_obj"] + # ).dt.days / 365.25 cat_gdf["category"] = category -# creating a meta-category "all_data" for all data: +# # creating a meta-category "all_data" for all data: gdfs_dict["all_data"] = pd.concat(gdfs_dict.values(), ignore_index=True) # storing chart infos: @@ -84,6 +86,8 @@ # generating the charts by using the specifications with open(os.path.join(statistics_basepath, "failed_gen.txt"), "w+") as error_report: + charts_specs = get_charts_specs() + for category in charts_specs: generated_list_dict[category] = [] for chart_spec in charts_specs[category]: diff --git a/dashboard/statistics_specs.py b/dashboard/statistics_specs.py index 140a997..6351fb0 100644 --- a/dashboard/statistics_specs.py +++ b/dashboard/statistics_specs.py @@ -1,424 +1,462 @@ from statistics_funcs import * -charts_specs = { - "sidewalks": { - "sidewalks_smoothness_x_surface": { - "function": create_double_mat_and_bar, - "params": { - "input_df": gdfs_dict["sidewalks"], - "title": "Surface x Smoothness (sidewalks)", - "xs": "surface", - "ys": "smoothness", - "scolor": None, - "xh": "count()", - "yh1": "surface", - "yh2": "smoothness", - "hcolor": "age", - "fontsize": 24, - }, - "title": "Surface x Smoothness", - }, - "sidewalks_surface": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["sidewalks"], - "fieldname": "surface", - "title": "Sidewalks Surface Type", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Surface Type", - }, - "sidewalks_smoothness": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["sidewalks"], - "fieldname": "smoothness", - "title": "Sidewalks Smoothness Condition", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Smoothness Condition", - }, - "sidewalks_tactile_paving": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["sidewalks"], - "fieldname": "tactile_paving", - "title": "Sidewalks Tactile Paving Presence", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Tactile Paving P.", - }, - "sidewalks_width": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["sidewalks"], - "fieldname": "width", - "title": "Sidewalks Width Values", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Width Values", - }, - "sidewalks_incline": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["sidewalks"], - "fieldname": "incline", - "title": "Sidewalks Incline Values", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Incline Values", - }, - "sidewalks_age": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["sidewalks"], - "column": "age", - "boxplot_title": "Sidewalks Update Age (Years)", - "color_field": "smoothness", - "height": 200, - # "tooltip_fields": ["id"], - }, - "title": "Update Age", - }, - "sidewalks_length": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["sidewalks"], - "column": "length(km)", - "boxplot_title": "Sidewalks Length (km)", - # "tooltip_fields": ["id"], - "maxbins": 50, - }, - "title": "Length (km)", - }, - "sidewalks_n_revs": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["sidewalks"], - "column": "n_revs", - "boxplot_title": "Sidewalks Number of Revisions", - "color_field": "smoothness", - "height": 200, - # "tooltip_fields": ["id"], - }, - "title": "Number of Revisions", + +# to avoid issues with circular imports it was encapsulated in a function: +def get_charts_specs(): + return { + "sidewalks": { + "sidewalks_smoothness_x_surface": { + "function": create_double_mat_and_bar, + "params": { + "input_df": gdfs_dict.get("sidewalks"), + "title": "Surface x Smoothness (sidewalks)", + "xs": "surface", + "ys": "smoothness", + "scolor": None, + "xh": "count()", + "yh1": "surface", + "yh2": "smoothness", + "hcolor": "age", + "fontsize": 24, + }, + "title": "Surface x Smoothness", + }, + "sidewalks_surface": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("sidewalks"), + "fieldname": "surface", + "title": "Sidewalks Surface Type", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Surface Type", + }, + "sidewalks_smoothness": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("sidewalks"), + "fieldname": "smoothness", + "title": "Sidewalks Smoothness Condition", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Smoothness Condition", + }, + "sidewalks_tactile_paving": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("sidewalks"), + "fieldname": "tactile_paving", + "title": "Sidewalks Tactile Paving Presence", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Tactile Paving Presence", + }, + "sidewalks_width": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("sidewalks"), + "fieldname": "width", + "title": "Sidewalks Width Values", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Width Values", + }, + "sidewalks_incline": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("sidewalks"), + "fieldname": "incline", + "title": "Sidewalks Incline Values", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Incline Values", + }, + "sidewalks_age": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("sidewalks"), + "column": "age", + "boxplot_title": "Sidewalks Update Age (Years)", + "color_field": "smoothness", + "height": 200, + # "tooltip_fields": ["id"], + }, + "title": "Update Age", + }, + "sidewalks_length": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("sidewalks"), + "column": "length(km)", + "boxplot_title": "Sidewalks Length (km)", + # "tooltip_fields": ["id"], + "maxbins": 50, + }, + "title": "Length (km)", + }, + "sidewalks_n_revs": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("sidewalks"), + "column": "n_revs", + "boxplot_title": "Sidewalks Number of Revisions", + "color_field": "smoothness", + "height": 200, + # "tooltip_fields": ["id"], + }, + "title": "Number of Revisions", + }, + # "sidewalks_yr_moth_update": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["sidewalks"], + # "fieldname": "year_month", + # "title": "Year and Month Of Update (Sidewalks)", + # }, + # "title": "Year and Month Of Update", + # }, + # "sidewalks_number_revisions": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["sidewalks"], + # "fieldname": "n_revs", + # "title": "Number of Revisions (Sidewalks)", + # }, + # "title": "Number Of Revisions", + # }, }, - # "sidewalks_yr_moth_update": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["sidewalks"], - # "fieldname": "year_month", - # "title": "Year and Month Of Update (Sidewalks)", - # }, - # "title": "Year and Month Of Update", - # }, - # "sidewalks_number_revisions": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["sidewalks"], - # "fieldname": "n_revs", - # "title": "Number of Revisions (Sidewalks)", - # }, - # "title": "Number Of Revisions", - # }, - }, - "crossings": { - "crossing_types": { - "function": create_barchart, - "params": { - "input_df": gdfs_dict["crossings"], - "fieldname": "crossing", + "crossings": { + "crossing_types": { + "function": create_barchart, + "params": { + "input_df": gdfs_dict.get("crossings"), + "fieldname": "crossing", + "title": "Crossing Type", + }, "title": "Crossing Type", }, - "title": "Crossing Type", - }, - # "crossing_surface": { - # "function": create_barchart, - # "params": { - # "input_df": gdfs_dict["crossings"], - # "fieldname": "surface", - # "title": "Crossing Surface", - # }, - # "title": "Crossing Surface", - # }, - "crossing_surface": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["crossings"], - "fieldname": "surface", - "title": "Crossings Surface Type", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Surface Type", - }, - "crossings_smoothness_x_surface": { - "function": create_double_mat_and_bar, - "params": { - "input_df": gdfs_dict["crossings"], - "title": "Surface x Smoothness (crossings)", - "xs": "surface", - "ys": "smoothness", - "scolor": None, - "xh": "count()", - "yh1": "surface", - "yh2": "smoothness", - "hcolor": "crossing", - "fontsize": 24, - }, - "title": "Surface x Smoothness", - }, - "crossings_length": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["crossings"], - "column": "length(km)", - "boxplot_title": "Crossings Length (km)", - "color_field": "crossing", - # "tooltip_fields": ["id"], - "maxbins": 50, - }, - "title": "Length (km)", - }, - "crossings_age": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["crossings"], - "column": "age", - "boxplot_title": "Crossings Update Age (Years)", - "color_field": "crossing", - "height": 200, - # "tooltip_fields": ["id"], - }, - "title": "Update Age", - }, - "crossings_n_revs": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["crossings"], - "column": "n_revs", - "color_field": "crossing", - "height": 200, - "boxplot_title": "Crossings Number of Revisions", - # "tooltip_fields": ["id"], - }, - "title": "Number of Revisions", - }, - }, - "kerbs": { - "kerbs_x_paving_x_wheelchair": { - "function": create_double_mat_and_bar, - "params": { - "input_df": gdfs_dict["kerbs"], - "title": "Kerb x Tactile Paving x Wheelchair Acess.", - "xs": "kerb", - "ys": "tactile_paving", - "scolor": None, - "xh": "count()", - "yh1": "kerb", - "yh2": "tactile_paving", - "hcolor": "wheelchair", - "fontsize": 24, - }, - "title": "Surface x Smoothness", + # "crossing_surface": { + # "function": create_barchart, + # "params": { + # "input_df": gdfs_dict.get("crossings"), + # "fieldname": "surface", + # "title": "Crossing Surface", + # }, + # "title": "Crossing Surface", + # }, + "crossing_surface": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("crossings"), + "fieldname": "surface", + "title": "Crossings Surface Type", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Surface Type", + }, + "crossings_smoothness_x_surface": { + "function": create_double_mat_and_bar, + "params": { + "input_df": gdfs_dict.get("crossings"), + "title": "Surface x Smoothness (crossings)", + "xs": "surface", + "ys": "smoothness", + "scolor": None, + "xh": "count()", + "yh1": "surface", + "yh2": "smoothness", + "hcolor": "crossing", + "fontsize": 24, + }, + "title": "Surface x Smoothness", + }, + "crossings_length": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("crossings"), + "column": "length(km)", + "boxplot_title": "Crossings Length (km)", + "color_field": "crossing", + # "tooltip_fields": ["id"], + "maxbins": 50, + }, + "title": "Length (km)", + }, + "crossings_age": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("crossings"), + "column": "age", + "boxplot_title": "Crossings Update Age (Years)", + "color_field": "crossing", + "height": 200, + # "tooltip_fields": ["id"], + }, + "title": "Update Age", + }, + "crossings_n_revs": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("crossings"), + "column": "n_revs", + "color_field": "crossing", + "height": 200, + "boxplot_title": "Crossings Number of Revisions", + # "tooltip_fields": ["id"], + }, + "title": "Number of Revisions", + }, }, - "kerb_types": { - "function": create_barchart, - "params": { - "input_df": gdfs_dict["kerbs"], - "fieldname": "kerb", + "kerbs": { + "kerbs_x_paving_x_wheelchair": { + "function": create_double_mat_and_bar, + "params": { + "input_df": gdfs_dict.get("kerbs"), + "title": "Kerb x Tactile Paving x Wheelchair Acess.", + "xs": "kerb", + "ys": "tactile_paving", + "scolor": None, + "xh": "count()", + "yh1": "kerb", + "yh2": "tactile_paving", + "hcolor": "wheelchair", + "fontsize": 24, + }, + "title": "Surface x Smoothness", + }, + "kerb_types": { + "function": create_barchart, + "params": { + "input_df": gdfs_dict.get("kerbs"), + "fieldname": "kerb", + "title": "Kerb Type", + }, "title": "Kerb Type", }, - "title": "Kerb Type", - }, - "kerb_tactile_paving": { - "function": create_barchart, - "params": { - "input_df": gdfs_dict["kerbs"], - "fieldname": "tactile_paving", - "title": "Kerb Tactile Paving Presence", - }, - "title": "Tactile Paving Presence", - }, - "kerb_wheelchair_access": { - "function": create_barchart, - "params": { - "input_df": gdfs_dict["kerbs"], - "fieldname": "wheelchair", - "title": "Kerb Wheelchair Acessibility", - }, - "title": "Wheelchair Acessibility", - }, - "kerbs_surface": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["kerbs"], - "fieldname": "surface", - "title": "Kerbs Surface Type", - "str_to_append": " type", - "title_fontsize": 24, - "len_field": None, - }, - "title": "Surface Type", - }, - # "kerbs_yr_moth_update": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["kerbs"], - # "fieldname": "year_month", - # "title": "Year and Month Of Update (Kerbs)", - # }, - # "title": "Year and Month Of Update", - # }, - "kerbs_age": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["kerbs"], - "column": "age", - "boxplot_title": "Kerbs Update Age (Years)", - # "tooltip_fields": ["id"], - "color_field": "wheelchair", - "height": 200, - }, - "title": "Update Age", - }, - # "kerbs_number_revisions": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["kerbs"], - # "fieldname": "n_revs", - # "title": "Number Of Revisions (Kerbs)", - # }, - # "title": "Number Of Revisions", - # }, - "kerbs_n_revs": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["kerbs"], - "column": "n_revs", - "boxplot_title": "Kerbs Number of Revisions", - "color_field": "smoothness", - "height": 200, - # "tooltip_fields": ["id"], - }, - "title": "Number of Revisions", - }, - }, - "other_footways": { - "other_footways_subcategory": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["other_footways"], - "fieldname": oswm_footway_fieldname, - "title": "Sub-category (Layer)", - }, - "title": "Subcategory", - }, - # "other_footways_surface": { - # "function": create_barchart, - # "params": { - # "input_df": gdfs_dict["other_footways"], - # "fieldname": "surface", - # "title": "other_footways Surface", - # }, - # "title": "Other Footways Surface", - # }, - "other_footways_smoothness_x_surface": { - "function": create_double_mat_and_bar, - "params": { - "input_df": gdfs_dict["other_footways"], - "title": "Surface x Smoothness (other_footways)", - "xs": "surface", - "ys": "smoothness", - "scolor": oswm_footway_fieldname, - "xh": "count()", - "yh1": "surface", - "yh2": "smoothness", - "hcolor": oswm_footway_fieldname, - "fontsize": 24, - }, - "title": "Surface x Smoothness", - }, - "other_footways_surface": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["other_footways"], - "fieldname": "surface", - "title": "Other Footways Surface Type", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Surface Type", - }, - "other_footways_smoothness": { - "function": create_barchartV2, - "params": { - "input_gdf": gdfs_dict["other_footways"], - "fieldname": "smoothness", - "title": "Other Footways Smoothness", - "str_to_append": " type", - "title_fontsize": 24, - }, - "title": "Smoothness", - }, - # "other_footways_yr_moth_update": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["other_footways"], - # "fieldname": "year_month", - # "title": "Year and Month Of Update (other_footways)", - # }, - # "title": "Year and Month Of Update", - # }, - "other_footways_length": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["other_footways"], - "column": "length(km)", - "boxplot_title": "Other Footways Length (km)", - "color_field": oswm_footway_fieldname, - "height": 200, - # "tooltip_fields": ["id"], - "maxbins": 50, - }, - "title": "Length (km)", + "kerb_tactile_paving": { + "function": create_barchart, + "params": { + "input_df": gdfs_dict.get("kerbs"), + "fieldname": "tactile_paving", + "title": "Kerb Tactile Paving Presence", + }, + "title": "Tactile Paving Presence", + }, + "kerb_wheelchair_access": { + "function": create_barchart, + "params": { + "input_df": gdfs_dict.get("kerbs"), + "fieldname": "wheelchair", + "title": "Kerb Wheelchair Acessibility", + }, + "title": "Wheelchair Acessibility", + }, + "kerbs_surface": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("kerbs"), + "fieldname": "surface", + "title": "Kerbs Surface Type", + "str_to_append": " type", + "title_fontsize": 24, + "len_field": None, + }, + "title": "Surface Type", + }, + # "kerbs_yr_moth_update": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["kerbs"], + # "fieldname": "year_month", + # "title": "Year and Month Of Update (Kerbs)", + # }, + # "title": "Year and Month Of Update", + # }, + "kerbs_age": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("kerbs"), + "column": "age", + "boxplot_title": "Kerbs Update Age (Years)", + # "tooltip_fields": ["id"], + "color_field": "wheelchair", + "height": 200, + }, + "title": "Update Age", + }, + # "kerbs_number_revisions": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["kerbs"], + # "fieldname": "n_revs", + # "title": "Number Of Revisions (Kerbs)", + # }, + # "title": "Number Of Revisions", + # }, + "kerbs_n_revs": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("kerbs"), + "column": "n_revs", + "boxplot_title": "Kerbs Number of Revisions", + "color_field": "smoothness", + "height": 200, + # "tooltip_fields": ["id"], + }, + "title": "Number of Revisions", + }, }, - "other_footways_age": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["other_footways"], - "column": "age", - "boxplot_title": "Other Footways Update Age (Years)", - "color_field": oswm_footway_fieldname, - "height": 200, - }, - "title": "Update Age", + "other_footways": { + "other_footways_subcategory": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("other_footways"), + "fieldname": oswm_footway_fieldname, + "title": "Sub-category (Layer)", + }, + "title": "Subcategory", + }, + # "other_footways_surface": { + # "function": create_barchart, + # "params": { + # "input_df": gdfs_dict.get("other_footways"), + # "fieldname": "surface", + # "title": "other_footways Surface", + # }, + # "title": "Other Footways Surface", + # }, + "other_footways_smoothness_x_surface": { + "function": create_double_mat_and_bar, + "params": { + "input_df": gdfs_dict.get("other_footways"), + "title": "Surface x Smoothness (other_footways)", + "xs": "surface", + "ys": "smoothness", + "scolor": oswm_footway_fieldname, + "xh": "count()", + "yh1": "surface", + "yh2": "smoothness", + "hcolor": oswm_footway_fieldname, + "fontsize": 24, + }, + "title": "Surface x Smoothness", + }, + "other_footways_surface": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("other_footways"), + "fieldname": "surface", + "title": "Other Footways Surface Type", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Surface Type", + }, + "other_footways_smoothness": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("other_footways"), + "fieldname": "smoothness", + "title": "Other Footways Smoothness", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Smoothness", + }, + # "other_footways_yr_moth_update": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["other_footways"], + # "fieldname": "year_month", + # "title": "Year and Month Of Update (other_footways)", + # }, + # "title": "Year and Month Of Update", + # }, + "other_footways_length": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("other_footways"), + "column": "length(km)", + "boxplot_title": "Other Footways Length (km)", + "color_field": oswm_footway_fieldname, + "height": 200, + # "tooltip_fields": ["id"], + "maxbins": 50, + }, + "title": "Length (km)", + }, + "other_footways_age": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("other_footways"), + "column": "age", + "boxplot_title": "Other Footways Update Age (Years)", + "color_field": oswm_footway_fieldname, + "height": 200, + }, + "title": "Update Age", + }, + # "other_footways_number_revisions": { + # "function": create_barchart, + # "params": { + # "input_df": updating_dicts["other_footways"], + # "fieldname": "n_revs", + # "title": "Number Of Revisions (other_footways)", + # }, + # "title": "Number Of Revisions", + # }, + "other_footways_n_revs": { + "function": create_linked_boxplot_histogram, + "params": { + "df": gdfs_dict.get("other_footways"), + "column": "n_revs", + "boxplot_title": "Other Footways Number of Revisions", + "color_field": oswm_footway_fieldname, + "height": 200, + # "tooltip_fields": ["id"], + }, + "title": "Number of Revisions", + }, }, - # "other_footways_number_revisions": { - # "function": create_barchart, - # "params": { - # "input_df": updating_dicts["other_footways"], - # "fieldname": "n_revs", - # "title": "Number Of Revisions (other_footways)", - # }, - # "title": "Number Of Revisions", - # }, - "other_footways_n_revs": { - "function": create_linked_boxplot_histogram, - "params": { - "df": gdfs_dict["other_footways"], - "column": "n_revs", - "boxplot_title": "Other Footways Number of Revisions", - "color_field": oswm_footway_fieldname, - "height": 200, - # "tooltip_fields": ["id"], - }, - "title": "Number of Revisions", + "all_data": { + "all_data_surface": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("all_data"), + "fieldname": "surface", + "title": "All-Category Surface Type", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Surface Type", + }, + "all_data_smoothness": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("all_data"), + "fieldname": "smoothness", + "title": "All-Category Smoothness Condition", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Smoothness Condition", + }, + "all_data_tactile_paving": { + "function": create_barchartV2, + "params": { + "input_gdf": gdfs_dict.get("all_data"), + "fieldname": "tactile_paving", + "title": "All-Category Tactile Paving Presence", + "str_to_append": " type", + "title_fontsize": 24, + }, + "title": "Tactile Paving Presence", + }, }, - }, -} + } diff --git a/deprecated/misc/vector_grid_working.html b/deprecated/misc/vector_grid_working.html new file mode 100644 index 0000000..d515549 --- /dev/null +++ b/deprecated/misc/vector_grid_working.html @@ -0,0 +1,234 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/functions.py b/functions.py index 4085484..1ba4430 100644 --- a/functions.py +++ b/functions.py @@ -753,15 +753,20 @@ def row_query(df, querydict, mode="any", reverse=False): return selection -def get_gdfs_dict(raw_data=False): +def get_gdfs_dict(raw_data=False, include_all_data_dummy=False): # used dict: paths_dict category_group = "data_raw" if raw_data else "data" - return { + ret_dict = { category: gpd.read_parquet(paths_dict[category_group][category]) for category in paths_dict[category_group] } + if include_all_data_dummy: + ret_dict["all_data"] = gpd.GeoDataFrame() + + return ret_dict + def get_gdfs_dict_v2(): """