Skip to content

About

Spicy Regs goal is to build an open, contributor-friendly platform for exploring and analyzing regulations.gov data, usable by both technical and non-technical users. The platform should enable rapid prototyping, reproducible analysis, and modular app extensions.

Topics

Resources

Contributing

Stars

30 stars

Watchers

0 watching

Forks

Latest commit

 

History

491 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spicy Regs

Spicy Regs

An open, queryable mirror of U.S. federal regulatory data — and the pipeline that builds it.

Civic Tech DC  A Civic Tech DC project

CI Integration License: MIT Python 3.10+ uv Slack

Explore the data · Data dictionary · MCP server · Contributing · Changelog


Every federal rule that gets proposed generates a public record: a docket, the agency's documents, and the comments people file on it. That record is public but awkward to work with — paginated APIs, rate limits, no bulk access, and no way to join it to the rest of the federal picture.

Spicy Regs turns it into files you can query. A nightly pipeline reads regulations.gov data (via the public Mirrulations mirror) plus a dozen complementary federal sources, and publishes the result as Parquet and Apache Iceberg on Cloudflare R2 — public, anonymous read, no API key.

You can query ~25M public comments from a laptop, a browser tab, or an AI assistant, without downloading a database or asking anyone for access.

This repo is the pipeline, the rollups, and the read-only MCP server. It's a Civic Tech DC project and new contributors are welcome — see CONTRIBUTING.md.

Contents

Try it without installing anything

