# `IntentDecayScore`
[🔗](https://github.com/jaizendra-netizen/intent-decay-score/blob/main/lib/intent_decay_score.ex#L1)

Intent score per account with time decay (see https://www.onegtmlab.dev/glossary/intent-data).

Each signal has a weight and an age in days. It contributes `weight * 0.5 ^ (age_days / half_life)`,
so a signal that is one half-life old counts for half its weight. The account score is the sum.

# `signal`

```elixir
@type signal() :: %{
  account: String.t(),
  signal: String.t(),
  weight: number(),
  age_days: number()
}
```

# `decayed`

```elixir
@spec decayed(number(), number(), number()) :: float()
```

Value of one signal after `age_days` with the given half-life (in days).

# `format`

Format scores as a text table.

# `parse_csv`

```elixir
@spec parse_csv(String.t()) :: {:ok, [signal()]} | {:error, String.t()}
```

Parse CSV text with columns account, signal, weight, age_days into signal maps.

# `score`

```elixir
@spec score([signal()], number()) :: [
  %{
    account: String.t(),
    score: float(),
    signals: pos_integer(),
    newest_days: number()
  }
]
```

Score every account. Returns maps with account, score, signals and newest signal age, highest score first.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
