API 2.0 Guide

Wilberto Morales edited this page May 20, 2014 · 13 revisions

UNDERDEVELOPMENT - Reflects intended functionality and the current set of implemented APIs, subject to changes.

The Cook County Jail 2.0 API provides all of the same basic information as the 1.0 version, in a slightly different format, and provides additional functionality, in particular:

  • summarization of values
  • better normalization of data storage

Note as well the default format of information being returned by this API is JSON.

The Entry points

Version info

This entry point provides the current version of the interface being used or the complete history of versions of the API. Primary usage is for error reporting. If problems are encountered using some of the other API entry points, the call this entry point and include the returned version info when reporting the problem.

http://cookcountyjail.recoveredfactory.net/api/2.0/version

Here is what was returned when it was called on Sunday October 19th, 2013:

{
   Version: "2.0-dev",
   Build: "64fd981909",
   Person: 'email@adress',
   Deployed: "2013-10-19 15:29:24.180510"
}

To access the complete version history, add '?all=1' to the end of the API URL like this:

http://cookcountyjail.recoveredfactory.net/api/2.0/version?all=1

It will return something like this:

[
   {
      Version: "2.0-dev",
      Build: "64fd981909",
      Person: 'email@adress',
      Deployed: "2013-10-19 15:29:24.180510"
   },
   {
      Version: "2.0-dev",
      Build: "cf97ff94eb",
      Person: 'email@adress',
      Deployed: "2013-10-16 22:21:45.839971"
   },
...
   {
      Version: "2.0-dev",
      Build: "c8ae7a12f3",
      Person: 'email@adress',
      Deployed: "2013-10-15 21:59:09.604927"
   }
]

Note that a large number of the entries where removed so as to keep the displayed text small.

Summarized Daily Population

Each day somewhere between 150 to 280 people enter the Cook County Jail system. This entry point provides a summarized view on a daily basis of the total population and the changes in the population, both people entering the system and those leaving it. The information is broken down by gender and race.

The summarized information spans the period from July 22nd, 2013 and to yesterday. The July day was chosen as this is when the original 1.0 API data was being reliably captured. Prior to this date there were problems with the data capture.

http://cookcountyjail.recoveredfactory.net/api/2.0/daily_population

The output for July 22, 2013 looks like this:

[
    {
        date: "2013-07-22",          # the date of the entry
        booked: "177",               # the total number of people booked that day
        females_booked: "18",        # the total number of females booked that day
        females_booked_as: "0",      # the total number of Asian females booked that day
        females_booked_bk: "16",     # the total number of Black females booked that day
        females_booked_in: "0",      # the total number of Indian females booked that day
        females_booked_lt: "1",      # the total number of Latino females booked that day
        females_booked_un: "0",      # the total number of Unknown Race females booked that day
        females_booked_wh: "1",      # the total number of White females booked that day
        females_left: "16",          # the total number of females who left the jail system that day
        females_left_as: "0",        # the total number of Asian females who left the jail system that day
        females_left_bk: "11",       # the total number of Black females who left the jail system that day
        females_left_in: "0",        # the total number of Indian females who left the jail system that day
        females_left_lt: "2",        # the total number of Latino females who left the jail system that day
        females_left_un: "0",        # the total number of Unknown race females who left the jail system that day
        females_left_wh: "3",         # the total number of White females who left the jail system that day
        females_population: "1092",   # the total number of females in the system that day
        females_population_as: "5",   # the total number of Asian females in the jail system that day
        females_population_bk: "775", # the total number of Black females in the jail system that day
        females_population_in: "3",   # the total number of Indian females in the jail system that day
        females_population_lt: "107", # the total number of Latino females in the jail system that day
        females_population_un: "0",   # the total number of Unknown Race females in the jail system that day
        females_population_wh: "202", # the total number of White females in the jail system that day
        left: "187"                   # the total number of people who left the jail system that day
        males_booked: "159",          # the total number of males booked that day
        males_booked_as: "1",         # the total number of Asian males booked that day
        males_booked_bk: "98",        # the total number of Black males booked that day
        males_booked_in: "0",         # the total number of Indian males booked that day
        males_booked_lt: "30",        # the total number of Latino males booked that day
        males_booked_un: "0",         # the total number of Unknown Race males booked that day
        males_booked_wh: "30",        # the total number of White males booked that day
        males_left: "171",            # the total number of males who left the jail system that day
        males_left_as: "4",           # the total number of Asian males who left the jail system that day
        males_left_bk: "119",         # the total number of Black males who left the jail system that day
        males_left_in: "0",           # the total number of Indian males who left the jail system that day
        males_left_lt: "34",          # the total number of Latino males who left the jail system that day
        males_left_un: "0",           # the total number of Unknown Race males who left the jail system that day
        males_left_wh: "14",          # the total number of White males who left the jail system that day
        males_population: "12012",    # the total number of males in the system that day
        males_population_as: "73",    # the total number of Asian males in the system that day
        males_population_bk: "8912",  # the total number of Black males in the system that day
        males_population_in: "7",     # the total number of Indian males in the system that day
        males_population_lt: "1951",  # the total number of Latino males in the system that day
        males_population_un: "0",     # the total number of Unknown race males in the system that day
        males_population_wh: "1069",  # the total number of White males in the system that day
        population: "13104",          # the total number of people in the system that day
    },
...
]

