Monday, January 12, 2009

Build Yourself a Micro-blog Knowledge Management Solution

The purpose of this article is to demonstrate how you can easily build an open source, micro-blog application to capture important ideas, best practices, web links, and other cool stuff.

With many years of personal experience in both document management and knowledge management, micro-blogs are without a doubt the best tool for capturing hidden, tacit knowledge. Unfortunately, Twitter focuses too much on “me” and not enough on “us”. In knowledge management we want to record important “nuggets” of work experience, not necessarily tied to an activity such as “What are you doing?” in Twitter. We also want to easily organize the information by community, subject, or function. To access the data enterprise-wide, we require the flexibility to publish the data in a variety of formats and control data storage and integration including interfacing with an existing user community.

The software components for our micro-blog application include Google Docs spreadsheet, Yahoo Pipes, and Dojo Javascript. To see a working example of this solution visit ECMHUB.org, sign in using your Google account, and click anywhere you see “IdeaNotes”. The IdeaNotes are stored by community so if you wish to recommend a valuable Web 2.0 article you click on “Web 2.0” cloud item, click IdeaNotes, and add your article link. Very easy to contribute your knowledge to the site!

We start our solution by defining the database – a simple Google Doc spreadsheet. A Google Doc spreadsheet is not your grandmother's xls document. Thanks to Google it is always online, can contain over 100,000 cells, and includes built-in web forms. Unlike Twitter, our micro-blog application incorporates a simple taxonomy defined as spreadsheet columns:

  • Timestamp
  • Category (i.e. community or subject)
  • Title
  • Link
  • Author
  • Description
  • Thumbnail (i.e. picture of the author or blog)
  • Type (i.e. idea, best practice, article, opinion etc.)

Here is the link to the spreadsheet

Next, we create a Google Docs form from the spreadsheet. It is automatically created - simply click Form > Create from inside the Google Docs). As an alternative, we could also write a program incorporating the Google Docs API for direct read/write access to the spreadsheet. The Google API also provides a nice integration mechanism for connecting to an existing user community.

Here is the link to the form

Now that we have our simple “database” and micro-blog entry form, we will next reformat the spreadsheet for both RSS and JSON output required for embedding the data in other applications. Google Docs supports RSS publishing but it does not associate the spreadsheet columns with standard RSS designators. For this we will use Yahoo Pipes to take the published spreadsheet in CSV (comma delimited format) and convert the column names to their correct RSS designators. To automatically update the spreadsheet when a new entry is added make sure to check “Automatically re-publish when changes are made” under the spreadsheet publishing option.

Here is the link to the Yahoo Pipe

With the Yahoo Pipe created we can now publish a correct RSS feed just like Twitter.

Here is the link to the RSS feed

To complete our example we will show you how to read and manipulate the spreadsheet data in Javascript. Using Javascript we will call the Yahoo pipe, download the data in JSON format, and load the data into variables. Now instead of lisiting a hundred of lines of code using standard Javascript, we will use the Dojo Toolkit and show a very easy way to parse and load the data.

/*

... Load dojo here ...
dojo.require("dojo.io.script");

*/

First, set the initial load of Dojo and call up the dojo.io.script module. Unlike other Javascript tools, Dojo lets you control what modules of are loaded using the dojo.require.module statement.

/*

dojo.io.script.get({
url: "http://pipes.yahoo.com/pipes/pipe.run?",
content: {
_id: "6e2fcf6dc6feb77d09ab563a6cda2e69",
_render: "json",
_callback: "piper"
},
handleAs: "text/json",
preventCache: true,
error: function(text){
alert("An error has occurred - " + text);
return text;
}
});

*/

Here is the link to the JSON output

Next, the dojo.io.script.get function embeds script that calls the Yahoo pipe using the URL and parameters shown. The callback activates "piper" function and writes the spreadsheet data in the format of your choice.

/*
function piper(feed){
var tmp = “”;
if (feed.value.items.length != 0) {
for (var i = 0; i < feed.value.items.length; i++) {
var title = feed.value.items[i].Title;
var description = feed.value.items[i].Description;
var link = feed.value.items[i].Link;
var pubDate = feed.value.items[i].pubDate;
var author = feed.value.items[i].Author;
var picture = feed.value.items[i].Thumbnail;
var category = feed.value.items[i].Category;
var option = feed.value.items[i].Type;
/* build html string */
tmp += ...............
}
}
/* write the string out */
dojo.byId('DivID').innerHTML = tmp;
}

*/

That completes the micro-blog application for knowledge management. Please feel free to use what you need and add your comments below.

1 comment:

ELQ said...

Very nice solution, and works like a charm. Thanks for the info!