feat(superset): подача дашборда «Бизнес-сюжеты»

- Зачем:
  - экран отвечал только графиками: итога за период не было, доли категорий
    читались по высоте столбиков, а известные пользователи лежали на нуле
    рядом с посетителями.
- Что:
  - добавлены ряд крупных чисел (выручка, заказы, средний чек, посетители),
    кольцо долей категорий и линия доли известных пользователей;
  - средний чек и доля известных заведены метриками датасетов, знаменатель
    через `nullIf`: на пустом периоде деление Decimal на ноль в ClickHouse
    роняет панель;
  - фильтр «Период» сужает все панели, включая сверку по `order_day`;
  - `label_colors` закрепляет цвет за категорией и за рядами трафика;
  - деньги без копеек, единица в названии панели; подписи дат читаются как
    даты; сводная сверки развернута классами по строкам и уместилась без
    прокрутки;
  - обновлены справочник Superset и глава путеводителя.
- Проверка:
  - `make lint`;
  - `superset import-directory /app/import --overwrite` на живом стенде, экран
    снят в браузере: девять панелей отрисованы, цвет категории одинаков на
    столбиках и в кольце;
  - период 03.06–06.06 сузил все панели, включая сводную по `order_day`;
  - `SUM(revenue) / nullIf(SUM(orders), 0)` на периоде без заказов возвращает
    NULL, без `nullIf` — исключение 153.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ddadminandClaude Opus 5 committed 2026-09-08 03:35:00 -04:00
1 parent 3ad377e02e
commit b6c10ecf21
14 files changed
+378 -32

No files matched your search