The population fields include both the number of people booked that day and the number of people who left that day. One way to think of it is that they are the population at the end of the day and not the beginning or in the middle.

Note that the output is an array of hash values, in chronological order. If you wanted to plot the daily population all you need to do is for each entry in the array, get the date from the 'date' field and the population from the 'population' field. If you wanted to also plot the number of females and males, you just need to to get the values from the fields, 'females_population' and 'males_population' respectively. To plot different other values just extract the information from the appropriate fields.

Starting Population

People where in Cook County Jail system prior to the date that summarized daily population is being reported on. This method tells you that information.

http://cookcountyjail.recoveredfactory.net/api/2.0/starting_population

The output for July 21, 2013, the day before Daily Population summaries looks like this:

[
    {
        date: "2013-07-22",          # the date of the entry
        booked: "0",                 # the total number of people booked that day
        females_booked: "0",         # the total number of females booked that day
        females_booked_as: "0",      # the total number of Asian females booked that day
        females_booked_bk: "0",      # the total number of Black females booked that day
        females_booked_in: "0",      # the total number of Indian females booked that day
        females_booked_lt: "0",      # the total number of Latino females booked that day
        females_booked_un: "0",      # the total number of Unknown Race females booked that day
        females_booked_wh: "0",      # the total number of White females booked that day
        females_left: "0",           # the total number of females who left the jail system that day
        females_left_as: "0",        # the total number of Asian females who left the jail system that day
        females_left_bk: "0",        # the total number of Black females who left the jail system that day
        females_left_in: "0",        # the total number of Indian females who left the jail system that day
        females_left_lt: "0",        # the total number of Latino females who left the jail system that day
        females_left_un: "0",        # the total number of Unknown race females who left the jail system that day
        females_left_wh: "0",         # the total number of White females who left the jail system that day
        females_population: "1090",   # the total number of females in the system that day
        females_population_as: "5",   # the total number of Asian females in the jail system that day
        females_population_bk: "770", # the total number of Black females in the jail system that day
        females_population_in: "3",   # the total number of Indian females in the jail system that day
        females_population_lt: "108", # the total number of Latino females in the jail system that day
        females_population_un: "0",   # the total number of Unknown Race females in the jail system that day
        females_population_wh: "204", # the total number of White females in the jail system that day
        left: "0"                     # the total number of people who left the jail system that day
        males_booked: "0",            # the total number of males booked that day
        males_booked_as: "0",         # the total number of Asian males booked that day
        males_booked_bk: "0",         # the total number of Black males booked that day
        males_booked_in: "0",         # the total number of Indian males booked that day
        males_booked_lt: "0",         # the total number of Latino males booked that day
        males_booked_un: "0",         # the total number of Unknown Race males booked that day
        males_booked_wh: "0",         # the total number of White males booked that day
        males_left: "0",              # the total number of males who left the jail system that day
        males_left_as: "0",           # the total number of Asian males who left the jail system that day
        males_left_bk: "0",           # the total number of Black males who left the jail system that day
        males_left_in: "0",           # the total number of Indian males who left the jail system that day
        males_left_lt: "0",           # the total number of Latino males who left the jail system that day
        males_left_un: "0",           # the total number of Unknown Race males who left the jail system that day
        males_left_wh: "0",           # the total number of White males who left the jail system that day
        males_population: "12024",    # the total number of males in the system that day
        males_population_as: "76",    # the total number of Asian males in the system that day
        males_population_bk: "8933",  # the total number of Black males in the system that day
        males_population_in: "7",     # the total number of Indian males in the system that day
        males_population_lt: "1955",  # the total number of Latino males in the system that day
        males_population_un: "0",     # the total number of Unknown race males in the system that day
        males_population_wh: "1053",  # the total number of White males in the system that day
        population: "13114",          # the total number of people in the system that day
    }
]

