Skip to content

fraudRiskScorer: Add explainability output listing contributing risk factors #698

Description

@Kingsman-99

Description

fraudRiskScorer returns a numeric risk score but gives no insight into which signals drove it. Contributors should add an explain option that, when true, attaches a factors array to the result — each factor listing its name, contribution weight, and the raw observed value — so risk reviewers can understand and audit the score.

Acceptance Criteria

  • When explain: true is passed, the result includes factors: Array<{name: string, weight: number, value: number}>
  • The factors array is sorted by weight descending (highest-impact first)
  • When explain is false (default) the factors field is absent from the result object
  • Existing tests continue to pass

Context

  • Target file: src/lib/fraudRiskScorer.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions