Skip to content

cull-email/pore

Repository files navigation

pore for Cull

An email data analysis library.

Installation

npm install @cull/pore

Usage

Generate analytical collections from email envelopes (see @cull/imap).

Origin

Analyze sender data to identify distinct senders, addresses and domains. Also, generate a collection of nodes (computing the number of emails for each distinct value) and links connecting the three for use with a data visualization library like d3-sankey.

import { Origin } from '@cull/pore';

// envelopes retrieved from a `@cull/imap` Client
let envelopes = [];

let analysis = new Origin(envelopes);

// optionally apply filters
analysis.filter([datum => datum.from.domain === 'cull.email']);

let senders = [...analysis.senders]; // distinct senders
let addresses = [...analysis.addresses]; // distinct addresses
let domains = [...analysis.domains]; // distinct domains
let sankey = analysis.sankey(); // generate nodes and links

Also, see tests.

Chronology

Analyze chronological data to bucket data by date, hour, day of week and a nested computation by day of week and then by hour.

import { Chronology } from '@cull/pore';

// envelopes retrieved from a `@cull/imap` Client
let envelopes = [];

let analysis = new Chronology(envelopes);

// optionally apply filters
analysis.filter([datum => datum.from.domain === 'cull.email']);

let byDate = [...analysis.byDate];
let byHour = [...analysis.byHour];
let byWeekday = [...analysis.byWeekday];
let byHourByWeekday = [...analysis.byHourByWeekday];

Also, see tests.

Development

makefile codifies directives for building, testing, linting and other development oriented tasks.