module TouchFrequencyCapCheck
Overview
Count touches per contact inside a window of calendar days you set, and list the contacts above a cap you set. The window, the cap and "today" are all yours: the tool never reads the clock and knows no rule about what works.
Defined in:
touch_frequency_cap_check.crConstant Summary
-
MAX_LISTED =
20 -
REQUIRED =
["contact", "channel", "touched_on"] of ::String -
USAGE =
"usage: touch-frequency-cap-check touches.csv --today 2026-01-15 [--days 14] [--cap 3]\nCSV columns: contact, channel, touched_on (yyyy-mm-dd). --today is required; the window (--days, default 14) and the cap (--cap, default 3) are set by you. More: https://www.onegtmlab.dev/blog/the-abm-workflow-every-team-needs-in-2026" -
VERSION =
"1.0.0"
Class Method Summary
-
.analyse(touches : Array(Touch), today : Time, days : Int32, cap : Int32) : Report
A touch is inside the window when 0 <= today - touched_on <= days - 1, that is the last
dayscalendar days including today. -
.cli(args : Array(String), stdout : IO, stderr : IO) : Int32
Command line entry.
- .fmt(t : Time) : String
-
.parse_csv(text : String) : Array(Array(String))
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark.
-
.parse_date(text : String) : Time | Nil
yyyy-mm-dd only, a real calendar date.
- .pct(v : Float64) : String
-
.read_touches(text : String, today : Time) : Array(Touch)
Reads the rows.
- .render(r : Report) : String
- .table(rows : Array(Array(String))) : String
Class Method Detail
A touch is inside the window when 0 <= today - touched_on <= days - 1,
that is the last days calendar days including today.
Command line entry. Returns the exit code: 0 ok, 1 bad input or file, 2 usage.
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark. Returns rows of raw cell strings.
yyyy-mm-dd only, a real calendar date. Returns UTC midnight of that day.
Reads the rows. Contacts and channels are trimmed and compared without regard to case; the first spelling seen is the one shown.