Monthly Archives: May 2015

The U.S. Constitution in XML

One of the more challenging aspects in creating the interactive app for exploring the United States Constitution was the lack of an XML version of the U.S. Constitution.

US Constitution Explorer

conaminationOnce

Click on the image above to launch the app

 

I looked around on the web a bit, but I was unable to find one.  (Perhaps I missed it, please let me know).  This in contrast to the Titles of the U.S. Code which have been released in .xml Format.

(Edit: Update – Some time after I wrote this, Congress released an Official version of the US Constitution in xml – located here.  You may prefer that to my unofficial version below.)

Structuring the law as data in XML (or some other structured format) is what permits us to create interesting visualizations like the above, or those here and here.

US Constitution in XML

Constitution in XML

Thus, I decided to create versions of the U.S. Constitution in XML and JSON (Javascript Object Notation) format.  The text of the Constitution was copied from this source.  I wrote a parser in python to read in the plain text file and create the xml and JSON files based upon the heading structure.

You can download this version of the U.S. Constitution in XML from github or simply copy from below.  Please note, this is just a “beta” version.  I haven’t fully vetted the contents of the Constitution that I copied, and while I believe it to be correct, there may be errors.  Please feel free to copy it and adapt it for your own purposes.
Continue reading

Exploring the Constitution Visually

I have developed a new experimental interactive app for exploring the United States Constitution.

US Constitution Explorer

conaminationOnce

Click on the image above to launch the app

This app allows you to navigate the contents of the U.S. Constitution while displaying the overall hierarchy and structure. You can click on the various Articles and Amendments to expand the sub-parts and and see the accompanying text.

Consitution List2

This app was somewhat more challenging to develop because I was unable to find any version of the U.S. Constitution that had been written in .xml.  Thus, I had to create an .xml version of the Constitution myself.  In a follow-up post, I will include the xml version of the U.S. Constitution

This app was created using the d3 data visualization framework and javascript.  It uses Mike Bostock’s collapsible tree framework as a base.