This is the code for my "Secrets of Fire Truck Society" talk for the Ignite at Strata 2013. Really, it's not very interesting, but my slides say I put it here, so I put it here. I doubt you want to use it; however, you might find it interesting to look at, discover mistakes in, and so on.
ruby directory is the script to scrape the Seattle Real-Time 911 site. It's written in Ruby because I cribbed it from my Hacker News scraping code, which was in Ruby, because I don't know why. If I were writing it from scratch it would be in Python.
It relies on MongoMapper and it sticks the data in MongoDB on localhost. Really, there's no reason why you should ever need to use this scraper. If you want the data that bad, you can ask me or write your own.
THAT SAID, if despite my warnings you really want to use it, just do
ruby scrape_fire.rb 2011-01-01
which will scrape from 2011-01-01 until today.
python directory is the code I used for my analysis. None of these files is particularly command-line-able, I mostly copied and pasted from them into iPython.
loads data from the database and defines a few helper functions.
geocodes all the locations in the data and then sticks that data in Mongo too. I ran it against a DSTK instance running virtually on my laptop, which took about 24 hours to geocode 100K locations. If you have a better (free) geocoding solution, I'd like to hear it!
creates plots from the geocoded data. Relies on Basemap, which in turn relies on Matplotlib, which in turn relies on something else, and so on. I hardcoded the window around Seattle, although that's easy enough to change if you want to plot points elsewhere.
does two different things. First, it produces GEXF files that are suitable for loading into Gephi and making those network diagrams that everyone hates. It also produces graphs in NetworkX format, to which you can then apply all sorts of graph algorithms.
Like I mentioned before, the data is too big to post here, but if you want it that badly, I'll find a way to get it to you.
Can be found here.
I'll put a link here too, if anyone takes a video of it.