Skip to content

Vaquill-AI/open-us-law

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open US Law

Open, structured US primary law - plus the scrapers that build it.
State statutory codes, the US Code, the Code of Federal Regulations, state administrative regulations, state and federal constitutions, and court rules - normalized to JSONL, from official government sources only.

US law is public domain. In Georgia v. Public.Resource.Org (2020) the Supreme Court reaffirmed the government-edicts doctrine: statutes, regulations, constitutions, and the official materials legislators produce cannot be copyrighted. Yet clean, structured, bulk access to the compiled 50-state statutory codes does not exist in the open - case law (CourtListener, the Caselaw Access Project) and federal law (govinfo USLM XML) are open, but the state codes sit behind commercial APIs. This project publishes that missing layer, and the tooling to reproduce it.

This README doubles as the table of contents - the file tree is deep, so every scraper is linked below.

Contents


Quick start

pip install -r requirements.txt

# Federal: US Code (USLM XML) and the eCFR
python scripts/federal/download_usc_zips.py --help
python scripts/federal/parse_ecfr_streaming.py --help

# A state statutory code (Colorado, HTTP - no browser needed):
cd scripts/state_scrapers
OUT_DIR=./data python -m src.scrapers.us.states.co.statutes.scrapeCO
#   -> ./data/us_co_statutes.jsonl   (one JSON object per statutory node)

Swap co / scrapeCO for any state in the table below. Each script is self-documenting - run it with --help, or read its module docstring for the exact source and options.

What you get (output format)

Every scraper writes JSONL - one normalized node/section per line - to $OUT_DIR (default ./data). No database, no cloud storage, no credentials. Typical fields:

Field Meaning
id / act_id Stable hierarchical identifier, e.g. us/co/statutes/title=3/article=1/section=3-1-101
citation Human citation, e.g. C.R.S. § 3-1-101
node_name / section_title Heading of the section
node_text / text The statutory text
level_classifier jurisdiction / corpus / title / article / section
link / source_url Back-link to the authoritative government page

Coverage & script index

Federal

Source Script
US Code - download USLM XML zips download_usc_zips.py
US Code - extract zips extract_usc_zips.py
Code of Federal Regulations (eCFR) parse_ecfr_streaming.py
Federal Register (rules) ingest_federal_register_bulk.py
IRS Internal Revenue Bulletin ingest_irs_irb.py
SSA rulings (SSR/AR) ingest_ssa_rulings.py

State statutes (all 50 states)

Run via cd scripts/state_scrapers && OUT_DIR=./data python -m src.scrapers.us.states.<xx>.statutes.scrape<XX>. States marked proxy geo-restrict non-US IPs - see caveats. A few states also have an official-source alternative scraper noted in the last column. The Coverage column is this dataset's per-jurisdiction completeness from the audit in coverage.yml: complete, thin (containers present, sections missing), partial (whole titles missing), or broken; only complete jurisdictions are dump-eligible.

State Statute scraper Coverage Notes
Alaska (ak) scrapeAK.py complete
Alabama (al) scrapeAL.py complete proxy
Arkansas (ar) scrapeAR.py broken
Arizona (az) scrapeAZ.py thin (~78-90%)
California (ca) scrapeCA.py complete
Colorado (co) scrapeCO.py complete
Connecticut (ct) scrapeCT.py complete proxy
Delaware (de) scrapeDE.py complete
Florida (fl) scrapeFL.py thin (~54-70%)
Georgia (ga) scrapeGA.py complete
Hawaii (hi) scrapeHI.py complete
Iowa (ia) scrapeIA.py complete
Idaho (id) scrapeID.py complete
Illinois (il) scrapeIL.py complete
Indiana (in) scrapeIN.py complete proxy
Kansas (ks) scrapeKS.py complete
Kentucky (ky) scrapeKY.py complete
Louisiana (la) scrapeLA.py complete
Massachusetts (ma) scrapeMA.py complete
Maryland (md) scrapeMD.py complete
Maine (me) scrapeME.py thin (~80%)
Michigan (mi) scrapeMI.py thin (~50-65%)
Minnesota (mn) scrapeMN.py complete
Missouri (mo) scrapeMO.py complete
Mississippi (ms) scrapeMS.py complete
Montana (mt) scrapeMT.py complete
North Carolina (nc) scrapeNC.py complete
North Dakota (nd) scrapeND.py complete
Nebraska (ne) scrapeNE.py complete
New Hampshire (nh) scrapeNH.py complete proxy
New Jersey (nj) scrapeNJ.py complete
New Mexico (nm) scrapeNM.py thin (~80-90%)
Nevada (nv) scrapeNV.py review (over-count)
New York (ny) scrapeNY.py thin (~40-50%) proxy
Ohio (oh) scrapeOH.py complete also official-source
Oklahoma (ok) scrapeOK.py thin (~71-84%)
Oregon (or) scrapeOR.py complete
Pennsylvania (pa) scrapePA.py partial (consolidated only)
Rhode Island (ri) scrapeRI.py complete
South Carolina (sc) scrapeSC.py complete
South Dakota (sd) scrapeSD.py partial (~18 of 62 titles)
Tennessee (tn) scrapeTN.py partial (missing 41-71)
Texas (tx) scrapeTX.py complete
Utah (ut) scrapeUT.py complete also official-source
Virginia (va) scrapeVA.py complete
Vermont (vt) scrapeVT.py complete
Washington (wa) scrapeWA.py complete
Wisconsin (wi) scrapeWI.py complete
West Virginia (wv) scrapeWV.py complete
Wyoming (wy) scrapeWY.py thin (~64-78%)

