> ## Documentation Index
> Fetch the complete documentation index at: https://docs.frayme.io/llms.txt
> Use this file to discover all available pages before exploring further.

# scorecard

> Weighted-sum risk score across structured factors. The deterministic alternative to AI synthesis.

`scorecard` produces a 0–100 risk score from weighted factors. Each factor is a path into the run context with a list of cases mapping observed values to sub-scores. The final score is the weighted sum of sub-scores.

## Configuration

```jsonc theme={null}
{
  "id": "sc-onboarding",
  "type": "scorecard",
  "data": {
    "label": "Risk Scorecard",
    "outputField": "risk_score",
    "extractSubScores": true,
    "description": "Compute weighted risk score from device, identity, and amount factors",
    "factors": [
      {
        "id": "factor-1",
        "field": "device_result.risk_score",
        "weight": 35,
        "cases": [
          { "id": "c1", "operator": "<=", "value": 20, "score": 0 },
          { "id": "c2", "operator": "<=", "value": 50, "score": 40 },
          { "id": "c3", "operator": "<=", "value": 80, "score": 70 },
          { "id": "c4", "operator": ">", "value": 80, "score": 100 },
        ],
      },
      {
        "id": "factor-2",
        "field": "identity_result.confidence",
        "weight": 40,
        "cases": [
          { "id": "c5", "operator": ">=", "value": 0.9, "score": 0 },
          { "id": "c6", "operator": ">=", "value": 0.7, "score": 30 },
          { "id": "c7", "operator": ">=", "value": 0.5, "score": 60 },
          { "id": "c8", "operator": "<", "value": 0.5, "score": 100 },
        ],
      },
      {
        "id": "factor-3",
        "field": "input.amount",
        "weight": 25,
        "cases": [
          { "id": "c9", "operator": "<=", "value": 100, "score": 0 },
          { "id": "c10", "operator": "<=", "value": 500, "score": 20 },
          { "id": "c11", "operator": "<=", "value": 2000, "score": 50 },
          { "id": "c12", "operator": ">", "value": 2000, "score": 90 },
        ],
      },
    ],
  },
}
```

## How the score is computed

For each factor: evaluate the cases top-down, take the first match's `score` as the sub-score. Then:

```text theme={null}
final_score = sum( sub_score[i] * weight[i] ) / sum( weight[i] )
```

In the example above, weights total 100; the final score is the weighted average mapped onto a 0–100 scale.

## `extractSubScores`

When `true`, each sub-score is also written to the run context under `<outputField>_<factor_id>` — e.g. `risk_score_factor-1`, `risk_score_factor-2`, `risk_score_factor-3`. Used to make the score's components inspectable in downstream nodes and audit logs.

## Scorecard vs AI synthesis

|                                       | Scorecard                                                  | AI synthesis                                     |
| ------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------ |
| Determinism                           | 100% (same input → same output)                            | High but not perfect (temperature 0.1)           |
| Reasoning trail                       | Implicit (sub-scores)                                      | Explicit (`reasoning` field)                     |
| Handles unstructured signals          | No                                                         | Yes (adverse media text, document narratives)    |
| Easy to defend in regulator interview | Yes                                                        | Yes — with the prompt + temperature config       |
| Best for                              | Structured velocity / device / identity-confidence signals | Borderline cases combining heterogeneous signals |

Production workflows commonly combine both — a scorecard handles the cleanly-structured factors, an AI synthesis layer handles the borderline cases that need narrative reasoning.
