Here at Fuzzy Math, in addition to all of the other projects we have going on, we”ve been working on creating a dashboard to help the powers that be (aka, bosses) help keep track of what is going on in the company, who”s working on what, how the blog is doing, and so forth over a given time period. Â With that in mind, we set out to pull in data from the various resources we use and combine them in a meaningful way. Â In this post, we”ll explore what resources we”re using and how we accessed them.
For our purposes, we decided that a PHP script would be a simple yet effective way to retrieve and combine all of our data. Â In addition to all the ease of OOP, PHP allowed us to make easy calls to the various APIs we would be using via the cURL module and handle XML via SimpleXML. Â We also ended up utilizing the GData package from the creators of the Zend Framework. Â This made the authorization process with Google all too easy.
GoogleÂ (settings spreadsheet and authentication)
In addition to info like hours and project status, Fuzzy Math keeps track of several indicators on a daily or weekly basis. Â Financial information, project proposals in the works, etc. Â By keeping this info in a Google Spreadsheet, we not only had an effective method for storing this information and allowing multiple users to update the file, but our dashboard could display the relevant data. Â Using Zend”s Gdata package, we can authenticate with Google and access the data.
We also use the spreadsheet as a means to store configuration data for the rest of the script, rather than hardcoding the variables in the file. Â Variables like the Twitter screenname to use, the mapping between blog usernames to Basecamp usernames, Basecamp company ID, and any other information the script needs are stored here. Â This also acts as a form of security, as only users with access to the spreadsheet will be able to see see the dashboard data.
Chances are you”re already using Basecamp for something, it is a pretty standard tool for group management, time tracking, and more. Â In our case, we wanted to pull the time tracking data and project milestones for use in our dashboard. Â Luckily, Basecamp has a pretty expansive API to help users access their data. Â We wanted our data organized as “milestones by project” & “hours per project & total hours by person.” Â This meant that we needed that we would be making several calls to the API to get everything we wanted.
Before we get into specifics about queries, let”s talk about tokens. Â Tokens are used by Basecamp to restrict who has access to what resources. Â Each call to the API includes a token for security purposes, and this token acts as a filter for what will be returned. Â You can find yours on the “My Info” page. Â With that in mind, if you”re using the Basecamp API to develop a multi-user application, make sure you”re using an appropriate token. Â You wouldn”t want too much or too little information shown.
Back to the queries. Â The first thing we need to do is get our companies projects & employees. Â Well, actually, the first thing you need is your company ID, but we didn”t feel this was necessary to retrieve every time the dashboard updates, as it isn”t too likely too change. Â The easiest way we found to look this up (although there is probably a much more obvious way we just didn”t know about) was to look up a known user”s data. Â User”s ID”s are shown when looking at their “My Info” page, and a person”s info includes the company they are working for. Viola, company ID. Â Write it down somewhere, you”ll need it.
With company ID in hand, you can get lists (formatted as XML) of current projects & company employees, via the appropriately named “get projects” and “get people” functions. Â We only needed the names and IDs for these so that we could look up further details and show their names on the dashboard. Â Iterating over the list of IDs you can retrieve the project milestones (upcoming, completed, and overdue), and time reports for each employee.
Other companies might also be interested to know that the API allows access to “To-do Lists.” Â We at Fuzzy Math aren”t big users of the feature, so we didn”t include it in our dashboard.
Within Fuzzy Math, there isn”t one person who has responsibility for the Twitter account, and as such it was deemed a helpful addition to the dashboard. Â As you would expect, Twitter has an API for developers to make use of . Â We didn”t need to do anything too fancy, so we didn”t have to bother with authentication. Â Essentially all we did was pull in the recent timeline for our Twitter account (FuzzyMath), and do a count of messages over the given time period. Â The user_timeline function gave us an xml feed with just this information. Â A quick parse with SimpleXML and we were all set. Â If we were to start using separate twitter account for each employee or somehow differentiate between who tweeted what, things could get more complicated.
Similarly to the Twitter account, the Fuzzy Math blog is updated by several employees. Â Unlike Twitter though, we could actually tell who wrote what, as each has their own username. Â To keep the process simple, we made use of the existing blog feed, parsing the xml for the authors and post count information.
Putting it all together
With all of our data in hand, it was just a matter of combining the information together as needed. Â Through a bit of haphazardly written PHP, we built an XML string containing milestone info, company-wide totals, and individual totals. Â Getting the blog info to play nicely was a bit of a snag, as the Basecamp user names didn”t match those from the blog. Â A simple mapping array solved that problem, and after a bit of debugging, we had our info ready for display. Â Of course, actually displaying the information is a whole other story.
Our monthly newsletter is targeted at those with an interest in UX design, research, and strategy.