HamOntFire β Visualizing @HFS_Incidents
Awhile back, I came across the @HFS_Incidents twitter account. It broadcasts all of the calls that Hamilton Fire Services responds to.
Being an Open Data guy, I was pretty happy to see this, but I thought Twitter wasn’t the best format. If I see an event, I might have no idea where it refers to. “0 Block GERTRUDE ST” isn’t helpful unless you already know where Gertrude Street is. I also thought that this might be a good opportunity to get my hands dirty with Google Maps, Web Sockets, the Twitter API, and image generation.
The format of the tweets was pretty easy to parse, so I decided to throw together a few services and map the data out. And with that, HamOntFire was born.
At a high level, here’s what’s happening:
- SuperWebSocket is constantly polling the Twitter API for new tweets
- When new tweets are found…
- I parse the data into an object (mostly to get the address into a Google-appropriate format)
- I geocode the location using Google’s Geocoding API
- I store the data in RavenDB
- The event is pushed to the browser
- The browser displays the tweets using Google Maps.
This was all fairly easy, with one exception: Both RavenDB and SuperWebSocket are dependent on Json.Net (Newtonsoft’s fantastic Json parser which has become the de facto standard), but each required very different versions (=4.0.8 and & >4.5.4, respectively). After some research, I discovered that this was easy to take care of in .Net, thanks to binding redirects:
</pre> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-18.104.22.168" newVersion="22.214.171.124" /> </dependentAssembly> <pre>
This says “For any versions of Newtonsoft.Json between v0.0.0.0 and 126.96.36.199, just use version 188.8.131.52.”
Once that was taken care of, everything else was a piece of cake.
Post Script: I’m also trying to come up with other statistics to display on the Stats page. If you can think of any, please let me know!