# `BantScore`
[🔗](https://github.com/jaizendra-netizen/bant_score/blob/main/lib/bant_score.ex#L1)

BANT lead scoring from a CSV with the columns `lead,budget,authority,need,timeline`.

Each letter is `yes` (2 points), `unknown` (1 point) or `no` (0 points); `true` and `false`
are accepted as `yes` and `no`. The total runs from 0 to 8 and gives a verdict:

  * 7 to 8: `qualified`
  * 4 to 6: `nurture`
  * 0 to 3: `disqualify`

Any other value in a letter column is an error.

# `answer`

```elixir
@type answer() :: :yes | :no | :unknown
```

# `lead`

```elixir
@type lead() :: %{
  lead: String.t(),
  answers: [answer()],
  score: 0..8,
  verdict: String.t()
}
```

# `counts`

```elixir
@spec counts([lead()]) :: [{String.t(), non_neg_integer()}]
```

Count of leads per verdict, in the order qualified, nurture, disqualify.

# `parse`

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

Parse the CSV text into scored leads, sorted by score descending then lead name.

# `parse_answer`

```elixir
@spec parse_answer(String.t()) :: {:ok, answer()} | :error
```

Parse a single answer: yes, no, unknown, true, false (any case).

# `points`

```elixir
@spec points(answer()) :: 0..2
```

Points for one answer: yes = 2, unknown = 1, no = 0.

# `render`

```elixir
@spec render([lead()]) :: String.t()
```

Printable table followed by the count per verdict.

# `score_answers`

```elixir
@spec score_answers([answer()]) :: 0..8
```

Score one lead from its four answers (budget, authority, need, timeline).

# `verdict`

```elixir
@spec verdict(0..8) :: String.t()
```

Verdict for a total score: 7-8 qualified, 4-6 nurture, 0-3 disqualify.

---

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