Kasabi open government hackday

Last week I was one of about 20 people at the Kasabi Open Government Hackday.

For me it was a chance to get started with Open Data and SPARQL, and to spend time with some very smart developers who know their stuff in this area already.

Want to get started with Kasabi? Sign up here: http://beta.kasabi.com/

On the hackday, I started with the NHS Performance Data. It was fairly easy to put together an API to create KML output.

See the results here on Google Maps: http://maps.google.com/?q=http%3A%2F%2Fapi.kasabi.com%2Fdataset%2Fnhs-performance-data%2Fapis%2F36z%3Fapikey%3Da36e7a3bcdd9fcebe0b32b0cef1a146912df1266%26output%3Dkml.

The NHS data has postcodes for locations such as gp practices, dentists, and so on. In the SPARQL query we link the data to the Ordance Survey dataset, which gives us latitude and longitude for each postcode:

PREFIX nhs: <http://data.kasabi.com/dataset/nhs-organization/def/>
 PREFIX org: <http://www.w3.org/ns/org#>
 PREFIX os: <http://data.ordnancesurvey.co.uk/ontology/postcode/>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
 PREFIX spatialrelations: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/>
 PREFIX admingeo: <http://data.ordnancesurvey.co.uk/ontology/admingeo/>
SELECT ?org ?description ?name ?postcode ?lat ?long WHERE {
 #?org a nhs:GeneralPractice;
 ?org a nhs:DentalPractice;
 org:identifier ?code;
 rdfs:label ?name;
 org:hasSite ?description.
?site os:postcode ?postcode.
?postcode geo:lat ?lat;
 geo:long ?long;
 os:district ?district.
?district spatialrelations:within ?region.
?region rdfs:label ?regionName;
 a admingeo:EuropeanRegion.
#FILTER (?regionName = 'London')
 LIMIT 100

This needs more work: the name and description fields are not very descriptive.

To put the address of the dental surgery into the bubble on Google Maps, I need to dive into the ?site where I can get the vcard. You can see the structure of the data here: http://data.kasabi.com/dataset/nhs-organization/sites/V00002/RH117RZ.html

Many thanks to Leigh for pointing me in the right direction for the KML output (in the API Transforms section, all you need to do is point at https://github.com/kasabi/kasabi-xsl/raw/master/src/kml/to-basic-placemarks.xsl – this xsl stylesheet creates the KML output for you).

Also, thanks to Dave for your help with the SPARQL query.

Feargal put together some very useful notes on getting started with SPARQL: http://megov.wordpress.com/2011/07/27/semantic-hackday-notes/

And Darren gave a very interesting demo showing how to consume Kasabi data using a set of Drupal modules: http://drupal.org/project/sparql, http://drupal.org/project/rdfx, http://drupal.org/project/sparql_views.

Posted in kasabi
One comment on “Kasabi open government hackday
  1. Lewis John McGibbney says:

    Hi Michael,

    Nice to see that as a self confessed newcomer to SPARQL you were able to display perfectly the usefulness of open data under the Kasabi framework and develop a pretty impressive example. With some tweaking I’m sure you would be able to integrate more detailed metrics into the bubbles however the body of work has definitely been completed.

    Nice to meet with you at the Hackday and thanks for the blog post.

    Kind Regards


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: