Skip to content
BOE Docs
  • mode: scoring
  • Score and rank
  • Stateless

Scoring

Give every case points by the same rules, then add them up. Scoring turns many small judgments into one number you can act on.

The everyday version

A lender gets 500 applications a day. Each reviewer weighs income and missed payments a little differently. Scoring gives every applicant points by the same rules, then sums them.

Score card: applicant Danacredit-score
Score card for Dana
FactValuePoints
Income82,000+82
Missed payments0+0
Total82
TierApprove
  • Decline below 50
  • Review 50 to 69
  • Approve 70 and above

Dana scores 82, which is in the Approve band.

The ruleset

A ruleset is a list of rules. Each rule says which facts it reads, when it applies and how many points it gives. The tiers turn the total into a named outcome.

credit-score.json
{
  "id": "credit-score",
  "mode": "scoring",
  "rules": [
    {
      "id": "income-score",
      "inputs": [{ "name": "a", "type": "Applicant" }],
      "then": { "score": ["multiply", 0.001, "$a.income"] }
    },
    {
      "id": "missed-payments-penalty",
      "inputs": [{ "name": "a", "type": "Applicant" }],
      "when": [">=", "$a.missedPayments", 2],
      "then": { "score": -30 }
    }
  ],
  "config": {
    "tiers": [
      { "id": "approve", "name": "Approve", "threshold": 70 },
      { "id": "review", "name": "Review", "threshold": 50 },
      { "id": "decline", "name": "Decline", "threshold": 0 }
    ]
  }
}

The result is a real run of this ruleset on these facts. executionTimeMs changes with each run.

Read it in plain English

The console writes one sentence per rule each time you save. The sentences let anyone on your team read the ruleset in plain English.

Readouts for credit-score
RuleReadout
income-scoreAdds one point per thousand of income.
missed-payments-penaltyTakes 30 points off when the applicant has two or more missed payments.

Call it

Send the short code and the facts. The result comes back in one round trip.

execute.ts
const decision = await boe.execute(ruleset.shortCode, {
  Applicant: [{ income: 82000, missedPayments: 0 }],
});

See why

The result names each rule that fired in fired and what it added in contributions. Pass lineage: true for the full record of the run.

Contributions for DanaTotal 82
  • income-scoreFired+82
  • missed-payments-penaltyNot fired0

Go deeper

Weights and caps

A rule action can carry a weight. A rule with no weight counts as 1. confidence reads the weights: it is the weight of the rules that fired over the weight of every rule. In the run above, one of two rules fired, so confidence is 0.5.

A cap limits what one rule adds. Add "capped" to config.strategies and set the limit by rule id in config.caps. With "caps": { "income-score": 60 }, Dana’s income adds 60 points.

Tiers and bands

config.tiers lists named tiers, each with a threshold. The total lands in the highest tier whose threshold it meets or passes. Dana’s 82 passes Approve at 70, so the result carries that tier as tier.

A total below every threshold matches no tier, and the result has no tier key. Set the lowest threshold to the lowest total your rules can produce.

Signal groups

Several rules can measure one fact, such as one rule per income band. Put them in a signal group so confidence counts the fact once. Declare groups in config.confidenceConfig.signalGroups, each with a signalGroupId and its ruleIds.

A group fires when any of its rules fires. It weighs as much as its heaviest rule.