sc3 / cookcountyjail

A Django app that tracks the population of Cook County Jail over time and summarizes trends.
http://cookcountyjail.recoveredfactory.net/api/1.0/?format=json
Other
31 stars 23 forks source link

refactor daily population to use a fields param #409

Open bepetersn opened 10 years ago

bepetersn commented 10 years ago

courtesy of the mind of @eads:

Instead of having 50 or 100 or more fields on the daily population summary as we do presently, we ought to simply have a fields param. For instance the present field "males_booked_bk" becomes a call to this URI:

/dailypopulation?fields=males,bk,booked

This would make having an additional parameter, "in_jail" (see #280) much easier. It would further imply, or could imply, several things. For instance, it would allow us to lazily evaluate the daily population changes. But perhaps that would be bad for our summary, so we could do something like cache it.

Plenty of things would also be up in the air, like what happens if you hit this API without supplying fields. I also can't think of how best to implement this presently, but I do think it would make our API easier to work with, and thus would be worth working out. One disadvantage of this approach is that multiple calls to our API would have to be made to get the same amount of information.

Whatever we want to go with, it needs to be decided pretty urgently! @wilbertom, @nwinklareth, @derekeder, @fgregg, what do y'all think?

nwinklareth commented 10 years ago

I see this as a nice to have. It is easy to program in Javascript using pluck to extract the field you are interested in and the data transmission costs are low.

Doing an incremental summary calculation for a few days takes about 4 seconds. Once made,all subsequent calls are immediate.

This can be added at any time.

On Tue, May 20, 2014 at 10:48 PM, Brian Everett Peterson < notifications@github.com> wrote:

courtesy of the mind of @eads https://github.com/eads:

Instead of having 50 or 100 or more fields on the daily population summary as we do presently, we ought to simply have a fields param. For instance the present field "males_booked_bk" becomes:

/dailypopulation?fields=male,bk,booked

This would make having an additional parameter, "in_jail" (see #280https://github.com/sc3/cookcountyjail/issues/280) much easier. It would further imply, or could imply, several things. For instance, it would allow us to lazily evaluate the daily population changes. But perhaps that would be bad, so we could do something like cache it.

Whatever we want to go with, it needs to be decided pretty urgently! @wilbertom https://github.com/wilbertom, @nwinklarethhttps://github.com/nwinklareth, @derekeder https://github.com/derekeder, @fgregghttps://github.com/fgregg, what do y'all think?

— Reply to this email directly or view it on GitHubhttps://github.com/sc3/cookcountyjail/issues/409 .

Regards

Norbert

Norbert Winklareth