This contains the same number of fields as an array entry returned by Daily Population API method. The booked and left fields are all set to zero.

Base Resources

The base resources use flask-restless to provide a unifying interface. Learning the format of querying data can be a little taunting at first, but once you have the hang of it, it's easy. You will be able to use the same format across the /person, /charge_description, statute, housing, court_building, court_room routes. These use a JSON parameter that control what the API returns. Check out restless documentation.

Try it against our API! Note that in their tutorial they just happened to have an API to a person model. It just happened to be named the same and has nothing to do with our own person.

If you are wondering, court rooms have a relationships to court buildings.

The rest of the base models are independent of each other. See our information model if you want an overview of what these models look like. If you're more technical you can also checkout the ccj/models/models.py file.

The JSON format makes it really easy to make requests with Javascript and Python. Let's try some simple queries.


import requests, json

URL = 'http://localhost:5000/%s'
PERSON = URL % ('person')


def ccj_client(url, filters=None, disjunction=False,
               limit=100, offset=0, order_by=None, single=False, page=1):

    """
    Makes an http request to our CCJ
    project with the right headers and
    parameter format.


    """

    if order_by is None: order_by = []
    if filters is None: filters = []

    params = dict(filters=filters,
                  disjunction=disjunction,
                  limit=limit,
                  offset=offset,
                  order_by=order_by,
                  single=single)

    r = requests.get(url, params=dict(q=json.dumps(params), page=page),
                             headers={'Content-Type': 'application/json'})


    return r.json()


if __name__ == '__main__':
    males = ccj_client(PERSON, filters=[{"name": "gender", "op": "==", "val": "M"}], limit=10, page=1)
    print(males)
    males = ccj_client(PERSON, filters=[{"name": "gender", "op": "==", "val": "M"}], limit=10, page=2)
    print(males)

All the fancy looking parameters in this request end up looking like this:

{'single': False, 'order_by': [], 'filters': [{'name': 'gender', 'val': 'M', 'op': '=='}], 'offset': 0, 'limit': 10, 'disjunction': False}

The raw request would be:

http://localhost:5000/person?q=%7B%22single%22%3A+false%2C+%22order_by%22%3A+%5B%5D%2C+%22filters%22%3A+%5B%7B%22name%22%3A+%22gender%22%2C+%22val%22%3A+%22M%22%2C+%22op%22%3A+%22%3D%3D%22%7D%5D%2C+%22offset%22%3A+0%2C+%22limit%22%3A+10%2C+%22disjunction%22%3A+false%7D

Besides all the encoding stuff, we hope you see how it works. The q parameter holds a object with the filters list, order_by list, offset integer, limit integer, single boolean, and disjuction boolean keys. We are been over verbose. None of these have to be specified, we are doing so to show what kind of stuff you can do. In addition there's another parameter page used to walk the results.

Here we see what data type is in each parameter.

filters is a list of objects that follows these formats: {"name": <fieldname>, "op": <operatorname>, "val": <argument>}, {"name": <fieldname>, "op": <operatorname>, "field": <fieldname>} to target a model's own fields. The can be a relation in the <relationname>__<fieldname> format.

The op values are one of:

* ==, eq, equals, equals_to
* !=, neq, does_not_equal, not_equal_to
* >, gt, <, lt
* >=, ge, gte, geq, <=, le, lte, leq
* in, not_in
* is_null, is_not_null
* like
* has
* any

The order_by attribute is also a list with a format:

{"field": <fieldname>, "direction": <directionname>}

where directionname is either asc(ascending) or desc(descending).

