Live data from Hacker News

The entire US Code is now online in XML

uscodebeta.house.gov

141–150 of 244 posts

Re: The entire US Code is now online in XML

#141
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.

In Germany we solved this problem by converting the XML into readable markdown first:

https://github.com/bundestag/gesetze/commit/f90e8fc8eb20f081...

(see also: https://news.ycombinator.com/item?id=6137337)

Re: The entire US Code is now online in XML

#142
post #127

Earlier quoted context omitted.

Remember that diff is an algorithm to generate the smallest set of operations to produce version B from version A, not an accurate reconstruction of what happened. Diff algorithms are also often tuned not try as hard to find the smallest set of changes for larger documents, due to speed concerns.

I did some work & research about diffs when I tried to visualise progression of slovak law. My best attempt was a diff method that would understand the inner structure of the law. I ended up with simple draft but I am sure somebody more competent could look into that.

At least in the US, a lot of the laws that get passed are in the form of diffs.

That is, the law that they enact says "This law is to do blah blah blah.

Subsection 1373(a) of the US code is replaced with the following text 'blah blah blah'"

The wording used is pretty standard. So you can actually parse it in most cases to see what the actual changes are.

Re: The entire US Code is now online in XML

#143
post #127

Earlier quoted context omitted.

Remember that diff is an algorithm to generate the smallest set of operations to produce version B from version A, not an accurate reconstruction of what happened. Diff algorithms are also often tuned not try as hard to find the smallest set of changes for larger documents, due to speed concerns.

I did some work & research about diffs when I tried to visualise progression of slovak law. My best attempt was a diff method that would understand the inner structure of the law. I ended up with simple draft but I am sure somebody more competent could look into that.

[deleted]

Re: The entire US Code is now online in XML

#144
post #113
post #105

Earlier quoted context omitted.

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

I think that's impossible with the current English language, and the fact that human beings disagree about lots of things.

you wouldn't write in English, you'd write it in Lisp.

Re: The entire US Code is now online in XML

#145
post #12

Earlier quoted context omitted.

The law can be interpreted as a set of rules matched against an action in a particular context to determine whether said action is legal. Right now lots of people do this manually. Maybe computers can do it better. If computers can do it better, maybe people could focus on writing new laws and refactoring old ones instead of repeatedly interpreting old laws for each case.

Yup, legal code isn't that different from computer code where a judge is the interpreter and evidence is fed as input. If we could invent a computer interpreter that acts as a judge, laws and contracts being its code might make it obvious to lawyers why it doesn't make sense to allow code to be patented. Every time lawyers would write laws or contracts they would have to avoid using legal ideas that have already been…

Hey, that is one quite interesting idea about law and code. Thanks!

Re: The entire US Code is now online in XML

#146
post #123
post #105

Earlier quoted context omitted.

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

The problem with this is, human beings don't blindly interpret and process laws as code. Human beings can honestly differ in their interpretation of a law, and the accepted interpretation can change over time. Some one, or some body, would have to decide what the 'proper' interpretation of these laws would be, and craft the 'unit tests' such that they correspond to the status quo. Then that someone or some body would…

Not really, as part of making the law - congress needs to go through all possible interpretations and rule out the ones not in the spirit of the law one by one. Then the law is defined by its tests.

Is it okay to collect all XYZ data?

Is it okay to collect anonymous XYZ data?

Is it okay to collect XYZ data and hold it for X days?

Is it okay to store and index but not search a collection of XYZ data?

The law would end up saying something like -

The NSA is permitted to store and index anonymous data for a period of 10 days. Attempts to make anonymous data personal are forbidden. Data may only be accessed with a court issued warrant subject to the following conditions:...

Re: The entire US Code is now online in XML

#147
post #87
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.

It would be even awesome-er (and more useful) if you could parse individual bills and amendments into diffs, which get merged into 'master' as they become law. I'd love to `git blame` the U.S. code.

I wonder if Congress uses any sort of version control. The text of these bills are written by - staffers and sometimes lobbyists, so I'm not sure how it would work.

Re: The entire US Code is now online in XML

#148
post #105

Earlier quoted context omitted.

You make this sound like a bad thing. Would you really prefer "black and white" laws that leave zero room for flexibility or interpretation in light of a given situation?

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

Depends how you define "simpler." There would be a LOT of incredibly specific definitions, since there would be no room for interpretation by a judge.

Consider a law that says "you can't drive a vehicle without a license." Is a bicycle a vehicle? What if it has a motor and weighs a lot? A velomobile? What about a hovercar?

There might be 2,000 laws referencing "vehicle [definition #4,849, version 5]".

(Actually, I guess a sensible definition might be based on momentum: we'll call a tricycle a vehicle if you manage to get it going fast enough; the point is that you can hurt someone with it.)

Re: The entire US Code is now online in XML

#149
post #113

Earlier quoted context omitted.

I think that's impossible with the current English language, and the fact that human beings disagree about lots of things.

you wouldn't write in English, you'd write it in Lisp.

Do you know of any examples of actual legal documents written in Lisp, or some other formal language?

Re: The entire US Code is now online in XML

#150
post #105

Earlier quoted context omitted.

You make this sound like a bad thing. Would you really prefer "black and white" laws that leave zero room for flexibility or interpretation in light of a given situation?

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

> Yes, we should have black and white laws, and unit tests for them.

First problem: I don't think that can be done. I'd be a lot more convinced to consider arguments like this accompanied by completed samples in some real area of human endeavor of the "black and white laws" with accompanying "unit tests" (and, anyway, wouldn't we want automated user acceptance tests, not unit tests.)

Post reply on HN