Live data from Hacker News

The entire US Code is now online in XML

uscodebeta.house.gov

41–50 of 244 posts

Re: The entire US Code is now online in XML

#41
This is awesome. They even have a stylesheet apparently.

However though the file claims to be UTF-8, vim seems to disagree, at least for title 10. I can't tell what encoding it really is though, doesn't seem to be latin1 or windows-1252 either.

Re: The entire US Code is now online in XML

#42
post #39

now if the same could be provided for bills(ideally before they are voted on), and that should go in github or something.

Imagine if it was done essentially as a "pull request" in the future. That would be amazing.

yep thats what i'm thinking. I'm sure lobbyists won't allow it.

Re: The entire US Code is now online in XML

#43
It's tragic that the United States (Federal) Legislative Model (USLM) is defined in terms of W3C XML Schema Definition language (XSD) instead of the comparably sane RELAX NG and its easily interpreted compact syntax. You would think that something this important ought to be made clear and understandable.

EDITED TO CLARIFY: The tragic part isn't that the schema is given in XSD but that it's defined in XSD, which lacks RELAX NG's simple semantics and composibility rules. For a good summary of what I'm referring to, see James Clark's message to the IETF on the subject:

http://www.imc.org/ietf-xml-use/mail-archive/msg00217.html

Re: The entire US Code is now online in XML

#44

now if the same could be provided for bills(ideally before they are voted on), and that should go in github or something.

Maybe try to organize some tech-minded staffers on the hill? Get them to put bills onto a github repo when they are made public, maybe even XMLizing it to make it more exposed to machine analysis. It'd be a huge step in congressional transparency, especially now that bills are going into the high hundreds and thousands of pages (not a dig at the healthcare bill in particular, just a trend).

Re: The entire US Code is now online in XML

#45
post #33
post #29

Earlier quoted context omitted.

Why? JSON should just be for data transfers. XML is for document formats. While the lines get seriously blurred that is there general use.

Agreed, for long running data sets you really want schemas.

There are Json schema implementations out there.

Re: The entire US Code is now online in XML

#46
post #30
post #6

I'm really tempted to collect the XML files and put them on github, with periodic checkpoints to update it with the latest. Watching the evolution of law over time is a fascinating thing and using SW engineering tools to help would be really fun.

This is currently done via scraping: https://github.com/divegeek/uscode The diffs are huge.

Check out the Obamacare blip:

https://github.com/divegeek/uscode/graphs/code-frequency

Re: The entire US Code is now online in XML

#47
post #6

I'm really tempted to collect the XML files and put them on github, with periodic checkpoints to update it with the latest. Watching the evolution of law over time is a fascinating thing and using SW engineering tools to help would be really fun.

I just created a repo with all the codes[1]. There was a convenient link to all codes in one zip file. I will note that this is a massive amount of text.

There is a link to the schema used and a stylesheet (I assume for the xhmtl maybe?) that I would like to add in. But one step at a time.

[1] https://github.com/varikin/UnitedStatesCode/

Re: The entire US Code is now online in XML

#48
post #13

Earlier quoted context omitted.

As the schema guide explains, in 1999 they picked XML based on the study from 1996: "Following a 1999 feasibility study on XML/SGML, the Committee on House Administration adopted XML as a data standard for the exchange of legislative documents" http://uscodebeta.house.gov/download/resources/USLM-User-Gui... It took the US Govt 17 years to release 200,000 pages of the US code in XML.

I wonder if 17 years is fast for the government or slow.

Fast..... sadly

Re: The entire US Code is now online in XML

#49
post #35
post #6

I'm really tempted to collect the XML files and put them on github, with periodic checkpoints to update it with the latest. Watching the evolution of law over time is a fascinating thing and using SW engineering tools to help would be really fun.

The funny thing is that a lot of law is structured like definitions, the actual law, then consequences. Any of those three can change independently, and change the meaning of the law. So diffs are often not as useful as you wish.

We need to parse the law into some simulation code, and then have unit tests (does scenario B cause citizen A's rights to be violated), and then check if changes break the tests.

Re: The entire US Code is now online in XML

#50

This actually makes law accessible to the technologically-savvy out there, and is going to launch a thousand apps giving specialized legal advice. This could in turn mean a reduction in the cost of litigation, which would hopefully be passed on to the rest of us. Hopefully I won't get sued for that statement.

Hopefully, as a result, the disturbing statements like the ones below will become obsolete:

James Duane, Regent Law School professor, defense attorney:

"Estimates of the current size of the body of federal criminal law vary. It has been reported that the Congressional Research Service cannot even count the current number of federal crimes. These laws are scattered in over 50 titles of the United States Code, encompassing roughly 27,000 pages. Worse yet, the statutory code sections often incorporate, by reference, the provisions and sanctions of administrative regulations promulgated by various regulatory agencies under congressional authorization. Estimates of how many such regulations exist are even less well settled, but the ABA thinks there are ”nearly 10,000.” http://youtu.be/6wXkI4t7nuc?t=5m18s

Supreme Court Justice Breyer:

"the complexity of modern federal criminal law, codified in several thousand sections of the United States Code and the virtually infinite variety of factual circumstances that might trigger an investigation into a possible violation of the law, make it difficult for anyone to know, in advance, just when a particular set of statements might later appear (to a prosecutor) to be relevant to some such investigation." http://www.law.cornell.edu/supct/html/98-93.ZD.html

Post reply on HN