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.
Summary
Functions
Count of leads per verdict, in the order qualified, nurture, disqualify.
Parse the CSV text into scored leads, sorted by score descending then lead name.
Parse a single answer: yes, no, unknown, true, false (any case).
Points for one answer: yes = 2, unknown = 1, no = 0.
Printable table followed by the count per verdict.
Score one lead from its four answers (budget, authority, need, timeline).
Verdict for a total score: 7-8 qualified, 4-6 nurture, 0-3 disqualify.
Types
Functions
@spec counts([lead()]) :: [{String.t(), non_neg_integer()}]
Count of leads per verdict, in the order qualified, nurture, disqualify.
Parse the CSV text into scored leads, sorted by score descending then lead name.
Parse a single answer: yes, no, unknown, true, false (any case).
@spec points(answer()) :: 0..2
Points for one answer: yes = 2, unknown = 1, no = 0.
Printable table followed by the count per verdict.
@spec score_answers([answer()]) :: 0..8
Score one lead from its four answers (budget, authority, need, timeline).
@spec verdict(0..8) :: String.t()
Verdict for a total score: 7-8 qualified, 4-6 nurture, 0-3 disqualify.