sc3/cookcountyjail — pull request #387 by wilbertom (2014-05-14 04:07:17+00:00)
Title: V2.0 dev

A lot of work on the database and started to play with the process route. Was able to import `52078` records from version 1 with the following script:

```
INMATES = "http://cookcountyjail.recoveredfactory.net/api/1.0/countyinmate/"

def get_json(url, limit=100, offset=0):

r = requests.get(url, params={'limit': limit, 'format': 'json', 'offset': offset})
print(r, r.url)

return r.json()

if __name__ == '__main__':

data = get_json(INMATES, 0)
data = data['objects']

for row in data:

phash = row['person_id']

if phash is not None:

gender = row['gender']
race = row['race']

r = requests.post('http://localhost:5000/process', data={'data': json.dumps({'hash': phash, 'gender': gender, 'race': race}) })

print(r)
```
API preview:

```
{
"num_results": 52078,
"objects": [
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "7a6df4ff717b35baaea6cfbf06182017a570ee56685d9263fc86d576f604b765",
"id": 1,
"race": "LW"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "913d20b5b377fe35ad0364bbf684afac21cd01e0bc224e5ae1a57578090db048",
"id": 2,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "94ff70cdc84742a5f8b2273d1715b81c1389fa35e84ab4f71ea24996b2de9d44",
"id": 3,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "448634cd5a8c962b9e1a1d530d99e642aa74b62b2799e434bd1928e9480676cd",
"id": 4,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "7a139f553df7ced81aeb25f6871591c61256524cd5cd81aae11feeaec69f4bdb",
"id": 5,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "64c4beeb1e050a4fba643d1ed11d41e3bc9581e7b7048756f9cec8cb8223e5d1",
"id": 6,
"race": "LW"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "30ca3ab4b3c04c027bfee0949b4c90ca041728d69ea658e53b42ba2c866870e7",
"id": 7,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "bba91e20d637696e18e405d1a94e0404215de2ed421e22042987f29adc265a48",
"id": 8,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "ebe7dd954718d44cc5f611fe6860e88a6a52cc5acc010044b98963d3cec68887",
"id": 9,
"race": "BK"
},
{
"date_created": "2014-05-13",
"gender": "M",
"hash": "98692e9f4f702fbd0042da849a9fcfaafdc7e17e5770586941ee243277c3de34",
"id": 10,
"race": "BK"
}
],
"page": 1,
"total_pages": 5208
}
```