Because Virginia makes its code available as structured data — which puts it ahead of most states, Jaquith says — he can build a website that looks better than the official one. Compare Virginia’s entry for § 24.2-956, which regulates campaign ads in print media, to Jaquith’s implementation. The former offers no design and little context. Jaquith’s page provides understandable history information, a list of attempted amendments, cross-references to other provisions, and inline definitions that pop up for key terms.

“Think of a code as a social network,” Jaquith told me. “Every law is like a person. Every law is connected to every other law via court decisions, legislation, shared definitions, cross-citations, and a dozen other ways.”

When you start thinking about laws that way, the user experience changes dramatically. Jaquith said every official state code website in the United States is, without exception, “wretched,” in effect making public data inaccessible to the public. Jaquith plans to post his source code on GitHub and help implement the State Decoded platform in other states.

Jaquith explained four key features of the website to me in an email:

The first, and best (IMHO), is the built-in glossary. The software scrapes the text of the code to find definitions, which it extracts, figures out the scope of it, and then stores to apply in the relevant sections of the code. (For instance, “person” has 118 separate definitions in the Code of Virginia. The most relevant one must be applied each time that it is used.) The reason why this is so important is that definitions are wildly important in understanding a law. A law might say “No playing loud music on weeknights downtown,” but unless you know the definition of “loud,” “music,” “weeknights,” and “downtown,” it’s of no value whatsoever. The definitions of those four words might be scattered widely, throughout the code. The State Decoded puts them all in one place. You can see an example of definitions in this section of the code about the state’s FOIA law. The defined words have a subtle, dotted underline, designed to make it easy to ignore for people who have no interest in them, but noticeable by folks to whom they’re very important.

The second is the connection back to legislation. In the sidebar of another section of the FOIA law, § 2.2-3711, you can see “Amendment Attempts.” That’s being pulled via a JSON request to Richmond Sunlight (another website of mine), which is listing every bill that cites § 2.2-3711. That allows people to see how laws have built up over time, and what sort of interest that there is, at least among legislators, in amending it.

The third is the connection to other parts of the code. Keeping open § 2.2-3711, you’ll see “Cross References” farther down in the sidebar. That’s a listing of every other part of the code that cites § 2.2-3711. Sometimes there are connected parts of a code that are far, far apart—in different titles, hundreds of pages away (on paper). This is a first step towards integrating them, breaking down the sometimes artificial barrier of topical divisions and regrouping laws more meaningfully.

And the fourth and final feature that you won’t want to miss is the connection to case law. For any section of the code for which there have been state court decisions that cite that section, those decisions will appear in the sidebar, under “Court Decisions.” (See, for instance, § 18.2-33.)

So this is awesome. Another metaphor, besides social network: programmers have had tools that do annotated source code display and browsing for a long time. Similar problem: lots of complex code, intricately cross-referenced, dependent on contextual definitions of terms.

Anonymous

That’s a much better metaphor, at least when explaining this to programmers. Thank you, Jonathan!

And like those programming tools can help the programmer writer better code, one can hope that an improved ability to display and browse the state code can lead to better written laws (not the same as better laws, but they might be less likely to lead to unintended consequences if the interrelationships are easier to follow, e.g. the recent attempt to redefine “person” across the code without regard to context). Which leads to the next question: have any contradictions in the code been spotted as a result of this improved view (conflicting definitions perhaps)?

Anonymous

I have found a bunch of what looks to *me* to be mistakes, absolutely, though I’m not an attorney. (Most often, sections of the code that use the word “person” to describe what could only apply to humans, but relying on the Code-wide definition of the term that includes corporations.) There’s even the odd typo; the first time I found one, I spent an hour convinced that my parser was mangling the code, before I compared it to the original and realized it wasn’t my fault. With so many people now just casually reading portions of the Virginia Code, I’m optimistic that these many eyes will make shallow such bugs in the Code.