visit ontolawgy™ LLC’s main site
Showing posts with label Digital access to law. Show all posts
Showing posts with label Digital access to law. Show all posts

2012-07-16

http://l4w.us free legal URL shortener now shortening links to the CFR

Last month, with little (rather, no) fanfare, ontolawgy™ LLC launched L4w.us ("law for us"), a free URL shortener* to access non-commercial sources of law.

Currently, it works for Bills in Congress (back to the 104th Congress), U.S. Public Laws (ditto), the U.S. Code, the Federal Register (to 1995 for text, 1994 for tables of contents), and as of today, the Code of Federal Regulations.

These documents are available through the the Library of Congress's legislative information site, THOMAS, the U.S. Government Printing Office's "FDSys",  The Legal Information Institute's U.S. Code and Code of Federal Regulations, and the online (though unfortunately, still unofficial) Federal Register.

If they're free sources, and the sites are easily searchable, why is an URL shortener necessary? Well, these sites, thankfully, are loaded with other features that make it difficult for them to offer clean, simple, and short URLs to access legal text.

For example, to get to Public Law 111-148, you need to go to:

http://www.gpo.gov/fdsys/pkg/PLAW-111publ148

That's not too complicated, and if you can remember the scheme, not such a big deal. What if you want to send someone a link to the text? You have to send them this:

http://www.gpo.gov/fdsys/pkg/PLAW-111publ148/html/PLAW-111publ148.htm

Not so easy. But why go through trying to remember that (or making a custom shortcut in your browser, or setting up a raft of unnecessary bit.ly links) when you can just type this: 

http://l4w.us/PublicLaw/111-148 for the landing page or

http://l4w.us/PublicLaw/text/111-148 for the full text or

http://l4w.us/PublicLaw/pdf/111-148 for the PDF.

Alternatively, if you're used to legal citations or you can handle spaces in your URLs:

http://L4w.us/Pub. L. 111-148
http://L4w.us/Pub. L. 111-148 text, and
http://L4w.us/Pub. L. 111-148 pdf

will work too, with or without spaces. Hopefully, those are self-explanatory enough.

There are more examples at http://L4w.us for other legal materials.

So why has no one done this before? Honestly, I have no idea. Is it really necessary? Unless you're Rain Man, I think it can't hurt, especially if you want to send or show people links to primary (or close-to-primary) legal source material.

My main idea was to let people use L4w.us links as easy-to-remember shortcuts to public versions of our laws, so instead of going to the destination sites and searching, or trying to remember the multiple URL schemes, if you know what you're looking for (sorry, no search yet), just type it in and go.

I also put it together to help simplify ontolawgy™ LLC's bulk data downloading programs. The overhead on the server is minimal, so I thought I'd share. Feel free to use it, and tell people how it's going; use L4w.us links in blog posts, articles, theses, student projects, non-profit citizen-engagement applications/campaigns, etc. Just don't bake it into a commercial software or hardware (e.g., a book) application without permission.

Currently, the site doesn't offer any fancy features, and we don't plan to. But it also doesn't track you. We maintain basic access logs with IP addresses to make sure people aren't abusing the service (e.g., DDOS-ing it for some unknown reason or incorporating the service into commercial activity without a license), but other than that, whatever laws you look at are between you, the site providing the content, and whoever is monitoring your internet traffic.

Suggestions for how to improve the site which resources to add are most welcome here in the comments, on Twitter, or by email.

© 2012 Alex M. Hendler. All Rights Reserved.

*If you haven't picked up on it by now, technically, L4w.us is not really an URL-shortener, it's more like an API for people to access other (simple) people-facing APIs, but without scaring them away by calling it an API.

2012-05-15

How to eat legislative sausage


Here's a two-part post, after a very long absence from the blog. I have been busy with several other projects, but I am gearing up to participate in the "legal hacks" event (see http://legalhacks.org) very soon, and as a result, am revisiting some issues related to organizing code-like legal materials. 

The first part of this post discusses organizing materials once they have been obtained, and the second part discussed some of the challenges in obtaining them. A bit backwards, perhaps, but the first part is likely more relevant to the upcoming event. 

Part I: Organizing code-like legal materials, or, eating legislative sausage

To rehash the old adage that making laws is like making sausage, organizing them after the fact is very much like eating it, and below is my general method for doing that, for whatever it's worth. As always, I welcome any feedback, questions, or suggestions.

