One of the things that we’re doing with data.parliament.uk is creating some small demonstrator applications to show you how you can make use of our data feeds. These applications are open source, MIT licensed, and available on GitHub.
The first such application that we have developed is one that monitors Research Briefings and announces them on Twitter. It is written in .net and runs as a console application, so it can be set up as a scheduled task. We have configured it to run once every five minutes and to tweet to @ddpdemo. This is a general purpose account intended primarily to demonstrate all the sample apps that we develop, so you may in due course see it tweeting about other things than just Briefing Papers.
The application itself is fairly simple. It monitors the endpoint at http://lda.data.parliament.uk/briefingpapers.json, then creates a new Tweet for every new briefing paper that it finds. To make sure that it doesn’t tweet any of them twice, it keeps a record of the ones that it has tweeted in a text file. As well as JSON format, the data source is also available in various other formats, including CSV, RDF or XML.
In terms of technology, we’ve used the following open source libraries:
- Json.NET for parsing JSON
- Linq to Twitter to connect to the Twitter API
- NUnit and Moq for unit testing.
For various reasons, the application is actually running as a cron job on an Ubuntu server under Mono, hosted on Microsoft Azure.