codeforamerica/ohana-api — pull request #253 by monfresh (2014-10-23 16:17:34+00:00)
Title: Add ability to filter locations by activity status

Now that the OpenReferral spec requires a `status` field for Services,
it’s possible that all of the Services for a particular Location could
become `inactive` and/or `defunct`.

If that’s the case, I would assume that you would no longer want to
include that Location in search results because you wouldn’t be calling
that location or visiting it if it no longer provides any services.

To enable this filter, I added a boolean `active` field to the
Locations table that automatically gets updated if the Location’s
overall Services status changes.

To only show active locations, pass in the `status=active` parameter.
For example:
https://ohana-api-demo.herokuapp.com/api/search?status=active

To only show inactive locations, pass in `status=inactive`.

For clients that display information about a particular Location, it
might make sense to display a warning or other message if the Location
currently doesn’t have any active services. You can determine if that’s
the case by checking if the Location’s JSON contains an `active`
attribute set to `false`.