I want to… Go here
Browse dockets, agencies, and comment activity app.spicy-regs.dev
Read every column of every published table docs.spicy-regs.dev
Ask an AI assistant questions about the data MCP server (https://mcp.spicy-regs.dev/mcp)
Run SQL in a notebook Binder or docs/querying-python.md

One line of SQL against the public bucket — no credentials, no download:

-- DuckDB, anywhere: CLI, notebook, or the browser
SELECT agency_code, comment_count
FROM read_parquet('https://data.spicy-regs.dev/agency_stats.parquet')
ORDER BY comment_count DESC
LIMIT 10;

What's in the corpus

Everything is published under https://data.spicy-regs.dev with public, anonymous read. Per-column reference and exact row counts live in the data dictionary — it's generated from the schemas in this repo and kept in sync by CI, so it never drifts from what's actually published.

Core regulations.gov tables

Table What it is Scale
dockets Regulatory proceedings ~276K rows
documents Documents within dockets ~2.0M rows
comments Public comments (Hive-partitioned Parquet + an Iceberg table) ~25.4M rows

Rollups — small, denormalized, meant to be read whole: feed_summary, agency_stats, agency_monthly_volume, docket_daily_comment_volume, comments_index, docket_search, rulemaking_lifecycles, discovery_signals, fr_docket_links, state_program_approvals.

Complementary federal sources — each ingested from its own API so the rulemaking lifecycle, the organizations engaged in it, and its downstream context are all joinable in one place:

  • Lifecycle: federal_register, unified_agenda, oira_reviews, oira_meetings, congress_bills, cfr_sections
  • Organizations & influence: sam_entities, lobbying_filings, fec_committees, org_committee_links
  • Outcomes & context: usaspending_recipients, court_dockets, gao_reports, crs_reports
  • Telecom: fcc_proceedings, fcc_filings

State rulemaking — state_actions, state_stages, state_comments: actions, stages and full-text public comments from the Virginia Regulatory Town Hall, keyed by jurisdiction so later states can share the tables.

Cross-source join keys: RIN, CFR citation, UEI, agency_code. RIN is a real key on the Federal Register / Unified Agenda side (federal_register.regulation_id_numbers_json ↔ unified_agenda.rin; the agenda is a single edition, so not every FR RIN matches), but it is rarely populated on regulations.gov. To get from a RIN to a docket, use fr_docket_links, which carries both regulation_id_numbers_json and docket_id, not dockets.rin. Some sources are deliberately bounded or sampled; the data dictionary documents the scope of each. For example:

  • lobbying_filings is 2024+.
  • usaspending_recipients is the top 100K by award dollars.
  • court_dockets is almost entirely district-court APA cases; rule challenges that a statute routes directly to the courts of appeals are effectively absent.
  • gao_reports accumulates GAO's RSS feed from 2026-07-13 onward and is not Congressional Review Act coverage.

Quickstart

Prerequisites: Python 3.10+ and uv.

git clone https://github.com/civictechdc/spicy-regs.git
cd spicy-regs
uv sync                       # install dependencies into .venv
uv run pytest                 # run the test suite
uv run ruff check .           # lint

No credentials are needed to run the tests, download the published Parquet, or run the pipeline against the public Mirrulations mirror. Copy .env.example to .env only if you want to publish output to Cloudflare R2 or ingest a source that requires an API key.

Working with the data locally

Download the published Parquet with the bundled CLI — no credentials:

uv run spicy-regs download                        # dockets, documents, comments
uv run spicy-regs download --types comments       # comments only
uv run spicy-regs download -o ./my-data           # custom output dir

Files land in ./spicy-regs-data/ by default. Then poke around:

uv run spicy-regs stats                # row counts + top agencies per file
uv run spicy-regs sample comments -n 5 # 5 random rows from comments
uv run spicy-regs search "climate"     # substring search across files
uv run spicy-regs agencies             # list every agency code

Don't want to clone? Run it one-shot: uvx --from "spicy-regs @ git+https://github.com/civictechdc/spicy-regs" spicy-regs download --types comments

For SQL-first exploration, docs/querying-python.md walks through querying the bucket directly with DuckDB.

Running the pipeline yourself

The pipeline reads raw JSON from the public Mirrulations S3 mirror, flattens it, and writes Parquet to ./output/. Scope your first run tight so it finishes in minutes instead of hours:

# Smallest useful run: one agency, recent dockets + documents, no upload.
uv run run-pipeline --agency EPA --skip-comments --since-year 2025

Comments are written only through the R2 Data Catalog, so a run that includes them needs --use-iceberg and the R2_CATALOG_* credentials in .env.

What you get:

  • output/dockets.parquet / output/documents.parquet — merged and deduplicated
  • output/manifest.parquet — a Bloom filter of already-processed source keys, so the next run is incremental. Delete it or pass --full-refresh to rebuild from scratch.

Useful flags (uv run run-pipeline --help for the full list):

Flag What it does
--agency EPA Process a single agency instead of all of them
--since-year 2025 Skip dockets older than the given year
--only-comments Stage comments only (skip dockets + documents)
--skip-comments Inverse — dockets + documents only (much faster)
--max-workers 8 Agencies processed in parallel (default 4)
--full-refresh Ignore the existing manifest and rebuild from scratch
--no-skip-upload Also publish to R2 (needs credentials in .env)
--use-iceberg Route dockets + comments through the R2 Data Catalog (required for comments)
--chunk-size 50000 Bounded-memory comment ingest for very large agencies
--no-enrich-text Skip filling comment text_content from Mirrulations' pre-extracted attachment text

Rollups

Rollups are decoupled from the main ETL — each is its own console script and its own cron workflow, so one failing source can't block the rest:

uv run run-rollup-feed-summary        # derived from the core R2 tables
uv run run-rollup-federal-register    # ingests an external API → its own Parquet

Each defaults to --skip-upload. See CONTRIBUTING.md for the full list and for what adding a new external source touches.

Backfilling comment text

The ETL fills text_content inline only for comments it processes fresh — the incremental manifest skips comments ingested before that feature landed, so they stay NULL. Backfill from Mirrulations' pre-extracted text (read straight from the bucket's derived-data prefix — no PDF download, no JSON re-ingest):

uv run spicy-regs download --types comments     # grab the published parquet
uv run backfill-comment-text                     # fill text_content in place
uv run backfill-comment-text --limit 5000        # cap work for a trial run
uv run backfill-comment-text --upload            # republish to R2 (needs credentials)

It's incremental and re-runnable — rows with a text_extraction_status are skipped unless you pass --overwrite. Document text isn't published to derived-data; backfill those with uv run enrich-pdf-text --target documents.

