GET /statutes/coverage endpoint on a schedule, saves a snapshot of each jurisdiction’s corpora counts, and diffs it against the previous snapshot so you can react when a jurisdiction gains a new corpus (for example a state adding regulations) or an existing corpus expands.
Endpoints used: GET /statutes/coverage.
/statutes/coverage is authenticated and rate limited, so run it on a sensible cadence (daily or weekly is plenty) rather than in a tight loop.1
Fetch the coverage matrix
The response is wrapped as A trimmed
{ "data": {...}, "meta": {...} }. Inside data you get a corpusTypes legend and a jurisdictions array, where each jurisdiction carries a corpora object mapping a corpusType token to its ingested chunk count.data payload looks like this:2
Reduce the response to a comparable snapshot
Keep only the fields you want to track. A dictionary keyed by jurisdiction code, holding each jurisdiction’s
corpora map, is compact and easy to diff.Python
3
Save each snapshot to disk
Persist the snapshot as JSON so the next run has a baseline to compare against. Timestamp the file name so you keep a history.
Python
4
Diff the new snapshot against the last one
Compare the two maps to surface three kinds of change: a brand new jurisdiction, a new corpus within a known jurisdiction, and an existing corpus whose count grew.
Python
5
Run it on a schedule
Wire the pieces together into one job you can trigger from cron, a scheduled task, or a worker. It fetches coverage, diffs against the last snapshot, prints what changed, and saves the new baseline.Example output on a run where a state gained regulations:
Python
Related
Compare a rule across states
Run one query across several states and assemble a comparison table.
Enrich a citation database
Attach canonical citations, excerpts, and source links to a batch of topics.
Coverage matrix
The human-readable jurisdiction and corpus matrix.
Best practices
Cache coverage, scope queries, and handle errors well.

