At the weekend I attended the Homeless Hack day organised by the Government Digital Service.


My team won. There is a video of my presentation, and another of the judges’ announcement, towards the end of the article.

Why I attended

Our OpenDataCommunities project for the DCLG contains a selection of homelessness and housing datasets, as well as various other useful supporting useful supporting datasets, so my intention was to attend with the idea of supporting people in accessing that data, if they wanted it for their project.

The Challenge

On the day itself, the first hour or so was devoted to talks by various stakeholders and supporters of the event, before people organically grouped together to work on ideas and apps that interested them. Full details of the teams and their projects can be found on the Hack Day website.

One of the challenges (as highlighted by Lisa Reed from Homeless link during the briefing) was that members of the public who see people on the streets sleeping rough, often want to help, and feel bad walking past but don’t know what they can do or who to contact about it.

Forming a team

Various people, including me, had the idea of building a mobile website targeted at concerned members of the public, so that they could ‘spot’ a homeless person, alert the appropriate authorities, and get information about the outreach services in the area. A fairly large team of designers, developers and copywriters quickly formed around this idea, but it soon became apparent that the “outreach” data provided by Homeless Link for the hack day was not available in an open or accessible form. And without this, building such an application would not be possible.

Our idea

So, I and two others (Shaun Forde from Homeless Link, and Dan Blundell, a software developer from Northampton) separated from the larger group to concentrate on opening up access to the Homeless Link data. We would work on an API that the mobile website could call on (as well as any other applications who needed access to this data).

The data from Homeless Link was available as a set of CSV files, each with somewhat ambiguous column names. This format makes the data hard to query, share and generate reports on. Homeless Link and other organisations that use this data could get and add value to this data if it was easier to process.

If we’d have had a week (or more!) rather than a few hours, the ideal solution would have been to publish the data from the CSV files as 5-star Linked Open Data, with a range of APIs (including SPARQL, Linked Data and bespoke APIs) so that developers could get access to the data in a way that suited their preferences and skillset. This would allow user-facing applications and visualisations to be built to serve a variety of needs.

What we actually did on the day involved some manual manipulation of the CSV files, before importing them in a Mongo database. Then, using Rails, we knocked up a quick JSON API which returned a range of outreach services available for a local authority based on a latitude and longitude. To help with this, we used a combination Ordnance Survey, Office of National Statistics and DCLG data from OpenDataCommunities.


The API that we came up with had a single route which could be called like this.

GET http://homelesslink.local/local_authorities.json?lat=51.5&lon=0.14

This simple design was driven partially by the needs of the original team building the mobile website, with whom we worked closely throughout the day.

The response to a request like the one above looks like this:

  local_authority: “Bexley”,
  services: [
     service_type: “advice”,
     name: “Age UK”,
     address: “...”,
     tel: “...”,
     website: “...”,
     email: “...”,
     service_offered: “Range of services for older people...”

The API works by running a SPARQL request to get the local authority in which the lat/long resides, and then does a look-up in our MongoDB for the services provided by that local authority, before serialising the results into a custom JSON object.


PREFIX localgov: <>
PREFIX rdfs:  <>
PREFIX geo: <>
PREFIX osadmingeo: <>
PREFIX owl: <>

SELECT ?authority ?os ?lat ?lon ?pythag ?ons ?censusCode ?localAuthLabel where {
  ?authority localgov:governs ?os .
  ?authority rdfs:label ?localAuthLabel .
  ?os geo:lat ?lat .
  ?os geo:long ?lon .
  ?authority osadmingeo:hasCensusCode ?censusCode .
  ?authority owl:sameAs ?ons .
  BIND ( (?lat - (%{lat})) AS ?latdist) .
  BIND ( (?lon - (%{lon})) AS ?londist) .
  BIND ( ((?latdist*?latdist) + (?londist*?londist)) AS ?pythag ) .
ORDER BY ASC(?pythag)

You can try this SPARQL against the OpenDataCommunities endpoint by clicking here

You might notice that the SPARQL above just finds the local authority with the nearest centroid, which obviously may not actually be the local authority in which the latitude/longitude resides. This is because the local authority boundary information is not available on OpenDataCommunities as RDF, but there are plans to release an API which allows this lookup in the near future.

Our code from the day is available on github, but there are licensing issues which would need to be resolved (as well as some more work on the API!) before we can make the API public.


Here’s a video of me presenting our work, at the end of the hack day.

(videos of the other teams’ presentations are available too).


Although our application wasn’t the sexiest (we didn’t have any fancy graphics: the only outputs were JSON objects!), the judges said that it was:

the most meaningful – the open API that was developed […] that’s critical, because what he have got going on at the moment is many organisations doing wonderful things, but we don’t know where they all are – or have that aggregated list. If we look at the other projects, for example the reporting service, or Life Map – those are inherently tied to lets match the need with whoever can service the need; and this serves as a foundation layer to that service delivery.

… awarding us First Prize!

Here’s a video of the judges’ announcement:

Next Steps

Shaun, Dan and I plan to do some more work on the API, and work towards opening up the data so that Homeless Link and other organisations can make the most of the information they hold.

Keep up to date with our news by signing up to our newsletter.
Thanks for reading all the way to the end!
We'd love it if you shared this article.