// Blog

Open Government with Clarify

Originally published on the Clarify.io blog. View archived copy.

There are a variety of reasons people don’t participate in their local government processes. While some are personal/societal and hard to address, one can easily be addressed via technical means, namely lack of information.

Austin Texas Public Information OfficeHow often are important topics discussed by your city or regional government and you simply don’t know about it? How might you get involved if you knew when and where a topic was coming up for debate? While this has been challenging in the past, using Clarify – we can make this fast, simple, and easy to use.

First, we’ll get the PHP helper library. In this case, we’ll use composer to make it as fast and simple as possible. Within the root of our project, we create a composer.json file like this:

and then run composer install and the library will download fully configured.

Next, we need to collect our videos. In the City of Austin, all of our City Council meetings and many of the committee meetings are recorded, so we’ll start with that: http://austintexas.gov/department/atxn. Luckily, in this case we have an RSS feed of some of the videos – http://austintx.swagit.com/videos.xml – otherwise we would have to scrape the page for the video links.

Next, we’ll parse the XML using PHP and load each of the files into the system via the API:

While there’s only video in this particular feed, if there were podcasts or other audio, we could use the identical code to import those. We can also attach metadata but we’ll cover that in another post.

Just to make sure everything was loaded as we expect, we can list out all the files by making another API request:

Next up, we want to perform a search which we can also do in two lines of code:

but the resulting data we get back is more useful. While the full search results here look complicated, there are some simple ways to view and process the results.

  • First, the search_terms array displays the exact terms searched.
  • Next, the item_results array returns the exact time offsets where your search term(s) appeared. Further, this array’s keys match the keys for the final array.
  • Finally, the _links array returns the items array. This array is a list of the bundles that match your search terms and its keys match the item_result’s keys. It also gives you pagination information in case there are multiple pages of results.

In other words, you effectively read the results like:

“Clarify found [search_terms] at the [item_results] time specified in the [_links][items] bundles.”

Using our simple command line search to find “fiscal,” we end up with these results showing both instances of the word and in which bundles they appear:

/v1/bundles/eee12d7984d8449789792b793930079b
1829.71 -- 1830.05
1830.44 -- 1830.75

Finally, while a command line search may be sufficient, it’s not visually pleasing. From here, we’ll take our search results a step further and integrate our Clarify video player. In this particular case, we’re only going to show the first resulting video but we could extend this demonstration to include as many videos as there were results. For this search box, you can experiment with multiple search terms by using a pipe (|) between the terms in the box. We’ll cover this in greater detail in a later post.

While this example is specifically for the Austin city government, more and more organizations are putting meetings, seminars, and workshops online. Updating this code to support those video libraries is simple and who knows what interesting things you might learn?

If you have any questions, don’t hesitate to drop me a note: keith@clarify.io or tweet us at @OP3Nvoice.

You can find the full code for this project on Github: https://github.com/caseysoftware/op3nvoice-austin-city-govt