single and disjunction are both booleans (true or false in Javascript). In Python, json.dumps takes care of turning True into true and False into false.

If single is true then the API will return the first record from your query. By default this is false. If disjunction is true, the response will include all instances of the database that match any of the filters. If it is false the response will include all instances of the database that match all of the filters. By default this is false.

Limit and offset are unsigned integers(positive numbers).

The query above gave us the first 20 people who are males:


{u'total_pages': 4618, u'objects': [{u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'1276ab77b18f54a2150a9418ae890a90acd7c3e1e217b6b5e7cc30c5f16c9779', u'id': 1, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LT', u'hash': u'd60d5a014eb1121d05753c7e8c9436d47e5827a824d76cbc029974e056621893', u'id': 2, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'5b582a97e628a4e33d4beb582d33b3dafe3f5a1c96859b6d5b8610803ca29dc5', u'id': 3, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'WH', u'hash': u'f90ed506b10ca0344677cf018cb0c6118971b7b4f27c1fe0c2e62396594292cd', u'id': 4, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'9cb52bd2dfb361f2df84d02d8275aed98af3ac7556af281d45c64b3246c93805', u'id': 5, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LT', u'hash': u'450770952c2478c3ea1eba81c6b0840f77cfddba6329e07ffb1dcddf3a5c7ccc', u'id': 6, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'WH', u'hash': u'0f76ef6da6941d794b6b1bc962889cd59b070ca06da1027e18c4cd1f4d583d3e', u'id': 7, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LT', u'hash': u'4be00427c8d19caede04d481116f02d8467e4f5cd9894eaee877a02c1395fec8', u'id': 8, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'WH', u'hash': u'4d4f8f38794125764f36cb0e550eb030a91dae7d14763291007919f8385afc00', u'id': 9, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LT', u'hash': u'6f0e9430283a8bc12ba4a530034370cef018481e087557576fcd7d9f79403a65', u'id': 10, u'gender': u'M'}], u'num_results': 46174, u'page': 1}
{u'total_pages': 4618, u'objects': [{u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'f65f4f175cbad7e69b034e123c5ca23668a53d4d9bd9eb6594987c8760fb11f3', u'id': 11, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'2e52102db9e0f8b00a48e4b8d02b7acf13fe57e1664970a2d2f7ed6a167ef725', u'id': 12, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'e119b048b189a0e704591b58d7c0c2c4b7e995d20fe19fe1bffe79fcbedd0e41', u'id': 13, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'3eaf68f392379419be9f7b25fc576a38d5ad4721d39a026e5964f0dd8c090d33', u'id': 14, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'227483dabc7f52178f769703fd7757d1e2c88b435c27f9d820dc4878cd146f66', u'id': 15, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'WH', u'hash': u'832187b370711965c454cb6a76d089440e25aa51c1999f6b15ace7a4708dbd20', u'id': 16, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'WH', u'hash': u'72cf7e9dcd19c14e9fdb7733ed844f9d0ed2517c11e5b672342cd357f1eafe01', u'id': 17, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'BK', u'hash': u'7c21446f3d49ccccf6dd75f17515dcf7d3229d3a7a93e5c687d71759cd587a96', u'id': 18, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LW', u'hash': u'7b553d6ec29acb78f014e5f276d5d42110ab8a238224414eb88904ddd613b457', u'id': 19, u'gender': u'M'}, {u'date_created': u'2014-05-18', u'race': u'LT', u'hash': u'025e8b9113c8798c25d2b88d23c034707e8ea901c447675b6a89a875495508c5', u'id': 20, u'gender': u'M'}], u'num_results': 46174, u'page': 2}

Add this to the end of your script:

sexual_charges = ccj_client(CHARGES, filters=[{"name": "description", "op": "like", "val": "%SEX%"}])
print(sexual_charges)

{u'total_pages': 1, u'objects': [{u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT', u'id': 3}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:BODILY HARM', u'id': 7}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:THREAT LIFE', u'id': 26}, {u'date_created': u'2014-05-18', u'description': u'PREDATORY CRIMINAL SEXUAL ASLT', u'id': 29}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:DURING FELONY', u'id': 31}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/BODILY HARM', u'id': 32}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:WEAPON', u'id': 37}, {u'date_created': u'2014-05-18', u'description': u'PUBLIC INDECENCY/SEX', u'id': 53}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ASSAULT:FORCE', u'id': 55}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:VICTIM >60', u'id': 69}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:RETARDED VICTIM', u'id': 72}, {u'date_created': u'2014-05-18', u'description': u'PUBLIC INDECENCY/SEX CONDUCT', u'id': 84}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:HANDICAPPED', u'id': 92}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT/FIREARM', u'id': 110}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ASSAULT:CAN*T CONSENT', u'id': 118}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIMINAL SEXUAL ASSAULT/FIREARM DISCHAGE HARM', u'id': 122}, {u'date_created': u'2014-05-18', u'description': u'PREDATORY CRIM SEX ASLT/HARM', u'id': 129}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIM SEX ABUSE:VICTIM UNDER 18 W/FAMILY', u'id': 139}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ABUSE', u'id': 147}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASSAULT:ACCUSED 17 OR OVER & HOLDS TRUST', u'id': 166}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE:VICTIM UNDER 13', u'id': 177}, {u'date_created': u'2014-05-18', u'description': u'FAIL TO REGISTER AS HABITUAL CHILD SEX OFFENDER', u'id': 192}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX  AB/THREATEN LIFE', u'id': 199}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ASSAULT:VICTIM UNDER 13', u'id': 200}, {u'date_created': u'2014-05-18', u'description': u'INVOL SER/SEX ASSULT/VIOLENCE', u'id': 219}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASLT/VICTIM', u'id': 220}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ASSAULT:FAMILY MEMBER', u'id': 237}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ABUSE:FORCE', u'id': 246}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIM SEXUAL ABUSE:VICTIM HANDICAPPED', u'id': 250}, {u'date_created': u'2014-05-18', u'description': u'SEX EXPLOITATION CHILD/SEX ACT', u'id': 254}, {u'date_created': u'2014-05-18', u'description': u'VIOLATE SEX OFF REGIS 2+ ADDRESS 2+ FAIL TO RPT', u'id': 256}, {u'date_created': u'2014-05-18', u'description': u'PUBLIC INDECENCY:SEX/SEXUAL CONDUCT/OLD DEV/FONDLE', u'id': 263}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/VIC 13-16', u'id': 265}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/DURING FELONY', u'id': 299}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ASSAULT', u'id': 308}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASSAULT/FELONY', u'id': 316}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASLT/FAMILY MEMBER', u'id': 319}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE:VICTIM 13-17', u'id': 321}, {u'date_created': u'2014-05-18', u'description': u'SEX EXPLOIT CHILD', u'id': 346}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/BODILY HARM', u'id': 349}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE:9-17', u'id': 360}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE:WEAPON', u'id': 366}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASSAULT/FORCE', u'id': 368}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEXUAL ABUSE:VICT >= 13 & ACCUSED', u'id': 370}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASLT/BODILY HARM', u'id': 378}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEX ASSAULT/CONSENT', u'id': 381}, {u'date_created': u'2014-05-18', u'description': u'PRED CRIM SEX ASLT/VICTIM', u'id': 389}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEXUAL ABUSE/WEAPON', u'id': 405}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE', u'id': 424}, {u'date_created': u'2014-05-18', u'description': u'AGGRAVATED CRIMINAL SEXUAL ABUSE:BODILY HARM', u'id': 439}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/VIC 13-16', u'id': 468}, {u'date_created': u'2014-05-18', u'description': u'INDECENT SOL/PREDITORY AGG SEX/ASSAULT/ABUSE', u'id': 479}, {u'date_created': u'2014-05-18', u'description': u'CHILD SEX OFFENDERS/RESIDE 500 FT FROM SCHOOL', u'id': 487}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASSAULT/VICTIM', u'id': 502}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/WEAPON', u'id': 540}, {u'date_created': u'2014-05-18', u'description': u'CRIMINAL SEXUAL ABUSE/FORCE', u'id': 545}, {u'date_created': u'2014-05-18', u'description': u'SEX VIOL/DANGEROUS FAIL TO RPT', u'id': 549}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASSAULT/WEAPON', u'id': 592}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASSAULT/FIREARM', u'id': 632}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASLT/FAM MBR', u'id': 641}, {u'date_created': u'2014-05-18', u'description': u'SEX OFFENDER FAIL REG EMPL/2+', u'id': 642}, {u'date_created': u'2014-05-18', u'description': u'INVOL SEX SERV MINOR/FORCE', u'id': 653}, {u'date_created': u'2014-05-18', u'description': u'SEX OFFENDER REGIS/FALSE INFO', u'id': 700}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/VICTIM 60+', u'id': 709}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/VIC', u'id': 720}, {u'date_created': u'2014-05-18', u'description': u'AGG CHILD PORN/SEX ORGAN/ANUS', u'id': 728}, {u'date_created': u'2014-05-18', u'description': u'INDECENT SOL/PREDITORY/AGG SEX', u'id': 740}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/VICTIM', u'id': 750}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASLT/VICTIM 13-17', u'id': 751}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/VICTIM 60+ YRS', u'id': 762}, {u'date_created': u'2014-05-18', u'description': u'PRED CRIM SEX ASLT/BODILY HARM', u'id': 788}, {u'date_created': u'2014-05-18', u'description': u'AGG CHILD PORN/SEX PERS/ANIMAL', u'id': 841}, {u'date_created': u'2014-05-18', u'description': u'PRED CRIM SEX ASLT/VIC', u'id': 851}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/VIC 13-17', u'id': 856}, {u'date_created': u'2014-05-18', u'description': u'SEX OFFENDER FAIL REG EMPLOYER', u'id': 878}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASLT/CANT CONSENT/2ND', u'id': 879}, {u'date_created': u'2014-05-18', u'description': u"CHILD SEX OFFENDER/RESIDE 500'", u'id': 953}, {u'date_created': u'2014-05-18', u'description': u'SEX VIOL/DNGR FAIL TO RPT/2ND+', u'id': 966}, {u'date_created': u'2014-05-18', u'description': u'INDECENT SOL/CRIM SEX ASSAULT', u'id': 1018}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASSAULT/CANT CONSENT', u'id': 1084}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/VIC', u'id': 1105}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX AB/VIC 9-17/FORCE', u'id': 1106}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEXUAL ABUSE/CONSENT', u'id': 1133}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASSAULT/FAMILIES', u'id': 1135}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEXUAL ABUSE/FELONY', u'id': 1151}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ABUSE/FAMILY', u'id': 1159}, {u'date_created': u'2014-05-18', u'description': u'CRIM SEX ASLT/VICTIM 13-17/2+', u'id': 1164}, {u'date_created': u'2014-05-18', u'description': u'AGG CRIM SEX ASSAULT/RETARDED', u'id': 1184}, {u'date_created': u'2014-05-19', u'description': u'PRED CRIM SEX ASSAULT/CON SUB', u'id': 1241}, {u'date_created': u'2014-05-19', u'description': u'DRIVING/NO LIC/CANC/SEX OFFEN', u'id': 1242}, {u'date_created': u'2014-05-19', u'description': u'AGG CRIM SEX ASSAULT/VIC 60+', u'id': 1288}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX ASLT/FORCE/PREV CONV', u'id': 1289}, {u'date_created': u'2014-05-19', u'description': u'CHILD SEX OFFENDER/LOITERING', u'id': 1291}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX AB/', u'id': 1301}, {u'date_created': u'2014-05-19', u'description': u'INVOL SEX SERV MINOR', u'id': 1327}, {u'date_created': u'2014-05-19', u'description': u'AGG CRIM SEXUAL ABUSE/CON SUB', u'id': 1339}, {u'date_created': u'2014-05-19', u'description': u'PRED CRIM SEX ASLT/CON SUB', u'id': 1340}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX ASLT/SUPER VIC 13-17', u'id': 1347}, {u'date_created': u'2014-05-19', u'description': u'INDECENT SOL/AGG CRIM SEX AB', u'id': 1358}, {u'date_created': u'2014-05-19', u'description': u'PATRONIZE PROSTITUTE/SEX', u'id': 1366}, {u'date_created': u'2014-05-19', u'description': u'INVOL SEX SERV MINOR AGE 17-18', u'id': 1371}, {u'date_created': u'2014-05-19', u'description': u'SEX PRED/LOITER PUBLIC PARK', u'id': 1373}, {u'date_created': u'2014-05-19', u'description': u'PUB INDECENCY/SEX CONDUCT 3+', u'id': 1387}, {u'date_created': u'2014-05-19', u'description': u'CHILD SEX OFFENDER/PUBLIC PARK', u'id': 1423}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX ASSAULT/FORCE/2ND+', u'id': 1425}, {u'date_created': u'2014-05-19', u'description': u'CUSTODIAL SEXUAL MISCONDUCT', u'id': 1438}, {u'date_created': u'2014-05-19', u'description': u'SEX OFFENDER/FALSE INFO/2ND+', u'id': 1439}, {u'date_created': u'2014-05-19', u'description': u'CRIMINAL SEXUAL ABUSE FORCE', u'id': 1442}, {u'date_created': u'2014-05-19', u'description': u'SEX OFFENDER/FALSE INFO/2+', u'id': 1447}, {u'date_created': u'2014-05-19', u'description': u'CHILD SEX OFFENDER/LOITER PARK', u'id': 1462}, {u'date_created': u'2014-05-19', u'description': u'PUB INDECENCY/SEX CONDUCT 3RD+', u'id': 1481}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX AB/PERS', u'id': 1507}, {u'date_created': u'2014-05-19', u'description': u'CHILD SEX OFFENDER/REGIS', u'id': 1508}, {u'date_created': u'2014-05-19', u'description': u'SEX RELATIONS WITHIN FAMILIES', u'id': 1547}, {u'date_created': u'2014-05-19', u'description': u'AGG CRIM SEX ABUSE/RETARDED', u'id': 1633}, {u'date_created': u'2014-05-19', u'description': u'AGG CRIM SEX ASLT/THREAT LIFE', u'id': 1636}, {u'date_created': u'2014-05-19', u'description': u'CHILD SEX OFFENDER/SCHOOL ZONE', u'id': 1663}, {u'date_created': u'2014-05-19', u'description': u'PERMIT SEX ABUSE OF CHILD', u'id': 1667}, {u'date_created': u'2014-05-19', u'description': u'SOLICITATION OF A SEXUAL ACT', u'id': 1699}, {u'date_created': u'2014-05-19', u'description': u'AGG CRIM SEX ASLT/HANDICAPPED', u'id': 1708}, {u'date_created': u'2014-05-19', u'description': u'CRIM SEX ABUSE/FORCE/1ST', u'id': 1720}, {u'date_created': u'2014-05-19', u'description': u'SEX OFFENDER VIO NAME CHANGE', u'id': 1724}, {u'date_created': u'2014-05-19', u'description': u'SEX OFFENDER AT PUBLIC PARK', u'id': 1771}, {u'date_created': u'2014-05-19', u'description': u'SEX OFFENDER SEEK NAME CHNG/2+', u'id': 1776}], u'num_results': 124, u'page': 1}

