• ADVERTISEMENT

    The State Decoded Adds Public API, Standard XML Format for Legal Info

    by Waldo Jaquith
    February 12, 2013

    Version 0.6 of The State Decoded is now available on GitHub. This release is a really exciting one — it establishes a public API for State Decoded sites and creates a standard XML format for importing laws! This is an important release of The State Decoded, one that stands to increase significantly the accessibility of the project to developers, both within the software and without. A total of 23 issues were resolved, nearly all of which are towards those two goals.

    i-d0069654028ed70b1e6709199e9913d8-capital.jpg

    The State Decoded is a platform that displays state codes, court decisions, and information from legislative tracking services to make it all more understandable to normal humans.

    ADVERTISEMENT

    Public API

    The State Decoded now has a fully fleshed out RESTful, JSON-based API. It has three methods: Law, Structure, and Dictionary. Law provides all available information about a given law. Structure provides all available information about a given structural unit (the various organizational units of legal codes — “titles,” “chapters,” “parts,” etc.). And Dictionary provides the definition (or definitions) for a term within a legal code. The data for these comes directly from the internal API that drives the site — what’s available publicly is what drives the site privately. In fact, I’m toying with the idea of having the site consume its own API, using internal APIs solely to serve data to the external API, and having every other part of the site get its data from that external API.

    ADVERTISEMENT

    For a quick start trying this out on the Virginia site, you can use the trial key, 4l6dd9c124ddamq3 (though don’t build any applications using that key, or they will break when it expires), and see the API documentation to put it to work. For a really quick start, you can just browse the Code of Virginia via the API, check out a list of definitions, or read the text of a law. If you decide that you like what you see, register for a key and put this API to work.

    Personally, this is the release that I’ve been waiting for. There’s an extent to which the purpose of The State Decoded project is really just to provide an API for legal codes; the fact that there’s a pretty website atop that API is just icing on the cake.

    XML Format

    A significant obstacle to implementing The State Decoded has been the need to customize the parser for each installation. Every legal code is different — there are no standards — with some all in one big SGML file, others stored in thousands of XML files, and others still needing to be scraped off of webpages. That necessitated modifying the State Decoded parser to interface the data from the source files with the internal API. That’s really not an obstacle to people and organizations who are serious about implementing The State Decoded. But plenty of people might be serious if they could just try it out first. There’s a huge gradient between “huh, looks interesting” and “I must get my city/state/country laws online!” It’s foolish to assume that people won’t just want to try it out first. After all, that’s how I prefer to get started with software and projects.

    The solution was to establish an XML standard for importing legal codes into The State Decoded, to provide a low-barrier-to-entry path in addition to the more complex path. To be clear, this is not an attempt to create an XML standard for legal codes. This is a loosely typed standard, used solely as an import format for The State Decoded. Many legal codes are already stored as XML — that’s the most common file format — so getting those codes into The State Decoded now only requires writing a bit of XSLT. This is a much lower barrier to entry.

    The XML looks like this:

    i-e4a83636cf94f479620f705192232874-xml.jpg

    Several of those fields are optional, too. There will certainly be legal codes and organizations for which this won’t do the trick — they’ll need to modify the parser to handle some unusual types of data, fields, third-party data sources, etc. But for most people, this will be a big improvement.

    The Code of Virginia is available as State Decoded XML, so if you’ve been considering playing with The State Decoded, it just got a whole lot easier to deploy a test site. Just download that XML and follow the installation instructions.

    Thanks to Tom MacWright, Andrew Nacin, Daniel Trebbien, and Chad Robinson for their pull requests, wiki edits, and trouble tickets.

    Waldo Jaquith has been a website developer for 18 years and an open-government technology activist for 16 years. He holds a degree in political science from Virginia Tech and was a 2005 fellow at the Sorensen Institute for Political Leadership. He and his wife live on a small farm near Charlottesville, Va., where he works for the Miller Center at the University of Virginia. He was received a “Champion of Change” award at the White House earlier this month.

    Image courtesy of Flickr user jimmywayne.

    This post originally appeared on the The State Decoded blog.

    Tagged: developers github public api standard xml state codes the state decoded version 0.6

    Comments are closed.

  • ADVERTISEMENT
  • ADVERTISEMENT
  • Who We Are

    MediaShift is the premier destination for insight and analysis at the intersection of media and technology. The MediaShift network includes MediaShift, EducationShift, MetricShift and Idea Lab, as well as workshops and weekend hackathons, email newsletters, a weekly podcast and a series of DigitalEd online trainings.

    About MediaShift »
    Contact us »
    Sponsor MediaShift »
    MediaShift Newsletters »

    Follow us on Social Media

    @MediaShiftorg
    @Mediatwit
    @MediaShiftPod
    Facebook.com/MediaShift