Search by

jaizendra-netizen / signal-dedupe-window

onegtmlab

PHP CLI and library: collapse repeated buying signals for the same account and signal type inside a day window you set, and show what is left.

Package info

github.com/jaizendra-netizen/signal-dedupe-window

Homepage

Type:project

pkg:composer/jaizendra-netizen/signal-dedupe-window

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-29 05:02 UTC

This package is not auto-updated.

Last update: 2026-11-30 03:19:07 UTC


README

PHP command line tool and library. Give it a CSV with one row per buying signal you saw (the account, the type of signal and the date) and it collapses repeats of the same signal for the same account inside a window of days, then shows how many signals are left. It reads nothing but your file, calls no service and judges nothing: the signal types are your labels and the window is your choice. The rule, exactly: for each pair of account and signal type, take the dates in ascending order. The first date counts. A later date counts only when it is MORE than the window (in whole calendar days) after the last COUNTED date of that pair; otherwise it is a repeat and is collapsed. So the window runs from the last counted date, not from the last seen one, and a date exactly the window after the last counted date is still a repeat. Identical duplicate rows are simply repeats. Accounts and signal types are trimmed and matched without regard to case, and the first spelling seen is shown. The output has the number of rows, the counted signals, the repeats collapsed (with their share of rows), a line per signal type (raw, counted, collapsed, sorted by raw count, highest first, then by name) and the 10 accounts with the most counted signals (counted signals and distinct signal types, ties by account name). All percentages are rounded to 1 decimal. The numbers describe your file only.

Part of the OneGTMLab free GTM tools. Background on the idea: ClearCue vs Jungler.

Install

composer require jaizendra-netizen/signal-dedupe-window

Use

Input is a CSV with the columns account, signal_type and seen_on. Column names are matched without regard to case and may be in any order; other columns are ignored. seen_on is yyyy-mm-dd and nothing else; the tool never reads the clock. Option --window DAYS (a whole number of 0 or more, default 14, set by you) is the number of calendar days a later signal has to be beyond the last counted one to count again. With --window 0 only a different day counts. The command stops at the first bad row and names it. A bad date, an empty account or signal type, a missing column, a row with the wrong number of cells, a file with no rows or a bad --window exits 1 with a message; an unreadable file, an unknown option or a missing argument exits 2.

$ php bin/signal-dedupe-window sample.csv --window 14
rows read: 13, window: 14 days (set by you)
counted signals: 9
repeats collapsed: 4 (30.8% of rows)
by signal type:
Hiring: raw 9, counted 6, collapsed 3
Funding: raw 3, counted 2, collapsed 1
Job change: raw 1, counted 1, collapsed 0
accounts with the most counted signals (up to 10):
alpha.example.com: counted 3, signal types 2
gamma.example.com: counted 3, signal types 2
beta.example.org: counted 2, signal types 1
delta.example.org: counted 1, signal types 1

Test

php tests/run.php

Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.