I read with great interest two recent blog posts by Thomas Bruce of the Legal Information Institute at Cornell and Grant Vergottini of legix.info about challenges in organizing legislative/legal data using different types of identifying information. Generally, Mr. Bruce's post describes the functions that identifying information can serve. These are summarized below:

a) “Unique naming”, i.e., assigning a specific name to a legal provision within a system

b) “Navigational reference”, which is similar to navigating a filesystem

c) “Retrieval hook/container label”, i.e., to use a citation as a placeholder to aggregate lower-level content that is stored in other locations/records

d) “Thread tag/associative marker”, i.e., grouping of related documents in “threads”; one example he uses is a “captive search” URI, but in my view, this is mainly another way to get at a retrieval hook

e) “Process milestone”, i.e., inferring some meaning from the official status of a document, e.g., if a bill has been assigned a Public Law number, it has presumably been enacted into law.

f) “Proxy for provenance”, e.g., the existence of a bill number means that legislation has been officially noticed in some way.

g) “Popular names, professional terms of art, and other vernacular uses”, e.g., the Social Security Act, the Stark Law, the Anti-Kickback Statute (to use some of the examples with which I am most familiar).

Mr. Vergottini goes into the issues surrounding selecting frameworks to be used to actually implement those kinds of identifiers, e.g., via a URN or URL-based system, and discusses some of the difficulties inherent in selecting and implementing a system to capture relevant data in a machine-readable way. He also identifies problems with viewing different portions of text, as well as tracking text that gets amended or redesignated.

Common problems Messrs. Bruce and Vergottini both discuss include documents/provisions with identical names/identifiers in an official classification system (e.g., the two subparagraphs 42 U.S.C. § 1320a-7b(b)(3)(H) that coexisted for seven years until fixed by Pub. L. 111-148 § 3301), or how to store temporally different versions of text.

