On Friday the 10th of February, myself and my compadre Cian Ruane took part in the HackYourWayDay hackathon in the NDRC that we had seen publicised around the place the previous week. The hackathon was themed around Eircodes, which are Ireland's new controversial postcodes. I'm interested in data, mapping, and hacking, so I was pretty interested. Unfortunately, I was late to the safari because I had a hospital appointment that morning, but I was there for the fun bits: pitching, building, and presenting our product, Coireacht. Naming things is said to be one of the most difficult parts of tech, but I have a cheat: use the Irish word for whatever I'm looking at. Coireacht is the Irish for crime.
Above is a tweet with a nice pic of, from left to right: Cian, myself, and blurry Adrian, the CTO at Opening.io. Opening was the company where I was lucky enough to have my first job, enter my love affair with machine learning, and even have drinks on a boat with; it also now happens to be based in the building the hackathon was hosted in. On the board in the background of the picture you can also squint at our tight time limits for the hacking.
In advance of the hackathon, some links to location-related datasets were shared with us. It rubbed me the wrong way how many of the datasets were for the chrome and crime of Dublin City, and how few were countrywide. At the hackathon, the vast majority of people in the room were Dubs or near-Dubs. Three quarters of the people in this country are not Dubliners, and I wanted to put together a project that helped them. My teammate Cian is also a countryboi, and either had the same thoughts, or just didn't mind abiding me.
The idea we came up with was a tool to help students from the countryside, or people about to immigrate, find out more about potential accommodation when they are moving for college or work. Before university when I was seeking accommodation in Dublin, came across a potential place, and mentioned the price and address to my mother (who lived in Dublin's fine city once upon a pale moon), she would share a lot of unsolicited information on whether the price was fair, or if it was a dangerous area. Had she not known these things, I would have been clueless. Her information was also decades old. A tool to accessibly provide modern information like this may help someone. We had pinpointed our problem; following is our enthralling technical solution.
Here is what we set out to do:
- Take an eircode from the user in a nice and friendly way
- Find crime data for the location
- Return a rating for how dangerous it is
- Find recent rental prices for nearby properties
- Tell the user how much to expect to pay in rent here
We achieved as far as #3 above, tickling the edge of #4, over the three-ish hours of the hackathon. We opted to whip up a webapp of sorts, that you can try out live right here, and eyeball our code here.
You can git-blame the repo to see who did what between me and my navigator Messr Ruane. I have a fair amount of experience with Flask; it is perhaps my favourite library or framework of all time, making sometimes messy webdev as pleasant as a trip to the opera. Cian is not so familiar with Flask (or the web, the old fart), so I threw together a barebones webapp, and shipped it off to him. He bound together APIs to turn an eircode into an address, and from there into a latitude and longitude.
We found an open dataset of the crimes within the remit of each Garda station in the country over the past few years (although I am still seeking the exact licence for this data). It was laid out like this:
|ID||Garda Station||Division||X||Y||Number of Occurances of Crime P in Year Q|
|20441||Abbeyfeale||Limerick Division||112219||126928||insert grizzly crime number here|
I am not sure what the context of the
Y was - perhaps an offset to the numbers mentioned for the range in the metadata of this dataset. Instead of fiddling with offsets, I doodled a script that took the name of each Garda station (eg.
Abbeyfeale), cheekily appended
Garda Station, Ireland to it (to make
Abbeyfeale Garda Station, Ireland, and queried Google maps for an exact location, then output all this in a CSV. It worked for all but 8 or 9 stations, which we discarded in the name of time constraints.
We only took the numbers of violent crimes and thefts into account; we don't think that tax fraud makes an area more dangerous. In fact, tax fraud might be negatively correlated with an area's safety...
Cian wrote a wee bitta code that took the coordinates of a location, and the coordinates of each Garda station, found the nearest one, and used it to figure out a crime rating for the property. We pretended the world was flat and used the latitude and longitude as points on a 2D plane to calculate distances, again because of time constraints.
A screenshot of the homepage, which is just a light description of the tool, a box for you to type an eircode into, and a big "go" button.
I wrote a frontend! I used Tachyons, a CSS toolkit I've used and enjoyed before that makes it a bit less painful to get things looking good (on both desktop and mobile!), along with Jinja2 templating to put together the pages in a nice, modular way. I used the vital tool of StackOverflow to help me put a map onto the page, in order to visualise where the Eircode was in the real world. I also used some messy Jinja-ing and CSS-ing to fill 5 stars based on the crime rating of the area, and highlight it red for bad, orange for okay, and green for good.
A screenshot of the results page for an eircode, with the address, coordinates of it, a score out of 5 stars for how safe the area is, and an OpenStreetMap embed showing where the place is.
Myself and Cian presented our project to a panel of Dubliners (who didn't relate to our original problem perhaps!). We didn't win any of the 3 prizes, so no 5000€ for us. I was very proud of what we managed to put together however. We were one of only 2 teams that had a live interactive demo, I think, and the only team to have a tool working on mobile. After all of the prizegiving, one of the judges came over to us and told us we were *this close* (pinches fingers) to the top dogs. Throughout the presentations, they pushed the point of how close the competition was. I think they always do that, but it felt nice to know we were maybe almost in the money.
A tweet with a picture of us looking for help with some data. I don't remember it being taken, but I'm happy enough because for some reason I look okay in it. I am a little suspicious.
I had a lot of fun on the day, and I think Cian did too - maybe he'll be kind enough to write up how it felt from his point de vue. If we get the time and conjure up some motivation out of our rear ends, Cian and I may augment the project a little bit at some stage. I wasn't expecting the free pizza and beer that appeared in the evening of the event, it was a nice way to finish! I'll ignore the fact that I followed it with more drinks.
This was my first time playing with government data, and it was fun - I look forward to doing it again in the future. I hope someone finds some use in our tool. If you're interested, you can play with it here!
Bonus points to me for peppering this piece with the names of 8 different web browsers. Try and catch them all!