documents.subtype (NPRM, ANPRM, interim final rule, comment-period extension, ...) is only captured for documents ingested after it was added. Fill it on the rest of the published file by re-reading just that field from the raw JSON:

uv run backfill-document-subtype harvest --limit 5000   # fetch subtypes (resumable)
uv run backfill-document-subtype apply                  # patch output/documents.parquet locally
uv run backfill-document-subtype apply --upload         # republish to R2 (needs credentials)

The Backfill documents.subtype (manual) workflow runs the same two steps.

Working on the data dictionary

uv run spicy-regs-dict check        # verify descriptions match the schema
uv run spicy-regs-dict generate     # regenerate docs/tables/*.md
uv run --group docs mkdocs serve    # preview at 127.0.0.1:8000

Edit descriptions in data_dictionary/descriptions.yaml. CI fails if they drift from the schema.

Use it from an AI assistant

A read-only MCP server exposes SQL over the corpus with list_sources(), describe_table(table), and query_sql(sql). get_rule_text(document, section) reads a rule's actual text from the Federal Register: an outline of its CFR parts and sections first, then any section you ask for. And prepare_comment(docket_id, draft) helps you comment on an open rule: it finds the document taking comments, checks your draft against the 5,000-character limit, and gives you the regulations.gov link. You submit the comment yourself; the server never posts anything.

Client Setup
Claude.ai or any remote MCP client Add https://mcp.spicy-regs.dev/mcp as a Custom Connector. Copy-paste setup for every client is at mcp.spicy-regs.dev.
Claude Code (plugin) /plugin marketplace add civictechdc/spicy-regs then /plugin install spicyregs@spicy-regs-local
Claude Code (stdio, no deploy) claude mcp add spicy-regs -- uvx --from "spicy-regs @ git+https://github.com/civictechdc/spicy-regs" spicy-regs-mcp
Cursor / Continue / OpenAI / others See plugins/spicyregs/INSTALL.md for the full matrix, including a prompt-only fallback for assistants without MCP support.

Project layout

src/spicy_regs/
├── pipelines/        # Pipeline contract, the main ETL, and one module per rollup
│   └── rollups/      # Derived rollups + external-source ingests
├── sources/          # Readers/writers: Mirrulations S3, R2, Iceberg, external APIs
├── transforms/       # Merge, partition, enrich, and the rollup builders
├── manifest.py       # Incremental state (Bloom filter over processed source keys)
├── mcp_server.py     # Read-only SQL MCP server
├── data_dictionary.py# Generates the docs site from the schemas
└── cli.py            # Local data CLI (download / stats / sample / search)

mcp-server/           # MCP server engineering notes (the server itself is src/spicy_regs/mcp_server.py)
scripts/              # Operational tooling (dedupe, seed, freshness checks)
notebooks/            # Example analyses (runnable on Binder)
tests/                # Unit suite; integration tests are opt-in
.github/workflows/    # ETL cron, per-rollup crons, CI, deploys

The ETL is assembled from small composable pieces — Reader → Transform → Writer, wired by a Pipeline. The architecture section of CONTRIBUTING.md explains the contract, and tests/test_example_pipeline.py is a runnable reference for adding your own.

License

MIT © Civic Tech DC.

The underlying data is public U.S. federal government information. Mirrulations S3 is read with unsigned (anonymous) access, and the published Parquet/Iceberg on R2 is openly readable.

Contact

Acknowledgments

  • Mirrulations — the public regulations.gov mirror this pipeline reads from.
  • regulations.gov and the agencies that publish their dockets there.
  • Everyone who has contributed code, issues, and analysis.

Civic Tech DC

Built and maintained by Civic Tech DC — a volunteer community using technology to serve the DC region.

Come build with us.

About

Spicy Regs goal is to build an open, contributor-friendly platform for exploring and analyzing regulations.gov data, usable by both technical and non-technical users. The platform should enable rapid prototyping, reproducible analysis, and modular app extensions.

Topics

Resources

Contributing

Stars

30 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages