Spaces:
Running
Running
Commit ·
0b9114b
1
Parent(s): 7795980
Remove unnecessary trailing commas from last items in structures
Browse filesRemove commas from the last item in lists, function calls, and nested structures
where they're not needed. Improves readability by removing visual clutter.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -65,7 +65,7 @@ def create_kpi_card_figure(data_frame, title, icon, metric_value=None, is_curren
|
|
| 65 |
title=title,
|
| 66 |
icon=icon,
|
| 67 |
),
|
| 68 |
-
actions=va.set_control(control="metric", value=metric_value)
|
| 69 |
)
|
| 70 |
|
| 71 |
|
|
@@ -102,13 +102,13 @@ overview_page = vm.Page(
|
|
| 102 |
create_kpi_card_figure(order_kpi_df, "Orders", "orders", metric_value="Order ID", is_currency=False),
|
| 103 |
create_kpi_card_figure(
|
| 104 |
customer_kpi_df, "Customers", "group", metric_value="Customer ID", is_currency=False
|
| 105 |
-
)
|
| 106 |
],
|
| 107 |
-
layout=vm.Grid(grid=[[0, 1, 2, 3]])
|
| 108 |
),
|
| 109 |
create_chart_container_with_nav(
|
| 110 |
id="line_month",
|
| 111 |
-
figure=create_line_chart_per_month(superstore_df, value_col="Sales")
|
| 112 |
),
|
| 113 |
create_chart_container_with_nav(
|
| 114 |
id="order_status",
|
|
@@ -129,7 +129,7 @@ overview_page = vm.Page(
|
|
| 129 |
id="category_bar",
|
| 130 |
figure=create_bar_current_vs_previous_category(superstore_df, value_col="Sales"),
|
| 131 |
nav_href="/products",
|
| 132 |
-
)
|
| 133 |
],
|
| 134 |
controls=[
|
| 135 |
vm.Parameter(
|
|
@@ -144,7 +144,7 @@ overview_page = vm.Page(
|
|
| 144 |
],
|
| 145 |
show_in_url=True, # TODO: think about where this needed
|
| 146 |
visible=False,
|
| 147 |
-
)
|
| 148 |
],
|
| 149 |
)
|
| 150 |
|
|
@@ -161,15 +161,15 @@ regions_page = vm.Page(
|
|
| 161 |
id="region_map_chart",
|
| 162 |
header="💡 Click on a state to filter charts on the right.",
|
| 163 |
figure=create_map_bubble_new(superstore_df, value_col="Sales", custom_data=["State_Code"]),
|
| 164 |
-
actions=va.set_control(control="state_filter", value="State_Code")
|
| 165 |
-
)
|
| 166 |
],
|
| 167 |
),
|
| 168 |
vm.Container(
|
| 169 |
controls=[
|
| 170 |
vm.Parameter(
|
| 171 |
targets=["pg2-chart-1.top_n"],
|
| 172 |
-
selector=vm.Slider(min=5, max=30, step=5, value=20, title="Choose top N")
|
| 173 |
),
|
| 174 |
vm.Parameter(
|
| 175 |
selector=vm.RadioItems(
|
|
@@ -177,7 +177,7 @@ regions_page = vm.Page(
|
|
| 177 |
title="Choose y-axis",
|
| 178 |
),
|
| 179 |
targets=["pg2-chart-1.y"],
|
| 180 |
-
)
|
| 181 |
],
|
| 182 |
components=[
|
| 183 |
vm.Graph(
|
|
@@ -186,7 +186,7 @@ regions_page = vm.Page(
|
|
| 186 |
)
|
| 187 |
],
|
| 188 |
variant="filled",
|
| 189 |
-
)
|
| 190 |
],
|
| 191 |
controls=[
|
| 192 |
vm.Filter(
|
|
@@ -196,11 +196,11 @@ regions_page = vm.Page(
|
|
| 196 |
),
|
| 197 |
vm.Filter(
|
| 198 |
column="Segment",
|
| 199 |
-
selector=vm.Checklist(title="Choose segment")
|
| 200 |
),
|
| 201 |
vm.Filter(
|
| 202 |
column="Category",
|
| 203 |
-
selector=vm.Checklist(title="Choose category")
|
| 204 |
),
|
| 205 |
vm.Parameter(
|
| 206 |
selector=vm.RadioItems(
|
|
@@ -211,9 +211,9 @@ regions_page = vm.Page(
|
|
| 211 |
"region_map_chart.value_col",
|
| 212 |
"pg2-chart-1.x",
|
| 213 |
],
|
| 214 |
-
)
|
| 215 |
],
|
| 216 |
-
)
|
| 217 |
],
|
| 218 |
)
|
| 219 |
|
|
@@ -225,7 +225,7 @@ customers_page = vm.Page(
|
|
| 225 |
controls=[
|
| 226 |
vm.Filter(column="Region", selector=vm.Checklist(title="Choose region")),
|
| 227 |
vm.Filter(column="Segment", selector=vm.Checklist(title="Choose segment")),
|
| 228 |
-
vm.Filter(column="Category", selector=vm.Checklist(title="Choose category"))
|
| 229 |
],
|
| 230 |
components=[
|
| 231 |
vm.AgGrid(
|
|
@@ -235,11 +235,11 @@ customers_page = vm.Page(
|
|
| 235 |
aggrid_df,
|
| 236 |
columnDefs=COLUMN_DEFS_CUSTOMERS,
|
| 237 |
),
|
| 238 |
-
actions=va.set_control(control="pg3_parameter_1", value="Customer Name")
|
| 239 |
),
|
| 240 |
-
vm.Graph(id="pg3_pareto_chart", figure=pareto_customers_chart(superstore_df, highlight_customer=None))
|
| 241 |
],
|
| 242 |
-
)
|
| 243 |
],
|
| 244 |
controls=[
|
| 245 |
vm.Parameter(
|
|
@@ -247,7 +247,7 @@ customers_page = vm.Page(
|
|
| 247 |
targets=["pg3_pareto_chart.highlight_customer"],
|
| 248 |
selector=vm.Dropdown(options=customer_name, value="NONE", multi=False),
|
| 249 |
visible=False,
|
| 250 |
-
)
|
| 251 |
],
|
| 252 |
)
|
| 253 |
|
|
@@ -262,8 +262,8 @@ products_page = vm.Page(
|
|
| 262 |
vm.Graph(
|
| 263 |
id="pg4-chart-1",
|
| 264 |
figure=bar_chart_by_category(superstore_df, custom_data=["Category"]),
|
| 265 |
-
actions=va.set_control(control="pg4-filter-1", value="Category")
|
| 266 |
-
)
|
| 267 |
],
|
| 268 |
variant="filled",
|
| 269 |
),
|
|
@@ -273,7 +273,7 @@ products_page = vm.Page(
|
|
| 273 |
id="table",
|
| 274 |
header="💡 Click on a row to highlight the data point in the matrix on the right.",
|
| 275 |
figure=dash_ag_grid(superstore_product_df, columnDefs=COLUMN_DEFS_PRODUCT),
|
| 276 |
-
actions=va.set_control(control="pg4_parameter_1", value="Sub-Category")
|
| 277 |
)
|
| 278 |
],
|
| 279 |
variant="filled",
|
|
@@ -287,20 +287,20 @@ products_page = vm.Page(
|
|
| 287 |
x="Sales",
|
| 288 |
y="Profit",
|
| 289 |
custom_data=["Sub-Category"],
|
| 290 |
-
)
|
| 291 |
-
)
|
| 292 |
],
|
| 293 |
variant="filled",
|
| 294 |
-
)
|
| 295 |
],
|
| 296 |
layout=vm.Grid(
|
| 297 |
grid=[
|
| 298 |
[0, 0, 2, 2],
|
| 299 |
[1, 1, 2, 2],
|
| 300 |
-
[1, 1, 2, 2]
|
| 301 |
]
|
| 302 |
-
)
|
| 303 |
-
)
|
| 304 |
],
|
| 305 |
controls=[
|
| 306 |
vm.Filter(
|
|
@@ -320,7 +320,7 @@ products_page = vm.Page(
|
|
| 320 |
targets=["pg4-chart-3.highlight_sub_category"],
|
| 321 |
selector=vm.Dropdown(options=subcategories, value="NONE", multi=False),
|
| 322 |
visible=False,
|
| 323 |
-
)
|
| 324 |
],
|
| 325 |
)
|
| 326 |
|
|
@@ -332,8 +332,8 @@ orders_page = vm.Page(
|
|
| 332 |
vm.Button(
|
| 333 |
text="Export data",
|
| 334 |
icon="download",
|
| 335 |
-
actions=va.export_data(targets=["table_id"], file_format="xlsx")
|
| 336 |
-
)
|
| 337 |
],
|
| 338 |
)
|
| 339 |
|
|
@@ -366,9 +366,9 @@ navigation = vm.Navigation(
|
|
| 366 |
pages=["Orders"],
|
| 367 |
icon="Shopping Cart",
|
| 368 |
label="Orders",
|
| 369 |
-
)
|
| 370 |
]
|
| 371 |
-
)
|
| 372 |
)
|
| 373 |
|
| 374 |
dashboard = vm.Dashboard(
|
|
|
|
| 65 |
title=title,
|
| 66 |
icon=icon,
|
| 67 |
),
|
| 68 |
+
actions=va.set_control(control="metric", value=metric_value)
|
| 69 |
)
|
| 70 |
|
| 71 |
|
|
|
|
| 102 |
create_kpi_card_figure(order_kpi_df, "Orders", "orders", metric_value="Order ID", is_currency=False),
|
| 103 |
create_kpi_card_figure(
|
| 104 |
customer_kpi_df, "Customers", "group", metric_value="Customer ID", is_currency=False
|
| 105 |
+
)
|
| 106 |
],
|
| 107 |
+
layout=vm.Grid(grid=[[0, 1, 2, 3]])
|
| 108 |
),
|
| 109 |
create_chart_container_with_nav(
|
| 110 |
id="line_month",
|
| 111 |
+
figure=create_line_chart_per_month(superstore_df, value_col="Sales")
|
| 112 |
),
|
| 113 |
create_chart_container_with_nav(
|
| 114 |
id="order_status",
|
|
|
|
| 129 |
id="category_bar",
|
| 130 |
figure=create_bar_current_vs_previous_category(superstore_df, value_col="Sales"),
|
| 131 |
nav_href="/products",
|
| 132 |
+
)
|
| 133 |
],
|
| 134 |
controls=[
|
| 135 |
vm.Parameter(
|
|
|
|
| 144 |
],
|
| 145 |
show_in_url=True, # TODO: think about where this needed
|
| 146 |
visible=False,
|
| 147 |
+
)
|
| 148 |
],
|
| 149 |
)
|
| 150 |
|
|
|
|
| 161 |
id="region_map_chart",
|
| 162 |
header="💡 Click on a state to filter charts on the right.",
|
| 163 |
figure=create_map_bubble_new(superstore_df, value_col="Sales", custom_data=["State_Code"]),
|
| 164 |
+
actions=va.set_control(control="state_filter", value="State_Code")
|
| 165 |
+
)
|
| 166 |
],
|
| 167 |
),
|
| 168 |
vm.Container(
|
| 169 |
controls=[
|
| 170 |
vm.Parameter(
|
| 171 |
targets=["pg2-chart-1.top_n"],
|
| 172 |
+
selector=vm.Slider(min=5, max=30, step=5, value=20, title="Choose top N")
|
| 173 |
),
|
| 174 |
vm.Parameter(
|
| 175 |
selector=vm.RadioItems(
|
|
|
|
| 177 |
title="Choose y-axis",
|
| 178 |
),
|
| 179 |
targets=["pg2-chart-1.y"],
|
| 180 |
+
)
|
| 181 |
],
|
| 182 |
components=[
|
| 183 |
vm.Graph(
|
|
|
|
| 186 |
)
|
| 187 |
],
|
| 188 |
variant="filled",
|
| 189 |
+
)
|
| 190 |
],
|
| 191 |
controls=[
|
| 192 |
vm.Filter(
|
|
|
|
| 196 |
),
|
| 197 |
vm.Filter(
|
| 198 |
column="Segment",
|
| 199 |
+
selector=vm.Checklist(title="Choose segment")
|
| 200 |
),
|
| 201 |
vm.Filter(
|
| 202 |
column="Category",
|
| 203 |
+
selector=vm.Checklist(title="Choose category")
|
| 204 |
),
|
| 205 |
vm.Parameter(
|
| 206 |
selector=vm.RadioItems(
|
|
|
|
| 211 |
"region_map_chart.value_col",
|
| 212 |
"pg2-chart-1.x",
|
| 213 |
],
|
| 214 |
+
)
|
| 215 |
],
|
| 216 |
+
)
|
| 217 |
],
|
| 218 |
)
|
| 219 |
|
|
|
|
| 225 |
controls=[
|
| 226 |
vm.Filter(column="Region", selector=vm.Checklist(title="Choose region")),
|
| 227 |
vm.Filter(column="Segment", selector=vm.Checklist(title="Choose segment")),
|
| 228 |
+
vm.Filter(column="Category", selector=vm.Checklist(title="Choose category"))
|
| 229 |
],
|
| 230 |
components=[
|
| 231 |
vm.AgGrid(
|
|
|
|
| 235 |
aggrid_df,
|
| 236 |
columnDefs=COLUMN_DEFS_CUSTOMERS,
|
| 237 |
),
|
| 238 |
+
actions=va.set_control(control="pg3_parameter_1", value="Customer Name")
|
| 239 |
),
|
| 240 |
+
vm.Graph(id="pg3_pareto_chart", figure=pareto_customers_chart(superstore_df, highlight_customer=None))
|
| 241 |
],
|
| 242 |
+
)
|
| 243 |
],
|
| 244 |
controls=[
|
| 245 |
vm.Parameter(
|
|
|
|
| 247 |
targets=["pg3_pareto_chart.highlight_customer"],
|
| 248 |
selector=vm.Dropdown(options=customer_name, value="NONE", multi=False),
|
| 249 |
visible=False,
|
| 250 |
+
)
|
| 251 |
],
|
| 252 |
)
|
| 253 |
|
|
|
|
| 262 |
vm.Graph(
|
| 263 |
id="pg4-chart-1",
|
| 264 |
figure=bar_chart_by_category(superstore_df, custom_data=["Category"]),
|
| 265 |
+
actions=va.set_control(control="pg4-filter-1", value="Category")
|
| 266 |
+
)
|
| 267 |
],
|
| 268 |
variant="filled",
|
| 269 |
),
|
|
|
|
| 273 |
id="table",
|
| 274 |
header="💡 Click on a row to highlight the data point in the matrix on the right.",
|
| 275 |
figure=dash_ag_grid(superstore_product_df, columnDefs=COLUMN_DEFS_PRODUCT),
|
| 276 |
+
actions=va.set_control(control="pg4_parameter_1", value="Sub-Category")
|
| 277 |
)
|
| 278 |
],
|
| 279 |
variant="filled",
|
|
|
|
| 287 |
x="Sales",
|
| 288 |
y="Profit",
|
| 289 |
custom_data=["Sub-Category"],
|
| 290 |
+
)
|
| 291 |
+
)
|
| 292 |
],
|
| 293 |
variant="filled",
|
| 294 |
+
)
|
| 295 |
],
|
| 296 |
layout=vm.Grid(
|
| 297 |
grid=[
|
| 298 |
[0, 0, 2, 2],
|
| 299 |
[1, 1, 2, 2],
|
| 300 |
+
[1, 1, 2, 2]
|
| 301 |
]
|
| 302 |
+
)
|
| 303 |
+
)
|
| 304 |
],
|
| 305 |
controls=[
|
| 306 |
vm.Filter(
|
|
|
|
| 320 |
targets=["pg4-chart-3.highlight_sub_category"],
|
| 321 |
selector=vm.Dropdown(options=subcategories, value="NONE", multi=False),
|
| 322 |
visible=False,
|
| 323 |
+
)
|
| 324 |
],
|
| 325 |
)
|
| 326 |
|
|
|
|
| 332 |
vm.Button(
|
| 333 |
text="Export data",
|
| 334 |
icon="download",
|
| 335 |
+
actions=va.export_data(targets=["table_id"], file_format="xlsx")
|
| 336 |
+
)
|
| 337 |
],
|
| 338 |
)
|
| 339 |
|
|
|
|
| 366 |
pages=["Orders"],
|
| 367 |
icon="Shopping Cart",
|
| 368 |
label="Orders",
|
| 369 |
+
)
|
| 370 |
]
|
| 371 |
+
)
|
| 372 |
)
|
| 373 |
|
| 374 |
dashboard = vm.Dashboard(
|