Skip to content

Commit

Permalink
chart specs revamping
Browse files Browse the repository at this point in the history
  • Loading branch information
kauevestena committed Oct 17, 2024
1 parent 892a30c commit 299c622
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
7 changes: 7 additions & 0 deletions dashboard/statistics_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# add an option "--single" to generate a single chart specified as an string
parser = argparse.ArgumentParser()
parser.add_argument("--single", type=str, default=None)

# add an argument to raise on failure:
parser.add_argument("--to_raise", action="store_true")

args = parser.parse_args()

single_chart = args.single
Expand Down Expand Up @@ -119,6 +123,9 @@
)
error_report.write(chart_spec + "\n")

if args.to_raise:
raise

# the topbar for each category
topbar = f"""
Expand Down
61 changes: 43 additions & 18 deletions dashboard/statistics_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"function": create_barchartV2,
"params": {
"input_gdf": gdfs_dict["sidewalks"],
"fieldname": "tactile_paving",
"fieldname": "width",
"title": "Sidewalks Width Values",
"str_to_append": " type",
"title_fontsize": 24,
Expand All @@ -90,7 +90,9 @@
"params": {
"df": gdfs_dict["sidewalks"],
"column": "age",
"boxplot_title": "Sidewalks Age",
"boxplot_title": "Sidewalks Update Age (Years)",
"color_field": "smoothness",
"height": 200,
# "tooltip_fields": ["id"],
},
"title": "Update Age",
Expand All @@ -112,6 +114,8 @@
"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",
Expand Down Expand Up @@ -198,8 +202,9 @@
"params": {
"df": gdfs_dict["crossings"],
"column": "age",
"boxplot_title": "Crossings Age",
"boxplot_title": "Crossings Update Age (Years)",
"color_field": "crossing",
"height": 200,
# "tooltip_fields": ["id"],
},
"title": "Update Age",
Expand All @@ -210,6 +215,7 @@
"df": gdfs_dict["crossings"],
"column": "n_revs",
"color_field": "crossing",
"height": 200,
"boxplot_title": "Crossings Number of Revisions",
# "tooltip_fields": ["id"],
},
Expand Down Expand Up @@ -286,8 +292,10 @@
"params": {
"df": gdfs_dict["kerbs"],
"column": "age",
"boxplot_title": "Kerbs Age",
"boxplot_title": "Kerbs Update Age (Years)",
# "tooltip_fields": ["id"],
"color_field": "wheelchair",
"height": 200,
},
"title": "Update Age",
},
Expand All @@ -306,6 +314,8 @@
"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",
Expand All @@ -319,7 +329,7 @@
"fieldname": oswm_footway_fieldname,
"title": "Sub-category (Layer)",
},
"title": "Incline Values",
"title": "Subcategory",
},
# "other_footways_surface": {
# "function": create_barchart,
Expand All @@ -330,17 +340,6 @@
# },
# "title": "Other Footways Surface",
# },
"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_x_surface": {
"function": create_double_scatter_bar,
"params": {
Expand All @@ -357,6 +356,28 @@
},
"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": {
Expand All @@ -373,6 +394,7 @@
"column": "length(km)",
"boxplot_title": "Other Footways Length (km)",
"color_field": oswm_footway_fieldname,
"height": 200,
# "tooltip_fields": ["id"],
"maxbins": 50,
},
Expand All @@ -383,8 +405,9 @@
"params": {
"df": gdfs_dict["other_footways"],
"column": "age",
"boxplot_title": "Other Footways Age",
# "tooltip_fields": ["id"],
"boxplot_title": "Other Footways Update Age (Years)",
"color_field": oswm_footway_fieldname,
"height": 200,
},
"title": "Update Age",
},
Expand All @@ -403,6 +426,8 @@
"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",
Expand Down

0 comments on commit 299c622

Please sign in to comment.