Scripts for extracting and plotting statistics from an IMAP account
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


These are a couple of scripts that compute statistics ("stress" and "procrastination") from the data in the email inbox.

For example, here are my stats as they appear on my webpage:

    <p class='graphics'> 
        <img id='stats_count' src=""  alt='Count'/> 
        <img id='stats_age' src=""    alt='Age'/> 
<p class='caption' style='font-style: italic'> 
    Fig. 2. Stress and procrastination levels in the last 7 days.
    Stress is measured by the number of flagged messages in the email inbox;
    procrastination is measured by the median age of those messages.
    <img id='updated' src="" alt='Update'/> 


The first script busymail_log downloads the headers of email messages in a given mailbox, and stores them as a YAML file in a given directory.

Example usage:

busymail_log --host --username <user> --password <pwd> \
             --folder "[Gmail]/Starred" --storage logs/

The second script loads all the YAML files from the given directory, computes some statistics, and plots them to file.

busymail_plot --storage logs/ --output figures/

Note that if you only have a few datapoints, the plot will not be clearly visible with the default axis properties (showing 1 week of data).

If you create a cron job with these two commands (and perhaps a rsync to your website), you can create an automatically updating summary of your activity.


Install using:

python develop

The prerequisites are:

  • pyyaml
  • numpy
  • matplotlib
  • imapclient

Install them before attempting the above command, as most of the times is not smart enough to install them correctly.