Skip to main content

default

chainalign-backend


chainalign-backend / services/EdgeCaseDetectionService / default

Variable: default

default: object

Defined in: services/EdgeCaseDetectionService.js:403

Type Declaration

batchDetectEdgeCases()

batchDetectEdgeCases: (skus) => Promise<any[]>

Batch detect edge cases for multiple SKUs

Parameters

skus

any[]

Array of SKU data objects

Returns

Promise<any[]>

Array of results with SKU ID and edge case flags

detectDataQualityIssues()

detectDataQualityIssues: (params) => boolean

Detect data quality issues

Issues include:

  • High percentage of missing values (> 20%)
  • High percentage of outliers (> 10%)
  • Stale data (last update > 30 days ago)

Parameters

params
demandHistory

number[]

Historical demand (may contain nulls)

lastUpdated

Date

Timestamp of last data update

missingThreshold

number = 0.2

Threshold for missing values (default: 0.2)

outlierThreshold

number = 0.1

Threshold for outliers (default: 0.1)

stalenessThreshold

number = 30

Days threshold for staleness (default: 30)

Returns

boolean

True if data quality issues detected

detectDependencies()

detectDependencies: (demandHistory, otherSkuDemands, correlationThreshold) => boolean

Detect cross-SKU dependencies Requires demand history for multiple SKUs to calculate correlation

Parameters

demandHistory

number[]

Demand history for target SKU

otherSkuDemands

number[][] = []

Array of demand histories for other SKUs

correlationThreshold

number = 0.7

Correlation threshold (default: 0.7)

Returns

boolean

True if strong dependency detected

detectEdgeCases()

detectEdgeCases: (params) => Promise<string[]>

Detect all edge cases for a single SKU

Parameters

params
demandHistory

number[]

Historical demand values

lastUpdated

Date

Last update timestamp

otherSkuDemands

number[][] = []

Optional: demand histories for dependency detection

skuId

string

SKU identifier

Returns

Promise<string[]>

Array of edge case flags

detectEventSensitivity()

detectEventSensitivity: (demandHistory, cvThreshold) => boolean

Detect event sensitivity (high variability around known dates) Uses coefficient of variation and checks for spikes

Parameters

demandHistory

number[]

Historical demand values

cvThreshold

number = 0.8

CV threshold for event sensitivity (default: 0.8)

Returns

boolean

True if event sensitive

detectLifecycleComplexity()

detectLifecycleComplexity: (demandHistory) => boolean

Detect lifecycle complexity (lumpy patterns, false starts, extended tail)

Indicators:

  • Multiple zero-to-nonzero transitions (lumpy)
  • Early peak followed by decline then recovery (false start)
  • Long tail of low values after peak (extended tail)

Parameters

demandHistory

number[]

Historical demand values

Returns

boolean

True if lifecycle complexity detected

detectStructuralBreak()

detectStructuralBreak: (demandHistory, threshold) => boolean

Detect structural breaks using CUSUM (Cumulative Sum) algorithm A structural break indicates a significant change in demand level or pattern

Parameters

demandHistory

number[]

Historical demand values

threshold

number = 3.5

Threshold for detecting break (default: 3.5)

Returns

boolean

True if structural break detected