Puerto Rico statutes: ingest_pr_codes.py (LexJuris PDFs). Coverage: partial (3 of 34 LPRA titles).

State regulations

State administrative codes. Some geo-restrict - see caveats.

State Regulations scraper
Colorado (co) ingest_co_regulations.py
Idaho (id) ingest_id_regulations.py
Illinois (il) ingest_il_regulations.py
Kansas (ks) ingest_ks_regulations.py
Kentucky (ky) ingest_ky_regulations.py
Maryland (md) ingest_md_regulations.py
Maine (me) ingest_me_regulations.py
Minnesota (mn) ingest_mn_regulations.py
New Mexico (nm) ingest_nm_regulations.py
Ohio (oh) ingest_oh_regulations.py
South Carolina (sc) ingest_sc_regulations.py
Virginia (va) ingest_va_regulations.py
Washington (wa) ingest_wa_regulations.py
Wisconsin (wi) ingest_wi_regulations.py

State court rules

State Court-rules scraper
Arizona (az) ingest_az_court_rules.py
Maryland (md) ingest_md_court_rules.py
Minnesota (mn) ingest_mn_court_rules.py
Nevada (nv) ingest_nv_court_rules.py
New York (ny) ingest_ny_court_rules.py
Multi-state (CA, MT, …) ingest_state_court_rules.py

Important caveats (please read)

1. Some sources need a US IP / proxy. A number of state sites geo-restrict non-US traffic or throttle aggressively. Those scripts read WEBSHARE_USERNAME / WEBSHARE_PASSWORD (a US rotating proxy) from the environment - see .env.example - or you can run from a US host. State statute scrapers currently needing a proxy: AL, CT, IN, NH, NY (several regulation scrapers too, e.g. MN, WA, WI). If a run returns almost nothing, geo-blocking is the usual cause.

2. Some scripts may stop working over time. These scrapers target live government websites. Those sites get redesigned, move URLs, change HTML, or add anti-bot measures - so a scraper that worked at publish time can break later. When that happens it usually needs a small parser update, not a rewrite. If you hit one, please open an issue or PR; fixes to individual state parsers are exactly where community help compounds.

3. A browser is needed for a few states. Most states use plain HTTP (requests/BeautifulSoup). A handful render statutes via JavaScript and use Selenium - you'll need Chrome/Chromium + chromedriver on your PATH for those. If a scraper imports Selenium and no driver is found, that's why.

4. Snapshots are point-in-time, not current law. Statutes change continuously. Output is an archive as of the run date - always verify a section against its official source before relying on it. This is not legal advice.

Licensing & commercial use

The law itself is public domain (US government edicts - Georgia v. Public.Resource.Org). On top of that:

  • Scripts - Apache-2.0 (LICENSE). Free, including commercial use.
  • Data / compilation - CC BY 4.0 (data/LICENSE.md). Free with attribution.

Need more than the open scrapers? Email [email protected]:

  • Live, always-fresh data + API - no scraping, no breakage; current law, low latency.
  • Retrieval-ready data - pre-chunked, embedded, and citation-linked for RAG.
  • Bulk delivery, SLA, and support.
  • Custom coverage - a jurisdiction or corpus you don't see here.
  • Commercial data license - an attribution waiver and/or warranty & indemnity, if CC BY 4.0's terms don't fit your compliance needs.

Contributing

New-jurisdiction parsers, coverage fixes, and - especially - repairs to state scrapers that broke when a government site changed are welcome. Open a PR against the relevant script in the tables above.

Provenance

All data derives from official government sources (state legislature / secretary-of-state sites, uscode.house.gov, the eCFR, the Federal Register, GPO govinfo). Each record keeps the source URL it was ingested from. The retrieval layer (embeddings, semantic index, citation graph) is intentionally out of scope here.

Maintained by

Vaquill AI. This open corpus is the substrate; Vaquill AI's API adds continuous freshness, retrieval, and citation resolution on top of it.


The law is public. Making it usable should be too.

About

Open, structured corpus of US primary law - state statutory codes, the US Code, CFR, and state constitutions - plus the ingestion pipeline that builds it. Scripts Apache-2.0; data CC BY 4.0. Quarterly dated snapshots.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages