Project

chicrime

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Chicrime is a ruby gem that wraps the soda-ruby library with easy to use methods and a DSL. The purpose of Chicrime is to enable users to easily access Chicago's crime data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
>= 0.8.2, ~> 0.8
>= 2.0.0, ~> 2.0
>= 2.13.0, ~> 2.13
>= 4.6.0, ~> 4.6
>= 0.10.1, ~> 0.10
~> 10.0
>= 3.3.0, ~> 3.3
>= 1.2.0, ~> 1.2

Runtime

~> 0.2.13
 Project Readme

Chicrime

Coverage Status Build Status Gem Version

Chicrime is a ruby gem that wraps the soda-ruby library with easy to use methods. The purpose of Chicrime is to enable users to easily access Chicago's crime data.

Installation

Add this line to your application's Gemfile:

gem 'chicrime'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chicrime

Usage

chicrime = Chicrime::Dataset.new(<OPTIONAL API TOKEN>)

# Add queries with where, select, query, and order

# where
chicrime.where("year = '2014'")

# select
chicrime.select('date', 'arrest', 'location')

# limit
chicrime.limit(5)

# order
chicrime.order("id", :DESC)

# search
chicrime.search("Kingsbury St")

# Chain queries
chicrime.where("year = '2014'", "community_area = '1'").limit(100)
chicrime.where("within_circle(location, 41.8719708, -87.6492965, 500)").order("date")

# Get results
chicrime.where("year = '2014'", "community_area = '1'").order("date").results

# New semi-working DSL, use at your own risk
# where is the only parameter with a block implemented
# available operators include: equals, less_than, greater_than, not_equal
chicrime.query do
  where do
    year greater_than 2013
    arrest equals false
    ward not_equal 15
  end

  search "Kingsbury St"

  order :id, :desc
  limit 15
  select :arrest, :date, :location
end

Resources

API Documentation

SoQL Queries

Location functions

Development

TODO

  • Implement group parameter
  • Documentation
  • Hash support for method queries

Contributing

  1. Fork it ( https://github.com/[my-github-username]/chicrime/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request