Packages

Elixir library and Mix task that reads a CSV of contacts and the outreach sequences they are enrolled in and shows which contacts sit in more than one sequence and which sequences share contacts.

Current section

Files

Jump to

README.md

# sequence_enrollment_overlap

Elixir library and Mix task. Give it a CSV of contacts and the outreach sequences they are enrolled in. It shows how many contacts sit in more than one sequence, which contacts they are, how much each sequence overlaps with the others and which pairs of sequences share the most contacts. It reads the file you give it, sends nothing and has no network access.

The contact column is trimmed and lowercased. The sequence column is trimmed and compared case-insensitively; the first spelling seen is the one shown. The same contact and sequence pair on more than one row counts once, and the extra rows are reported as duplicate rows collapsed. Enrollments are the distinct contact and sequence pairs. The share of contacts in more than one sequence, and the share of each sequence that is also in another sequence, are percentages of contacts with 1 decimal. The first 10 contacts in more than one sequence are listed, most sequences first and then by contact. Sequences are listed by number of contacts, largest first, then by name. The 10 pairs of sequences that share the most contacts are written as `A + B: N`, ties broken by the two names. Extra columns are ignored.

Exit code 0 means the report was printed, 2 means the input could not be read: a missing file, a missing column, no rows, or an empty contact or sequence (the error names the line).

Part of the [OneGTMLab](https://www.onegtmlab.dev) free GTM tools. Background on the idea: [Instantly vs Reply.io](https://www.onegtmlab.dev/tool-directory/compare/instantly-vs-reply).

## Install

```
{:sequence_enrollment_overlap, "~> 1.0"}   # in mix.exs deps
```

## Use

CSV columns: contact, sequence. The sample has 13 rows: one contact in three sequences, two contacts in two, one duplicate that differs only by letter case and one that differs only by spaces and case.

```
$ mix sequence_enrollment_overlap sample.csv
rows: 13
contacts: 7
enrollments (distinct contact and sequence pairs): 11
duplicate rows collapsed: 2
contacts in more than one sequence: 3 (42.9% of contacts)

contacts in more than one sequence (first 10, most sequences first):
  a@example.com: Alpha, Beta, Gamma (3 sequences)
  b@example.com: Alpha, Beta (2 sequences)
  f@example.com: Beta, Gamma (2 sequences)

per sequence (most contacts first):
  Beta: 5 contacts, 3 also in another sequence (60.0%)
  Alpha: 4 contacts, 2 also in another sequence (50.0%)
  Gamma: 2 contacts, 2 also in another sequence (100.0%)

sequence pairs that share the most contacts (first 10):
  Alpha + Beta: 2
  Beta + Gamma: 2
  Alpha + Gamma: 1
```

## Test

```
mix test
```

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