refactor: expose electric data freshness

This commit is contained in:
kkfluous
2026-08-07 15:22:04 +08:00
parent 21f5e5388a
commit 0d849fcbb1
6 changed files with 46 additions and 18 deletions
+14 -1
View File
@@ -17,7 +17,7 @@ export interface MetricDefinition {
drillEntity: 'vehicle' | 'assessment-target' | 'hydrogen-station' | 'hydrogen-customer' | 'hydrogen-order' | 'electric-charge-order' | 'etc-toll-record' | 'etc-bill';
}
export const METRIC_CATALOG_VERSION = 4;
export const METRIC_CATALOG_VERSION = 5;
const MILEAGE_METRICS: readonly MetricDefinition[] = [
{
@@ -273,6 +273,19 @@ const ELECTRIC_METRICS: readonly MetricDefinition[] = [
dimensions: ['date', 'station', 'region', 'operating-company', 'vehicle-kind', 'customer', 'plate', 'order-status'],
drillEntity: 'electric-charge-order',
},
{
id: 'electric.data_freshness',
domain: 'electric',
label: '电能数据截至时间',
description: '已导入充电订单中最后一条订单的业务开始时间,用于区分当期零业务与数据尚未更新。',
unit: 'timestamp',
aggregation: 'latest',
timeSemantics: 'freshness',
formula: 'MAX(start_time)',
sources: ['bi_ele_charge_record'],
dimensions: ['station', 'vehicle-kind'],
drillEntity: 'electric-charge-order',
},
];
const ETC_METRICS: readonly MetricDefinition[] = [