An Elixir library and Mix task that turns intent data into an account score that fades with time. Every signal has a weight and an age in days; it counts for weight x 0.5^(age / half-life), so a signal one half-life old is worth half and fresh intent outranks old intent. The account score is the sum. Offline, no dependencies. Built by OneGTMLab (GTM engineering for B2B teams).

Install

def deps, do: [{:intent_decay_score, "~> 1.0"}]

Use

account,signal,weight,age_days
Acme,pricing_page,10,0
Acme,job_post,20,14
Globex,funding,30,28
Globex,pricing_page,10,1
mix intent.decay signals.csv --half-life 14
account        score  signals  newest_days
Acme            20.0        2            0
Globex          17.0        2            1

Acme: 10 + 20 x 0.5 = 20.0. Globex: 30 x 0.25 + 10 x 0.5^(1/14) = 17.0 (7.5 + 9.5). The half-life defaults to 14 days. From code:

{:ok, signals} = IntentDecayScore.parse_csv(File.read!("signals.csv"))
IntentDecayScore.score(signals, 14)   # [%{account: "Acme", score: 20.0, signals: 2, newest_days: 0.0}, ...]

A weight or age that is not a number, a negative age, a missing column or an unreadable file prints error: ... and exits 1; a bad option exits 2.

Test

mix test

MIT licence.