jail_programs = ccj_client(HOUSING, filters=[{"name": "in_program", "op": "!=", "val": ""}])
print(jail_programs)
[{u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'03-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 7, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 320, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'09-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 374, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'16-BC-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 478, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'04-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 686, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-2E-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 703, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-3S-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 718, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'10-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 726, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'01-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 1349, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'17-WR-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 1656, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'11-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 1809, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'03-AX-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 2123, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'05-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 2294, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'02-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 3141, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'06-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 4026, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-3W-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 4773, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-2S-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 5242, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'17-MOMS', u'in_jail': True, u'date_created': u'2014-05-19', u'id': 5682, u'in_program': u'MOMS Program'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-3N-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 5862, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6211, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-2N-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6242, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-3E-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6243, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-EM', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6278, u'in_program': u'Electronic Monitoring'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'17-SFFP', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6279, u'in_program': u'Sherrif Female Furlough Program'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-US', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6347, u'in_program': u'Other County'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'08-2W-DR', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6374, u'in_program': u'Day Release'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-LV', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6408, u'in_program': u'Other County'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-KK', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6439, u'in_program': u'Other County'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'17-SFFPAW', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6441, u'in_program': u'Sherrif Female Furlough Program, AWOL'}, {u'division': None, u'sub_division_location': None, u'sub_division': None, u'location': u'15-EMAW', u'in_jail': False, u'date_created': u'2014-05-19', u'id': 6445, u'in_program': u'Electronic Monitoring, AWOL'}]