So, you wanna get some data

Well, I’ve gone ahead and made all of the data that powers this site relatively simple to get in a few different ways.

Daily Dump

Firstly, there’s the daily firehose view. Which works like this:

http://crime.static-eric.com/data/2007/10/24.json

That gets you the dump of everything for October 24, 2007. It looks like this:

You end up with three top level objects: weather, meta and geojson. The weather object, predictably, contains info about the temperature that was observed on a given day. The meta object contains summary info about the number of each type of crime reported on that day, as well as a grand total. The geojson object is a FeatureCollection containing points for each crime reported on the given day. Within the FeatureCollection are features which contain the actual latitude/longitude where the crime reportedly happened and more detail about the crime itself (inside the properties object).


Weather

If you’re interested in taking a look at the summarized data that was used to do this visualization, you can get that by stucturing your request this way:

http://crime.static-eric.com/data/weather/arson.json

This will get you a total of all arsons reported between January 1, 2001 and a week ago grouped by the high temperature of the day on which they were reported. That response should look something like this:

Each object inside the data key gives you the total number of days that were observed at the a given temperature and an average number of that type of crime that was reported on days that were observed at that temperature.

The valid categories of crime that can be fetched this way are:

  • arson
  • assault
  • battery
  • burglary
  • crim_sexual_assault
  • criminal_damage
  • criminal_trespass
  • deceptive_practice
  • domestic_violence
  • gambling
  • homicide
  • interfere_with_public_officer
  • interference_with_public_officer
  • intimidation
  • kidnapping
  • liquor_law_violation
  • narcotics
  • non_criminal
  • non_criminal_subject_specified
  • obscenity
  • offense_involving_children
  • offenses_involving_children
  • other_offenses
  • prostitution
  • public_indecency
  • public_peace_violation
  • ritualism
  • robbery
  • sex_offense
  • stalking
  • theft
  • weapons_violation

So, just swapping out arson.json for any one of those categories “.json” will get you what your after. The other key that will work is total which will give you the averages for the number of all crimes reported on days at a given temperature.


CSV dumps

So, you’re old school, eh? Well, I think I got you at least partially covered. There are CSV dumps available by year for for the reported crimes vs. temperature data. However, instead of being grouped by temperature, there is a row for each day that gives you the date, the observed temperature, the total number of crimes reported that day, and then a category by category count. You can get those like this:

http://crime.static-eric.com/data/weather/2010.csv

That will get you a CSV dump containing all the info for 2010. There is also a full dump that can be fetched by swapping out 2010.csv with full_dump.csv in the example above.


More?

Thanks to some generous help with infrastructure from the Smart Chicago Collaborative I’m working on getting a REST endpoint together for the bulk of the crime and weather data (and whatever else I end up with). So, watch this space.