{"id":13811206,"url":"https://github.com/unitedstates/uscode","last_synced_at":"2025-05-14T15:31:35.443Z","repository":{"id":4611839,"uuid":"5755423","full_name":"unitedstates/uscode","owner":"unitedstates","description":"A working parser for the US Code's hierarchy, and a work-in-progress parser for the full content.","archived":false,"fork":false,"pushed_at":"2014-06-08T05:08:41.000Z","size":10074,"stargazers_count":104,"open_issues_count":4,"forks_count":20,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-19T05:56:04.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unitedstates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-10T20:27:57.000Z","updated_at":"2024-06-30T02:35:31.000Z","dependencies_parsed_at":"2022-09-13T19:14:44.045Z","dependency_job_id":null,"html_url":"https://github.com/unitedstates/uscode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitedstates%2Fuscode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitedstates%2Fuscode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitedstates%2Fuscode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitedstates%2Fuscode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unitedstates","download_url":"https://codeload.github.com/unitedstates/uscode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254171873,"owners_count":22026532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T03:00:42.130Z","updated_at":"2025-05-14T15:31:30.430Z","avatar_url":"https://github.com/unitedstates.png","language":"Python","funding_links":[],"categories":[":book: Legislative records"],"sub_categories":[],"readme":"## Parsing the US Code\n\nA parser for the US Code's structure, and a work-in-progress parser for the US Code's full content.\n\n\n### Setup\n\nCreate a virtual environment:\n\n```bash\nvirtualenv virt\nsource virt/bin/activate\npip install -r requirements.txt\n```\n\n### Getting the structure of the Code\n\nTo output the hierarchy of the US Code to STDOUT, in JSON:\n\n```bash\n./run structure\n```\n\nThe script will first download the\n\nOptions:\n\n* `--year`: \"uscprelim\" (the default), or a specific year version of the Code (e.g. \"2011\")\n* `--title`: Do only a specific title (e.g. \"5\", \"5a\", \"25\")\n* `--sections`: Return a flat hierarchy of only titles and sections (no intervening layers)\n* `--debug`: Output debug messages only, and no JSON output (dry run)\n* `--force`: Force a re-download of the US Code. Use this flag if you're automatically running the script at an interval.\n\nExample:\n\n```json\n[\n  {\n    \"level\": \"title\",\n    \"name\": \"GENERAL PROVISIONS\",\n    \"number\": \"1\",\n    \"subparts\": [\n      {\n        \"level\": \"chapter\",\n        \"name\": \"RULES OF CONSTRUCTION\",\n        \"number\": \"1\",\n        \"subparts\": [\n          {\n            \"citation\": \"usc/1/1\",\n            \"level\": \"section\",\n            \"name\": \"Words denoting number, gender, and so forth\",\n            \"number\": \"1\"\n          },\n          {\n            \"citation\": \"usc/1/2\",\n            \"level\": \"section\",\n            \"name\": \"\\u201cCounty\\u201d as including \\u201cparish\\u201d, and so forth\",\n            \"number\": \"2\"\n          },\n          ...\n        ]\n      }\n    ]\n  }\n]\n```\n\n### Getting the content of the Code (work-in-progress)\n\nTo get at the content of the Code:\n\n* Run `download/gpolocator.sh 2011` to download all GPO Locator files for 2011.\n* Run download/pdf.sh to download all pdf files for 2011.\n\nRun 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).\n\n```bash\nsource virt/bin/activate # if not already activated\n./run debug title=[title] offset=[offset]\n```\n\nSo to view title 11, section 1, which is the definitions section of the bankruptcy code, run:\n\n```bash\n./run debug title=11 offset=3\n```\n\n## Public domain\n\nThis project is [dedicated to the public domain](LICENSE). As spelled out in [CONTRIBUTING](CONTRIBUTING.md):\n\n\u003e 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](http://creativecommons.org/publicdomain/zero/1.0/).\n\n\u003e 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitedstates%2Fuscode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funitedstates%2Fuscode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitedstates%2Fuscode/lists"}