Geeks With Blogs

Lance's TextBox

This post by Jeff Barr gives some interesting examples of things people might want to do with their data, and more specifically connecting their data to and from multiple sources. The kind of things Jeff mentions can be attained using RSSBus. It all boils down to flexibility, and how someday we should be able to take such flexibility for granted.

One of the examples Jeff gives is locating the Amazon wishlist of his top email correspondents, which is actually quite easily done with RSSBus. RSSBus comes with what we call "connectors" for email (pop, imap, smtp), amazon web services (including wishlist searching), and lots of other data sources. And since the RSSBus connector interface is open, new connectors for things like LinkedIn and Twitter can be created and shared. I can take the ImapOps connector and pipe its output to the AmazonOps connector and voila, I have a list of amazon wishlists for my top email correspondents. How? Check this out, here's the skinny:

  1. Call the RSSBus imapSearch operation and get a list of emails.
  2. Call the RSSBus rsbFeedUnion operation to consolidate mails from the same sender into one item per sender, with a count of how many emails from this sender were in the box.
  3. Sort this list by number of emails from each sender with the rsbSort operation.
  4. Use the amazonListSearch operation to Search for an Amazon wishlist for the top 10 most active senders in the my list of emailers.

Here's what the actual script looks like (download the full script):

<rsb:call save="mail" op="imapSearch?server=myserver&searchcriteria=ALL" />
<rsb:call save="union" op="rsbFeedUnion?feed=[_feeds.mail | urlencode]&filter=imap:fromemail" />
<rsb:call op="rsbSort?feed=[_feeds.union | urlencode]&sortby=rsb:count&type=numeric">
  <rsb:call op="amazonListSearch?email=[imap:fromemail]&type=wish" pagesize="10">
    <rsb:push />

For those who want a more technical explanation, let me take you up close and personal with this RSSBus script:

  1. First, I call the imapSearch operation. I give it my IMAP server and login information and tell it I want a list of ALL my emails. I save this list in a cached RSS feed called "mail". Two sub-notes here: authentication info need not be specified here if I take advantage of the RSSBus profile, and searchcriteria is extremely flexible and follows the IMAP specification, so I could do something like searchcriteria=SENTSINCE 1-Feb-2007 to get a list of only the mails sent since Feb 1.
  2. Next, I call the rsbFeedUnion operation. I tell it to perform a union on the "mail" feed. Yes, I'm doing a union on one set of information, and the reason is so that I can take advantage of the filtering capabilities of the rsbFeedUnion operation to consolidate duplicate mails from the same sender. So the result of this call is a feed of information about emails, in which each sender only appears once in the list. I save this feed as "union". Note that rsbFeedUnion will increment a counter for me when a particular sender is encountered more than once. I could set the filter input to eliminate duplicate subjects, or any other attribute of the mail feed, but here I am interested in the sender.
  3. Now I want to sort this "union" feed of emails by the number of times each sender has mailed me, so I call rsbSort, give it my "union" feed, and tell it which attribute to sort by (rsb:count). Unlike the two previous operation calls, I won't save this feed, but instead, for each of the 10 (pagesize) individual items in the feed I'll call the amazonListSearch operation.
  4. Finally, the amazonListSearch operation returns a final feed of items containing information about the wish list(s) (if one exists) of each mail sender. Now I have an RSS feed of Amazon wishlists for my top email contacts!

Technorati : , , , , , ,

Posted on Thursday, February 8, 2007 10:43 AM Programming , Software | Back to top

Comments on this post: Connecting sources of data, online or off

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Lance Robinson | Powered by: