UNPKG

@visactor/vmind

Version:

<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu

167 lines (166 loc) 5.78 kB
import type { Cell, ChartType } from '../../types/chart'; import type { DataCell, FieldInfo, DataTable, DataItem } from '../../types/base'; import type { AbnormalTrendOptions } from './algorithms/abnormalTrend'; import type { PearsonOptions } from './algorithms/correlation/pearson'; import type { OverallTrendingOptions } from './algorithms/overallTrending'; import type { SpearmanOptions } from './algorithms/correlation/spearman'; import type { ExtremeValueOptions } from './algorithms/extremeValue'; import type { MajorityValueOptions } from './algorithms/majorityValue'; import type { LOFOptions } from './algorithms/outlier/lof'; import type { DbscanOptions } from './algorithms/outlier/dbscan'; import type { VolatilityOptions } from './algorithms/volatility'; import type { StatisticsOptions } from './algorithms/outlier/statistics'; import type { DifferenceOptions } from './algorithms/outlier/difference'; import type { PageHinkleyOptions } from './algorithms/drift'; import type { BaseStatisticsOptions } from './algorithms/base/baseStatistics'; import type { BaseOptions } from '../../types/atom'; export declare enum AlgorithmType { OverallTrending = "overallTrend", AbnormalTrend = "abnormalTrend", PearsonCorrelation = "pearsonCorrelation", SpearmanCorrelation = "spearmanCorrelation", ExtremeValue = "extremeValue", MajorityValue = "majorityValue", StatisticsAbnormal = "statisticsAbnormal", StatisticsBase = "statisticsBase", DbscanOutlier = "dbscanOutlier", LOFOutlier = "lofOutlier", TurningPoint = "turningPoint", PageHinkley = "pageHinkley", DifferenceOutlier = "differenceOutlier", Volatility = "volatility" } export interface AlgorithmOptions { [AlgorithmType.OverallTrending]?: OverallTrendingOptions; [AlgorithmType.AbnormalTrend]?: AbnormalTrendOptions; [AlgorithmType.PearsonCorrelation]?: PearsonOptions; [AlgorithmType.SpearmanCorrelation]: SpearmanOptions; [AlgorithmType.ExtremeValue]?: ExtremeValueOptions; [AlgorithmType.MajorityValue]?: MajorityValueOptions; [AlgorithmType.StatisticsAbnormal]?: StatisticsOptions; [AlgorithmType.LOFOutlier]?: LOFOptions; [AlgorithmType.DifferenceOutlier]?: DifferenceOptions; [AlgorithmType.TurningPoint]?: {}; [AlgorithmType.PageHinkley]?: PageHinkleyOptions; [AlgorithmType.DbscanOutlier]: DbscanOptions; [AlgorithmType.Volatility]: VolatilityOptions; [AlgorithmType.StatisticsBase]?: BaseStatisticsOptions; } export declare enum InsightType { Min = "min", Max = "max", Avg = "avg", Outlier = "outlier", PairOutlier = "pair_outlier", ExtremeValue = "extreme_value", MajorityValue = "majority_value", TurningPoint = "turning_point", OverallTrend = "overall_trend", AbnormalTrend = "abnormal_trend", AbnormalBand = "abnormal_band", Correlation = "correlation", Volatility = "volatility" } export interface InsightTextContent { value: DataCell; formatValue?: string; fieldName: string; isMeasure?: boolean; color?: string; valueType?: 'ascendTrend' | 'descendTrend' | string; icon?: 'ratio' | 'ascendTrend' | 'descendTrend' | string; isDimValue?: boolean; } export interface Insight { name: string; type: InsightType; data: { index: number; dataItem: DataItem; }[]; fieldId?: string; seriesName?: DataCell | DataCell[]; textContent?: { content: string; plainText: string; variables?: Record<string, InsightTextContent>; }; value?: number | string; significant: number; info?: { [key: string]: any; }; } export type InsightAlgorithm = { name: string; chartType?: ChartType[]; forceChartType?: ChartType[]; supportStack?: boolean; supportPercent?: boolean; insightType: InsightType; canRun?: (context: DataInsightExtractContext) => boolean; algorithmFunction: (context: DataInsightExtractContext, options: any) => Insight[]; }; export type DataProcessOutput = { chartType: ChartType; cell: DataCell; fieldInfo: FieldInfo[]; dataTable: DataTable; seriesDataMap: Record<string | number, { index: number; dataItem: DataItem; }[]>; }; export type ExtractInsightOutput = { insights: Insight[]; }; export type GenerateTextOutput = { insights: Insight[]; usage: any; }; export interface ChartDataItem { index: number; dataItem: DataItem; } export type DimValueDataMap = Record<string | number, ChartDataItem[]>; export interface AxesDataInfo { dataset: DataTable; seriesNames: string[]; series: any[]; seriesIndex: number; seriesId: string; dimensionDataMap: DimValueDataMap; dimensionValues: DataCell[]; dimensionSumMap: Record<string, number[]>; dimensionStackSumMap: Record<string, number[]>; axisTitle: string | string[]; yField: string | string[]; } export interface DataInsightExtractContext { dataset: DataTable; originDataset: DataTable; fieldInfo: FieldInfo[]; dimensionDataMap: DimValueDataMap; dimensionSumMap: Record<string, number[]>; dimensionStackSumMap: Record<string, number[]>; dimensionValues: DataCell[]; seriesDataMap: DimValueDataMap; chartType: ChartType; cell: Cell; spec: any; insights?: Insight[]; leftAxesDataList?: AxesDataInfo; rightAxesDataList?: AxesDataInfo; } export interface DataInsightOptions extends BaseOptions { maxNum?: number; detailMaxNum?: { types: InsightType[]; maxNum: number; }[]; algorithms?: AlgorithmType[]; algorithmOptions?: AlgorithmOptions; isLimitedbyChartType?: boolean; usePolish?: boolean; enableInsightAnnotation?: boolean; }