I took a busman's holiday today to combine my photography, biology (birds in this case) and programming hobbies. What fun! The idea was to see what could be done with open data and some basic programing skills. While there is a lot of data about birds on the Web, most of it is copyright or tied up in forms that can only be accessed by humans using a web browser. Scraping can be done, but that probably violates copyright in most cases, so I looked for open APIs or open data sets. Whole organism biologists are way behind the curve when it comes to making data available to non-human access.
So, to see what could be done with open data, I wrote an application for mashing up species (of anything as long as there is information available online) with information on them from Wikipedia, images from Flickr, and other data from the Internet. I tested it with South African birds, and although it is still crude, it makes a pretty cool alternative way to get bird info on a computer or tablet - provided there is Internet of course. Will have it up on dkeats.com in the next day or so. It just goes to show how fast you can build appications with Chisimba, since having it working took about 4 hours - of which one was spent converting the bird list to XML format. I generated the skeleton for it using Module builder a few weeks ago and then forgot about it. The database class took 7 minutes to write, with most of the functionality being in an ops class that took about 2 hours. It uses JSON blocks, so adding ops functionality to a block and putting it in the interface literally takes seconds to do.
The module is called species, it is not in the repository yet, I need some permissions to use the species list data before I can commit. It will work for any group of organisms for which there is a reasonable chance of information being available. Just load a species list, and you get instant mashups. The next thing I want to add is the ability to automatically find photographs provided by a user on the Chisimba system.
UPDATE: You can now take this for a test drive on
dkeats.com
UPDATE2: Thanks to the Encyclopedia of Life (to which I have contributed many images) and its open API, I was able to find a way to incorporate birdsongs. Unfortunately, for South Africa species, there are not that many of them available, or at least linked. You can now check it out on
dkeats.com and look for Batis, Cape as an example. Unfortunately, they are all in the MP3 format, and Firefox doesn't play MP3 as HTML 5 audio, so I had to use the Flash player for Firefox. The great thing about Chisimba is that this is three lines of code to build a Flash audio player.
Here is how to build a sound player in Chisimba that will play either HTML5 audio or via Flash depending on the browser:
private function embedAudio($url)
{
if ($this->isFirefox()) {
// Do a Flash player
$objSoundPlayerBuilder = $this->newObject('buildsoundplayer', 'files');
$objSoundPlayerBuilder->setSoundFile($url);
return $objSoundPlayerBuilder->show();
} else {
// Do an HTML5 player
$doc = new DOMDocument('UTF-8');
$snd = $doc->createElement('audio');
$snd->setAttribute('controls', 'controls');
$file = $doc->createElement('source');
$file->setAttribute('src', $url);
$file->setAttribute('type', "audio/mpeg");
$snd->appendChild($file);
$doc->appendChild($snd);
return $doc->saveHTML();
}
}
Chisimba is so easy to work with for this kind of thing!