judgelord / regulationsdotgov

a package to get data from regulations.gov
https://judgelord.github.io/regulationsdotgov/
MIT License
0 stars 0 forks source link

regulationsdotgov

Get data from regulations.gov

Installation

You can install the development version of regulationsdotgov from GitHub with:

# install.packages("pak")
pak::pak("judgelord/regulationsdotgov")
library(regulationsdotgov)

Metadata

Regulations.gov metadata is organized in a hierarchical database.

The regulationsdotgov package is organized with a parallel set of functions to retrieve metadata:

Get dockets from an agency

# you need an API key
source("~/api-key.R")

# get FBI dockets
FBI_dockets <- get_dockets("FBI")

head(FBI_dockets)[[1]]$data # FIXME we should not need the [[1]]$data when this no longer returns a list
#>               id    type attributes.docketType attributes.lastModifiedDate attributes.highlightedContent attributes.agencyId
#> 1  FBI-2024-0001 dockets            Rulemaking        2024-07-26T09:29:34Z                            NA                 FBI
#> 2  FBI-2023-0001 dockets            Rulemaking        2024-01-26T09:17:09Z                            NA                 FBI
#> 3 FBI_FRDOC_0001 dockets            Rulemaking        2023-08-25T08:08:48Z                            NA                 FBI
#> 4  FBI-2013-0001 dockets            Rulemaking        2021-05-02T01:06:49Z                            NA                 FBI
#> 5  FBI-2008-0001 dockets            Rulemaking        2021-05-02T01:06:49Z                            NA                 FBI
#> 6  FBI-2008-0003 dockets         Nonrulemaking        2021-05-02T01:06:49Z                            NA                 FBI
#> 7  FBI-2016-0001 dockets            Rulemaking        2021-05-02T01:06:49Z                            NA                 FBI
#> 8  FBI-2008-0002 dockets            Rulemaking        2014-11-05T13:55:47Z                            NA                 FBI
#> 9  FBI-2011-0001 dockets            Rulemaking        2011-11-08T11:21:06Z                            NA                 FBI
#>                                                                                                    attributes.title attributes.objectId                                                  self
#> 1 Bipartisan Safer Communities Act -- Access to Records of Stolen Firearms in the National Crime Information Center    0b000064865d93e3  https://api.regulations.gov/v4/dockets/FBI-2024-0001
#> 2                                   Child Protection Improvements Act Criteria for Designated Entity Determinations    0b00006485f05dad  https://api.regulations.gov/v4/dockets/FBI-2023-0001
#> 3                                                                            Recently Posted FBI Rules and Notices.    0b00006481939821 https://api.regulations.gov/v4/dockets/FBI_FRDOC_0001
#> 4                                                              National Instant Criminal Background\r\nCheck System    0b000064811e5c8c  https://api.regulations.gov/v4/dockets/FBI-2013-0001
#> 5                                                      FBI Criminal Justice Information Services Division User Fees    0b0000648062f3e1  https://api.regulations.gov/v4/dockets/FBI-2008-0001
#> 6                                     FBI Records Management Division National Name Check Program Section User Fees    0b000064807284a0  https://api.regulations.gov/v4/dockets/FBI-2008-0003
#> 7                                                                     National Environmental Policy Act\nProcedures    0b0000648201ffea  https://api.regulations.gov/v4/dockets/FBI-2016-0001
#> 8                                                          National Motor Vehicle Title Information System (NMVTIS)    0b0000648071e23f  https://api.regulations.gov/v4/dockets/FBI-2008-0002
#> 9                                                  Federal Bureau of Investigation Anti-Piracy Warning Seal Program    0b00006480f1cd29  https://api.regulations.gov/v4/dockets/FBI-2011-0001

Get documents from a docket folder

Get metadata for comments on a document or docket

Get detailed metadata about a comment

get_comment_details("[comment_id]") retrieves comments on a specific document (e.g., a specific proposed rule)

Search

The package also contains functions to use the API’s search function to search the text of documents or comments:

Download

Finally, using URLs returned from get_documents() and get_comment_details(), we can download files (e.g., pdfs)

To specify your own file structure, simply use the base download function

Important notes