@@ -0,0 +1,19 @@
slice_name: Средний чек, ₽
description: null
certified_by: null
certification_details: null
viz_type: big_number_total
params:
viz_type: big_number_total
metric: avg_check
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
header_font_size: 0.3
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000106
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000001
@@ -0,0 +1,19 @@
slice_name: Заказы
description: null
certified_by: null
certification_details: null
viz_type: big_number_total
params:
viz_type: big_number_total
metric: orders
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
header_font_size: 0.3
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000105
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000001
@@ -0,0 +1,19 @@
slice_name: Выручка, ₽
description: null
certified_by: null
certification_details: null
viz_type: big_number_total
params:
viz_type: big_number_total
metric: revenue
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
header_font_size: 0.3
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000104
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000001
@@ -0,0 +1,19 @@
slice_name: Посетители
description: null
certified_by: null
certification_details: null
viz_type: big_number_total
params:
viz_type: big_number_total
metric: visitors
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
header_font_size: 0.3
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000107
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000003
@@ -0,0 +1,31 @@
slice_name: Доля известных пользователей
description: null
certified_by: null
certification_details: null
viz_type: echarts_timeseries_line
params:
viz_type: echarts_timeseries_line
x_axis: report_date
metrics:
- known_share
groupby: []
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
row_limit: 10000
seriesType: line
show_legend: false
rich_tooltip: true
show_value: false
markerEnabled: true
markerSize: 6
y_axis_format: .1%
x_axis_time_format: '%d.%m'
tooltipTimeFormat: '%d.%m.%Y'
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000109
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000003
@@ -6,9 +6,9 @@ viz_type: pivot_table_v2
params:
viz_type: pivot_table_v2
groupbyRows:
- order_day
groupbyColumns:
- mismatch_class
groupbyColumns:
- order_day
metrics:
- order_count
adhoc_filters:
@@ -23,8 +23,7 @@ params:
colOrder: key_a_to_z
order_desc: true
row_limit: 10000
valueFormat: SMART_NUMBER
date_format: smart_date
date_format: '%d.%m.%Y'
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000102
version: 1.0.0
@@ -1,4 +1,4 @@
slice_name: Выручка по дням и категориям
slice_name: Выручка по дням и категориям, ₽
description: null
certified_by: null
certification_details: null
@@ -20,10 +20,13 @@ params:
stack: Stack
orientation: vertical
show_legend: true
legendType: plain
legendOrientation: bottom
rich_tooltip: true
show_value: false
y_axis_format: ',.2f'
x_axis_time_format: smart_date
y_axis_format: ',d'
x_axis_time_format: '%d.%m'
tooltipTimeFormat: '%d.%m.%Y'
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000101
version: 1.0.0
@@ -0,0 +1,29 @@
slice_name: Доля категорий в выручке
description: null
certified_by: null
certification_details: null
viz_type: pie
params:
viz_type: pie
groupby:
- product_category
metric: revenue
adhoc_filters:
- expressionType: SIMPLE
subject: report_date
operator: TEMPORAL_RANGE
comparator: No filter
clause: WHERE
row_limit: 10000
sort_by_metric: true
donut: true
innerRadius: 30
outerRadius: 70
show_labels: true
labels_outside: false
label_type: percent
show_legend: false
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000108
version: 1.0.0
dataset_uuid: 19600000-0000-4000-8000-000000000001
@@ -17,12 +17,16 @@ params:
comparator: No filter
clause: WHERE
row_limit: 10000
seriesType: echarts_timeseries_line
seriesType: line
show_legend: true
legendOrientation: bottom
rich_tooltip: true
show_value: false
markerEnabled: true
markerSize: 6
y_axis_format: ',d'
x_axis_time_format: smart_date
x_axis_time_format: '%d.%m'
tooltipTimeFormat: '%d.%m.%Y'
cache_timeout: null
uuid: 19600000-0000-4000-8000-000000000103
version: 1.0.0
@@ -19,9 +19,79 @@ position:
parents:
- ROOT_ID
children:
- ROW-kpi
- ROW-revenue
- ROW-pvo
- ROW-traffic
ROW-kpi:
id: ROW-kpi
type: ROW
parents:
- ROOT_ID
- GRID_ID
children:
- CHART-kpi-revenue
- CHART-kpi-orders
- CHART-kpi-avg-check
- CHART-kpi-visitors
meta:
background: BACKGROUND_TRANSPARENT
CHART-kpi-revenue:
id: CHART-kpi-revenue
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-kpi
children: []
meta:
chartId: 4
height: 20
width: 3
sliceName: Выручка, ₽
uuid: 19600000-0000-4000-8000-000000000104
CHART-kpi-orders:
id: CHART-kpi-orders
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-kpi
children: []
meta:
chartId: 5
height: 20
width: 3
sliceName: Заказы
uuid: 19600000-0000-4000-8000-000000000105
CHART-kpi-avg-check:
id: CHART-kpi-avg-check
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-kpi
children: []
meta:
chartId: 6
height: 20
width: 3
sliceName: Средний чек, ₽
uuid: 19600000-0000-4000-8000-000000000106
CHART-kpi-visitors:
id: CHART-kpi-visitors
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-kpi
children: []
meta:
chartId: 7
height: 20
width: 3
sliceName: Посетители
uuid: 19600000-0000-4000-8000-000000000107
ROW-revenue:
id: ROW-revenue
type: ROW
@@ -30,6 +100,7 @@ position:
- GRID_ID
children:
- CHART-revenue
- CHART-revenue-share
meta:
background: BACKGROUND_TRANSPARENT
CHART-revenue:
@@ -43,9 +114,23 @@ position:
meta:
chartId: 1
height: 50
width: 12
sliceName: Выручка по дням и категориям
width: 8
sliceName: Выручка по дням и категориям, ₽
uuid: 19600000-0000-4000-8000-000000000101
CHART-revenue-share:
id: CHART-revenue-share
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-revenue
children: []
meta:
chartId: 8
height: 50
width: 4
sliceName: Доля категорий в выручке
uuid: 19600000-0000-4000-8000-000000000108
ROW-pvo:
id: ROW-pvo
type: ROW
@@ -66,7 +151,7 @@ position:
children: []
meta:
chartId: 2
height: 50
height: 44
width: 12
sliceName: Сверка purchase и заказов
uuid: 19600000-0000-4000-8000-000000000102
@@ -78,6 +163,7 @@ position:
- GRID_ID
children:
- CHART-traffic
- CHART-known-share
meta:
background: BACKGROUND_TRANSPARENT
CHART-traffic:
@@ -91,15 +177,57 @@ position:
meta:
chartId: 3
height: 50
width: 12
width: 6
sliceName: Посетители и известные пользователи
uuid: 19600000-0000-4000-8000-000000000103
CHART-known-share:
id: CHART-known-share
type: CHART
parents:
- ROOT_ID
- GRID_ID
- ROW-traffic
children: []
meta:
chartId: 9
height: 50
width: 6
sliceName: Доля известных пользователей
uuid: 19600000-0000-4000-8000-000000000109
metadata:
color_scheme: supersetColors
label_colors:
Товары для дома: '#1FA8C9'
Текстиль: '#454E7C'
Посуда: '#5AC189'
Бытовая техника: '#FF7F44'
Детские товары: '#E04355'
Одежда и обувь: '#A868B7'
visitors: '#1FA8C9'
known_users: '#454E7C'
known_share: '#454E7C'
cross_filters_enabled: false
chart_configuration: {}
expanded_slices: {}
default_filters: '{}'
native_filter_configuration: []
native_filter_configuration:
- id: NATIVE_FILTER-period
name: Период
filterType: filter_time
type: NATIVE_FILTER
targets:
- {}
controlValues:
enableEmptyFilter: false
defaultDataMask:
extraFormData: {}
filterState: {}
ownState: {}
cascadeParentIds: []
scope:
rootPath:
- ROOT_ID
excluded: []
description: ''
theme_uuid: null
version: 1.0.0
@@ -36,6 +36,15 @@ metrics:
currency: null
extra: null
warning_text: null
- metric_name: known_share
verbose_name: Доля известных
metric_type: null
expression: SUM(known_users) / nullIf(SUM(visitors), 0)
description: null
d3format: .1%
currency: null
extra: null
warning_text: null
columns:
- column_name: _load_ts
verbose_name: Время загрузки
@@ -23,10 +23,26 @@ metrics:
metric_type: null
expression: SUM(revenue)
description: null
d3format: ',.2f'
currency:
symbol: ₽
symbolPosition: suffix
d3format: ',d'
currency: null
extra: null
warning_text: null
- metric_name: orders
verbose_name: Заказы
metric_type: null
expression: SUM(orders)
description: null
d3format: ',d'
currency: null
extra: null
warning_text: null
- metric_name: avg_check
verbose_name: Средний чек
metric_type: null
expression: SUM(revenue) / nullIf(SUM(orders), 0)
description: null
d3format: ',d'
currency: null
extra: null
warning_text: null
columns:
@@ -44,7 +60,7 @@ columns:
datetime_format: null
extra: null
- column_name: aov
verbose_name: Средний чек
verbose_name: Средний чек за день и категорию
is_dttm: false
is_active: true
type: DECIMAL(18, 2)