Tuesday, March 31, 2015

A Cite to Behold: Standardizing Electronic Legal Citations

Citations are the hyperlinks of law, so it is natural to expect textual citations to be hyperlinked in electronic laws. Numerous parallel efforts are taking on this task for federal government documents online, making those documents easier to read and navigate. Derek Willis (@derekwillis) of the New York Times noticed these links in House Bills published on Congress.gov:


Linked citations are also now found in web interfaces for federal regulations. The terrific site, FederalRegister.gov, parses and adds citations to the user interface. For example, a recent proposed FCC rule on federalregister.gov has links to other regulations, Public Laws and to the U.S. Code:

However, these links are not found in the source XML for the document:


That means that when a regulation is finalized and goes into the Code of Federal Regulations (CFR), it will not have the citation links. To remedy that, the eRegulations project from the Consumer Financial Protection Bureau (CFPB) has its own code that parses citations and adds links for CFPB's user-friendly regulations interface. This code seems to work independently from and in parallel to federalregister.gov, doing essentially the same thing at a later stage of the publication process for regulations.

While hyperlinks are being added to citations in various contexts, each implementation uses different methods to parse the citations and different formats for the links. This leads to inconsistent coverage for textual citations and inconsistent formats for identical textual citations. Before long, the lack of consistency will also lead to broken links. Now is therefore a good time to bring some uniformity to these efforts toward a standardized form for government electronic citations.

Here, I'd like to explore what that standardized form should look like. To serve its purpose, a citation (electronic or text) should be uniqueclear and permanent. A good citation leads to only one document, unambiguously identifies the portion of the document that is referenced, and will still be valid in the future.

Not all written citations meet these thresholds. In the United States Code, for example, there are two sections designated 5 U.S.C. 3598 (see the footnote for the section). That's right, Congress sometimes passes laws with duplicate section numbers. (True also for 10 USC 127c18 USC 3928 USC 193246 USC 70119, which have been redesignated during codification). There are also written citations that are ambiguous because they are missing context (e.g. 'Section 101 of such Act') or refer to law that itself has since been changed. Nonetheless, to the degree that the written citation is unique and unambiguous, the underlying hyperlink should be as well.

Two years ago, Grant Vergottini discussed progress on standardized electronic citations. Many of the ideas in that post were included in the electronic citation solution underlying the U.S. Code XML data model, called USLM. (Xcential helped develop USLM as part of the House Modernization Project). That two-part solution has proven to be efficient and extensible.

The first part involves an identifier: a standard, permanent path for the citation (e.g. 26 U.S.C. 501(c)) -> '/uslm/us/usc/t26/s501/c'). This identifier is clear and unique. It is condensed and human-readable.

In USLM each subunit of text is marked with a identifier of this form, making it easy to create a link to that subunit. So the subsection corresponding to 26 U.S.C. 501(c) has @identifier = '/uslm/us/usc/t26/s501'

The XML of 26 U.S.C. 501(c) with @identifier = /uslm/us/usc/t26/501/c
Conversely, any text that cites that subsection has @ref = '/uslm/us/usc/t26/501/c'.

Text citing 26 U.S.C. 501(c) with @href = /uslm/us/usc/t26/501/c

These identifiers allow fine-grained resolution for links to the U.S. Code from within the Code or from any outside source. They can also be extended to disambiguate between two provisions with identical section numbers, by concatenating additional metadata, such as the law that originally introduced the section (e.g. 'uslm/us/usc/t5/s3598/[/uslm/us/pl/100/32/s5] '). The U.S. Code also includes outbound references to other documents with identifiers of this type:


The second part of the solution is an online service called a 'resolver', which converts an identifier into a URL. The resolver keeps track of the most current and most official sources for documents and ensures that the embedded identifier can remain constant while the sources for these documents--various websites and APIs--may be in flux. Recently, for example, the best source for Congressional bills shifted from thomas.gov to congress.gov, the Library of Congress's new site. As long as the references are based on a standardized identifier, and not the current URL for the source, the resolver can redirect the link in the future to the appropriate future source.  This takes care of the permanence of electronic citations, allowing government websites to update and improve, without affecting the embedded electronic references in legal documents.

This approach has been informed by, and is intended to be compatible with the proposals being developed in the OASIS legal citations working group.

While the core of this solution is now built into the U.S. Code, more needs to be done in order to make it workable more generally. First, identifiers should start to be adopted in other document sources. As more government documents are published in machine-readable form, prompted by good governance or by legislation such as the DATA Act, these documents should have built-in identifiers at the paragraph level, or other appropriate subunits.

Second, a government-wide resolver (which could be hosted on a domain like 'citations.gov') could be used to translate identifiers into current URL's, and add new document sources (e.g. agency reports) as these become part of the electronic government ecosystem. That way, projects such as CFPB could simply add the resolver domain to the correct identifier (e.g. https://citations.gov/uslm/us/usc/501/c) convert a permanent identifier into a link to the source text. An extension of the resolver can take a textual citation as input, parse the text and return the correct identifier (e.g. 'section 501(c) of the United States Code' -> '/uslm/us/usc/t26/501/c').

With the great energy and infusion of talent into the US Digital Service, combined with the great work that is being done at the Library of Congress, GPO and as part of the House Modernization Project, we can now start to build electronic citations into federal documents that will stand the test of time.