• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    Python
  • License
    Creative Commons ...
  • Created about 12 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A working parser for the US Code's hierarchy, and a work-in-progress parser for the full content.

Parsing the US Code

A parser for the US Code's structure, and a work-in-progress parser for the US Code's full content.

Setup

Create a virtual environment:

virtualenv virt
source virt/bin/activate
pip install -r requirements.txt

Getting the structure of the Code

To output the hierarchy of the US Code to STDOUT, in JSON:

./run structure

The script will first download the

Options:

  • --year: "uscprelim" (the default), or a specific year version of the Code (e.g. "2011")
  • --title: Do only a specific title (e.g. "5", "5a", "25")
  • --sections: Return a flat hierarchy of only titles and sections (no intervening layers)
  • --debug: Output debug messages only, and no JSON output (dry run)
  • --force: Force a re-download of the US Code. Use this flag if you're automatically running the script at an interval.

Example:

[
  {
    "level": "title",
    "name": "GENERAL PROVISIONS",
    "number": "1",
    "subparts": [
      {
        "level": "chapter",
        "name": "RULES OF CONSTRUCTION",
        "number": "1",
        "subparts": [
          {
            "citation": "usc/1/1",
            "level": "section",
            "name": "Words denoting number, gender, and so forth",
            "number": "1"
          },
          {
            "citation": "usc/1/2",
            "level": "section",
            "name": "\u201cCounty\u201d as including \u201cparish\u201d, and so forth",
            "number": "2"
          },
          ...
        ]
      }
    ]
  }
]

Getting the content of the Code (work-in-progress)

To get at the content of the Code:

  • Run download/gpolocator.sh 2011 to download all GPO Locator files for 2011.
  • Run download/pdf.sh to download all pdf files for 2011.

Run the debug script with the title as the first argument and the offset of the parsed node in the parsed title (yes, that makes no sense--just enter a number, like 3).

source virt/bin/activate # if not already activated
./run debug title=[title] offset=[offset]

So to view title 11, section 1, which is the definitions section of the bankruptcy code, run:

./run debug title=11 offset=3

Public domain

This project is dedicated to the public domain. As spelled out in CONTRIBUTING:

The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

More Repositories

1

congress-legislators

Members of the United States Congress, 1789-Present, in YAML/JSON/CSV, as well as committees, presidents, and vice presidents.
Python
1,927
star
2

congress

Public domain data collectors for the work of Congress, including legislation, amendments, and votes.
Python
847
star
3

contact-congress

Sending electronic written messages to members of Congress by reverse engineering their contact forms.
Python
630
star
4

python-us

A package for easily working with US and state metadata
Python
479
star
5

districts

GeoJSON and other shape files for the federal legislative districts of the US.
260
star
6

citation

Legal citation extractor, via command line, JavaScript, or HTTP. See a live example at:
JavaScript
213
star
7

images

Public domain photos of Members of the United States Congress
Python
173
star
8

congressional-record

A parser for the Congressional Record.
HTML
119
star
9

inspectors-general

Collecting reports from Inspectors General across the US federal government.
Python
104
star
10

APIs

A Hub of US Government APIs
CSS
59
star
11

bill-nicknames

Table of popular nicknames and keywords for bills, curated manually.
56
star
12

uslaw.link

A legal citation resolver.
JavaScript
54
star
13

unitedstates.github.io

Simple homepage for this organization.
CSS
50
star
14

glossary

A glossary for the United States.
Ruby
42
star
15

acronym

A library of government acronyms
39
star
16

orgchart

An organization chart for the government of the United States.
37
star
17

federal_spending

Importer for US Spending data
Python
34
star
18

congress-votes-servo

Tracking changes to the official U.S. House and Senate roll call votes XML data files. Monitored hourly-ish by @GovTrack/@JoshData.
HTML
33
star
19

data-seal

Data Seal is a lightweight, UELMA-compliant data authentication service.
HTML
32
star
20

licensing

Best practices language for making open government data "license-free".
HTML
27
star
21

rtyaml

All the annoying stuff we had to do to make YAML usable.
Python
27
star
22

congress-data

Legislative data from the congress repository
19
star
23

complaints

An index of formal complaint systems
17
star
24

wish-list

A wish list for this organization, open an Issue to discuss what we can add. Derived from a News Foo session.
16
star
25

domains

Organizing and publishing the web domains of the US federal government
16
star
26

petitions

White House petition crawler.
Python
15
star
27

data-releases

A listing of public data releases by federal agencies
15
star
28

BillMap

Utilities and applications for the FlatGov project by Demand Progress
JavaScript
14
star
29

legisworks-historical-statutes

Metadata and per-statute PDFs for the U.S. Statutes at Large through volume 64 (1789-1951).
Python
14
star
30

am_mem_law

Documentation & data for the Library of Congress American Memory Century of Lawmaking collection.
Python
12
star
31

agency-regions

A collection of data about how federal agencies divide their agency coverage geospatially
11
star
32

scotus-bound-volumes

11
star
33

chaplains

Text of prayers delivered by guest chaplains to House
Python
11
star
34

reports

Storage space for public US reports which need a place to go.
HTML
10
star
35

statements-of-administration-policy

An archive and scraper of White House Statements of Administration Policy
Python
9
star
36

nabors

Bill numbers for early American statutes based on Nabors's Legislative Reference Checklist book.
Python
8
star
37

congress-publish

Script to publish bill and amendment data as a JSON API.
Python
8
star
38

congress-calendar

A calendar of Congressional events, like committee meetings and votes
6
star
39

data-issues

(NO LONGER USED.)
3
star