Skip to content

Commit

Permalink
fix(ava/insight): modify the methods for constructing ChangePointInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
LAI-X committed Nov 29, 2023
1 parent 1886381 commit ad497d2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions packages/ava/src/insight/insights/extractors/changePoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,21 @@ export const getChangePointInfo: GetPatternInfo<ChangePointInfo> = (props) => {
return getNonSignificantInsight({ insightType, infoType: 'noInsight', customInfo: { info } });
}

const outliers: ChangePointInfo[] = changePoints.map((item) => {
const outliers: ChangePointInfo[] = [];
changePoints.forEach((item) => {
const { index, significance } = item;
return {
type: insightType,
dimension,
measure,
significance,
index,
// occasional abnormality: index is out of range
x: data[index]?.[dimension],
y: data[index]?.[measure] as number,
significantInsight: true,
};
if (!isNil(data[index])) {
outliers.push({
type: insightType,
dimension,
measure,
significance,
index,
x: data[index][dimension],
y: data[index][measure] as number,
significantInsight: true,
});
}
});
return outliers;
};

0 comments on commit ad497d2

Please sign in to comment.