I started building the ontolawgy™platform (a web-based legal analysis system) about 6 years ago for my regulatory practice, and I ran into the problems discussed above quite early. Here are some of the approaches I have taken to address them:
  1. Treat every textual division as a unique document, and allow it to be accessed via a unique URL based on its location in the government taxonomy (a - c in Mr. Bruce's overview).
  2. Store each descriptive element about that document in a tag/field. This includes official and unofficial “popular names” (e.g., the Social Security Act), section numbers within those popular names, section numbers of the U.S. Code, Public Law enacting provisions, etc. (c - g)
  3. Allow users to query on any of those elements. (a - g)
  4. Track duplicates and give them distinct records that are still retrieved in an appropriate way using their descriptive tags/fields. (a - d, g)
  5. Track each provision using its current designation, but maintain a full locative, temporal, and ontological history within the record and the system. (a - e, g) For example, 42 U.S.C. § 1320a-7b(b)(3)(I) used to be the second 42 U.S.C. 1320a-7b(b)(3)(H) that was enacted by Pub. L. 108-173 § 431 (the first subparagraph (H) was enacted by § 237 of the same Public Law); the system tracks all that information and allows users to query it and, e.g., gather together all historical versions of subparagraph (H) to track how it has changed over time. 
As for the mechanics, when I started building the system, my main goal was to get up and running quickly with a free, open-source, off-the-shelf system. The system is extremely flexible, has a very active development community, and still works quite well. While it does not currently use any sort of (proposed) standard like URN:lex or Akoma Ntoso, it does use inline markup, and thus, should be easily convertible to a legal markup standard once one is in place. 

I can't go into much more detail here, but please contact me to get access to my demo system if you would like to see it in action.

Part II: Obtaining legal source materials, or, how the government makes sausage even messier

All that said, one significant challenge I still face is getting rational raw data from official sources. Indentation can be highly relevant semantically, depending on the subject matter, but official sources either just do away with indentation altogether (I'm looking at you, Code of Federal Regulations) or present it in such an inconsistent format that it might as well not be there (U.S. Code).

Back to the sausage. Essentially, we pay the government to make legal sausage, cook the sausage, and serve it to us, but just before they serve it, they mash it up, smear it around the plate, then take away our silverware and tie our hands behind our backs. I spend much more time than should be necessary simply ensuring that the materials I work with are properly indented to accurately reflect their meaning. I've written several small programs to do about 95% of the work, but that remaining 5% can be almost maddening, particularly when dealing with multiple levels of unenumerated flush text. The materials are certainly drafted with visible indentation (take a look at Public Laws: all the indentation is there and correct), but all this useful information gets stripped out at some point in the publication process, and it is not at all clear to me why this happens. The U.S. Code uses “bell codes” for typesetting print documents, but this doesn't excuse the lack of indentation in electronic publications.

The C.F.R. is even more maddening: This document claims that the XML format of the C.F.R. “is a complete and faithful representation of the Code of Federal Regulations, which
matches most closely to the author's original intent... [and] fully describes the structure of the Code of Federal Regulations, including the large structure (chapters, parts, sections, etc.), the document structure (paragraphs, etc.), and semantic structure” then goes on to explain that the SGML indentation for subsections, paragraphs, subparagraphs, clauses, etc. have all been collapsed to a the same single tag. This means that every last bit of indentation/separation (except for line breaks) within each section—“sections” can be very long and complex, with multiple nested levels of semantically-relevant indentation—has been completely stripped from all publicly-available electronic materials. How is this supposed to help the public? 

The LII has generally addressed indentation issues in its publication of the U.S. Code (See http://www.law.cornell.edu/uscode/text/42/1395ww for an example), and content is freely available for viewing and non-commercial re-publication.

LII's new Code of Federal Regulations (CFR) system, the result of a close collaboration with the government, also does an excellent job of organizing and indenting CFR data the way it was meant to be read: it is the only freely-available resource of which I am aware that does this.

While the LII's sites offer a valuable public service, they do not solve the underlying problem: Properly indented content is not freely available to the public from the government for commercial re-use, even though these government works are in the public domain. Why is this a problem? Because official platitudes notwithstanding, government publications significantly obscure or corrupt the intended meaning and scope of the laws that govern us.

If anyone has some insight about how to get the government to bring useful and accurate indentation to its official publications, please get in touch, I would be thrilled to work with you to help make this happen.


© 2012 Alex M. Hendler. All Rights Reserved.

2010-03-01

Brace yourself for "dense reading of the most tortuous kind"

Well, not here, I hope, but I thought I should warn you about it. With reports coming in that the House may pass the Senate health care bill with a simple majority and move it to reconciliation in the Senate for a simple majority vote, it seems that meaningful debate on the big issues is essentially over (though the partisan sniping shows no signs of letting up); there may be a few minor tweaks here and there, and some issues may be carved out and addressed separately.

If the bill is going to survive in roughly the same form in which the Senate passed it (i.e., likely its best hope for survival), then it is going to present a number of challenges to those who want to understand and implement it, as suggested in a previous post.

The first step in analyzing it is looking at the current laws that it would amend. Among the laws the bill would amend is the Social Security Act, which, among other things, governs Medicare and Medicaid. The bill would make significant changes to how Medicare and Medicaid are funded and reimburse for services. The U.S. Court of Appeals for 4th Circuit has characterized this body of law rather colorfully:

There can be no doubt but that the statutes and provisions in question, involving the financing of Medicare and Medicaid, are among the most completely impenetrable texts within human experience. Indeed, one approaches them at the level of specificity herein demanded with dread, for not only are they dense reading of the most tortuous kind, but Congress also revisits the area frequently, generously cutting and pruning in the process and making any solid grasp of the matters addressed merely a passing phase.
Rehabilitation Ass'n of Va. v. Kozlowski, 42 F. 3d 1444, 1450 (4th Cir., 1994)

"Surely," you might think, "this must be judicial hyperbole." I can assure with great confidence that it is not.

For example, below is a simplified (and rather incomplete) 1-degree semantic map of the term "physician" as it appears in Section 1861 of the Social Security Act, based upon analytical information available on the ontolawgy™ platform. By "1-degree", I mean that the map tracks only direct relationships among element within a system, i.e., A -> B and relationships that A and B share with other elements.


On the right are the terms that require understanding of the term "physician" or that one must understand to understand the term "physician". On the left are the legal provisions—only within Section 1861—that are in some way related to the term "physician". Each of the lines in this diagram represents not only that a relationship exists between elements in the system, but also actually describes what the relationship is. Think of each line as a thought that a lawyer would need to have—consciously or not—in order to actually understand what a term or statutory provision means.

In some instances, it may require 4 or 5 "thoughts" to fully understand the relationship among the elements. The ontolawgy™ platform tracks those thoughts and places them into a searchable database.

If that's a "simplified" map, what does an unsimplified map look like? Well, because you asked so nicely, here's a 2-degree map; it tracks relationships beyond the first degree. For example, A -> B is a 1-degree relationship. A -> B -> C is a 2-degree relationship; the map also tracks common relationships among A, B, or C:


If these diagrams don't look particularly helpful to navigate or understand the law, don't worry: They're not supposed to be (at least not when presented as static images). They are supposed to represent the complexity and interconnectedness of elements of the law and to demonstrate the difficulty that a mere mortal lawyer might encounter when researching Medicare and Medicaid issues.

Now before you jump to any conclusions about the intellectual prowess of lawyers, remember that this diagram just relates to the term "physician" as used in Section 1861 of the Social Security Act. It does not address the term as it may appear in the other 108 sections of Title XVIII of the Social Security Act, nor does it address the term as it might be used in the context of Medicaid, nor in any of the millions of words (no exaggeration) of regulations, rules, Medicare and Medicaid manuals, and other statements of official policy. It may also help to bear in mind that Medicare and Medicaid regulate considerably more than just physicians.

I submit that anyone who can keep track of all of this in his or her head either has a beautiful mind or an unusual affinity for toothpicks. Let's just say that I don't have a little shed out back and I eat with a knife and fork....

© 2010 Alex M. Hendler. All Rights Reserved. No claim to original government works.

2010-01-08

Brobdingnagian, Leviathan, or just plain enormous?

It is hard to pick an adjective to describe the (finally) published version of the Senate's amended health care bill, a.k.a. H.R. 3590.EAS. For a bill that started off as a few paragraphs to extend the first-time home buyer's tax credit to certain overseas members of the military, it has—in line with one of my earlier predictions—morphed into a beast that weighs in at about 2.4 kilopages (2,407, to be exact, not counting two superfluous pages at the end). I have not yet had a chance to read it, but with the election of Scott Brown to the late Senator Kennedy's seat in the Senate, it would probably not be the best use of time, the general consensus being that his election limits the likelihood that the Senate's version of the bill would survive unscathed a conference with the House.

That said, below are some potentially interesting statistics on the bill that the Senate passed (much of it based on automated analysis):
  • Size
  • As a plain text file, it is about 2.5 MB;
  • The official PDF of the bill is about 4.3 MB;*
  • The table of contents is 16 pages long;
  • The bill is approximately 16,000 lines long;
  • It contains approximately 379,638 words.
  • Complexity
  • It has 441 Sections of its own;
  • It adds 173 new Sections to existing law;
  • I doubt there is any religious significance, but that amounts to 614 sections altogether (one more than the number of commandments commonly held to exist in the Hebrew Bible), a fact that might be interesting to certain factions that oppose this legislation;
  • It makes approximately 912 amendments to existing law;
  • It mentions the "Social Security Act" 706 times;
  • It mentions the "Public Health Service Act" 284 times;
  • It mentions the "Internal Revenue Code" 195 times;
  • It mentions the "Employee Retirement Income Security Act" (also known as ERISA) 25 times.
  • Money
  • It contains 360 dollar signs;
  • It mentions numbers in unrounded millions (i.e., xxx,000,000) approximately 206 times;
  • It mentions numbers in billions rounded to millions (i.e., xxx,xxx,000,000) approximately 39 times;
  • Of those 39 times, it mentions numbers in unrounded billions (i.e., xxx,000,000,000) approximately 26 times.
What is the point of reporting all these numbers? Merely to point out that the bill is big, complicated, and addresses numbers of a size more typical of biology, chemistry, physics, and CMBS balance sheets. Why is is so big and complicated?

Unfortunately, the straightforward solutions to the problem of securing universal health insurance coverage (i.e., mandate individual insurance purchases through imposition of a new income tax, refunded in part through vouchers to pay for such insurance, in part to subsidize insurance for those who could not otherwise afford it; get rid of preexisting condition exclusions; completely remove the federal antitrust exception for health insurance), are, for the most part, political non-starters.

While some of the complexity in health reform legislation may stem from earmarks or other concessions to bring certain legislators on board, I submit that a larger part comes from attempting to reach the same results as above in such convoluted—sorry, "creative"—ways that politicians can try to explain their way around the outcome in a manner that would allow them to get reelected.

There are some hints of what a "pared-down", passable bill might do, and while it could be a start, if that is what Congress ultimately does, it is still quite far from where we need to be, i.e., universal (but not necessarily unified, i.e., "single payer") coverage.

So, is Scott Brown's election a good or a bad thing for "health reform"? With that, I leave you to Federalist No. 10 and your own conclusions:
A zeal for different opinions concerning religion, concerning government, and many other points, as well of speculation as of practice; an attachment to different leaders ambitiously contending for pre-eminence and power; or to persons of other descriptions whose fortunes have been interesting to the human passions, have, in turn, divided mankind into parties, inflamed them with mutual animosity, and rendered them much more disposed to vex and oppress each other than to co-operate for their common good.

*Your numbers may differ; my operating system reports sizes in megabytes as if 1 MB = 1000KB; some systems reports sizes as if 1MB = 1024KB; technically, the latter definition is called a "MebiByte", but few people actually use that term.

© 2010 Alex M. Hendler. All Rights Reserved.

2009-12-23

What Congress could learn from farting phones

With the Senate inching ever closer to passing health care reform legislation, unless you’re working on the Hill or have a few dozen hours to dig through THOMAS to piece together what the most recent version of the health reform legislation actually does, you’re out of luck if you actually have the gall to want to read it.

There’s a November 19 version of the available from the previous link (H.R. 3590.AS), but you need to look at the “Bill summary and status file” (specifically, “All Congressional Actions with Amendments”) to see what has happened to the multiple amendments that Thomas reports have been made to the bill. Then you’ll have to manually insert the adopted amendments into the Nov. 19 text yourself and see what you can figure out has been done. There’s no freely available unified text as of this writing. Some commercial services may have independently produced unified text, but I don’t subscribe to any of those—nor should I have to to find out what my Congress is doing.

Given that Congress actually uses computers now (at least, that’s the rumor), it is thoroughly shameful that we, for whom the Representatives and Senators work, cannot actually see what they are doing until well after they’ve done it—a major problem in a Republic where the Representatives and Senators are supposed to represent our interests. It is also highly doubtful that the Representatives or Senators can see what they are doing if this is the system they are actually using to keep track of things. Fortunately, there is software—much of it free—that could help.

It is no coincidence that we speak of computer “code” just as we speak of legal “code”. Each is a set of relatively arcane instructions to a computer (silicon or human, respectively) to perform or not perform a certain set of actions within a defined framework. Each is typically comprised of complexly interconnected elements, yet remains readable and (somewhat) intelligible to experts in their respective fields.

Typically, when one speaks of human-readable computer code, one is describing “source code”, that is, a human-readable equivalent of what a programmer intends for a computer to do. Once the code is “compiled” for a particular type of microchip, a computer can run it. For example, multiple developers can work on a program to make an iPhone simulate flatulence. The program is split into different sections, and the developers can revise these sections, tracking each revision along the way, debating changes, and, in some cases, letting anyone in the world track progress on the developing source code through a public website. Once the code is complete, it is compiled, and can be used by an iPhone to everyone’s juvenile delight.

Similarly, legislation is “source code” that must be “compiled” (either into the Statutes at Large or in the U.S. Code, or both) after its passage to be applied (“run”) by the legal system (judges, lawyers, police, etc.). However, it is put together in person (for the most part), on paper (in large part), then transcribed into a computer system that (at least to the general public) seemingly simulates paper in many ways. Changes are rarely integrated in real time, instead, they are often posted as monolithic “amendments” (if the amendments are posted at all) and not integrated into a “live” version of the text. Typically, with complex legislation, its full text is not available until after it has been passed by the House and the Senate and signed by the President—too late for mere mortal citizens to do anything about it (e.g., talk to their Representatives or Senators).

The analogy is not as useful when taking it much further, so let’s stop there for the moment and get to the point:

The same free software that people can use to collaboratively make their phones fart could be used to draft complex legislation and share it—in real time—with the general public.

There is a trove of free, (relatively) easy to use software that is designed to track the minutest of changes to extraordinarily complex documents and share those changes—including all the history back to the original text—with the entire world. Git, CVS, subversion, Mercurial, take your pick.

Although THOMAS is an incredible resource, it still largely catalogues information as if it were written on vellum parchment with quills, bound together with catgut, horsehide glue, and a calfskin cover. It does give one some appreciation for the complexity of what Congress does, but as as legislation and the legislative process grow increasingly complex, THOMAS’s utility as a tool to extract meaningful information decreases dramatically. Hopefully THOMAS will git (or some equivalent) with the program soon.


© 2009 Alex M. Hendler. All Rights Reserved.