Title: | A 'GovInfo' API Wrapper |
---|---|
Description: | Access data provided by the United States Government Publishing Office (GPO) 'GovInfo' API (<https://github.com/usgpo/api>). |
Authors: | William Blackerby [aut, cre, cph] |
Maintainer: | William Blackerby <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.3.9000 |
Built: | 2025-03-20 02:59:41 UTC |
Source: | https://github.com/blackerby/govinfor |
The following params correspond to those listed in the GovInfo API documentation],
but the offset
param is not supported. GovInfo documentation indicates that it was to be deprecated in December,
2022, and though it is still available through the API, the offsetMark
parameter is supported instead. Parameter
descriptions are adapted from GovInfo API documentation.
gpo_collections( collection = NULL, start_date = NULL, end_date = NULL, page_size = 10, doc_class = NULL, congress = NULL, bill_version = NULL, court_code = NULL, court_type = NULL, state = NULL, topic = NULL, is_glp = NULL, nature_suit_code = NULL, nature_suit = NULL, offset_mark = "*" )
gpo_collections( collection = NULL, start_date = NULL, end_date = NULL, page_size = 10, doc_class = NULL, congress = NULL, bill_version = NULL, court_code = NULL, court_type = NULL, state = NULL, topic = NULL, is_glp = NULL, nature_suit_code = NULL, nature_suit = NULL, offset_mark = "*" )
collection |
The collectionCode that you want to retrieve (e.g. BILLS, CREC, FR, PLAW, USCOURTS) |
start_date |
ISO8601 date and time formatted string (yyyy-MM-dd'T'HH:mm:ss'Z') Example: 2018-01-28T20:18:10Z |
end_date |
ISO8601 date and time formatted string (yyyy-MM-dd'T'HH:mm:ss'Z') Example: 2018-01-28T20:18:10Z |
page_size |
The number of records to return for a given request. |
doc_class |
Filter by collection-specific categories, which vary among collections. |
congress |
Filter by Congress, e.g., 116, 117 |
bill_version |
Specific to the |
court_code |
|
court_type |
|
state |
Collection specific. |
topic |
Collection specific. |
is_glp |
Collection specific. |
nature_suit_code |
Collection specific. |
nature_suit |
Collection specific. |
offset_mark |
Indicates starting record for a given request. |
Calling gpo_collections()
without specifying a collection returns metadata about all collections.
A tibble
gpo_collections(collection = "BILLS", start_date = "2024-02-17T00:00:00Z") gpo_collections()
gpo_collections(collection = "BILLS", start_date = "2024-02-17T00:00:00Z") gpo_collections()
The offset
param provide by the API is not supported. GovInfo documentation indicates that it was to
be deprecated in December, 2022, and though it is still available through the API, the offsetMark
parameter
is supported instead. Parameter descriptions are adapted from
GovInfo API documentation.
gpo_package_granules( package_id, page_size = 20, offset_mark = "*", md5 = NULL, granule_class = NULL )
gpo_package_granules( package_id, page_size = 20, offset_mark = "*", md5 = NULL, granule_class = NULL )
package_id |
String. The Package Id. Ex: CREC-2018-01-04 |
page_size |
Integer. The number of records to retrieve per request. Defaults to 20. |
offset_mark |
Indicates starting record for a given request. |
md5 |
String. md5 hash value of the html content file - can be used to identify changes in individual granules for the HOB and CRI collections. |
granule_class |
String. Filter the results by overarching collection-specific categories. Varies by collection. |
A tibble
gpo_package_granules("CREC-2018-01-04")
gpo_package_granules("CREC-2018-01-04")
Given a package id and a granule id, return a metadata summary for the granule.
gpo_package_granules_summary(package_id, granule_id)
gpo_package_granules_summary(package_id, granule_id)
package_id |
String. The Package Id. Ex: CREC-2018-01-04 |
granule_id |
String. The granule ID, e.g. CREC-2018-01-04-pt1-PgD7-2 |
A single row tibble
gpo_package_granules_summary("CREC-2018-01-04", "CREC-2018-01-04-pt1-PgD7-2")
gpo_package_granules_summary("CREC-2018-01-04", "CREC-2018-01-04-pt1-PgD7-2")
Given a GPO package id, return summary metadata for that package.
gpo_package_summary(package_id)
gpo_package_summary(package_id)
package_id |
String. The Package Id. Ex: CREC-2018-01-04 |
A single row tibble.
gpo_package_summary("CREC-2018-01-04")
gpo_package_summary("CREC-2018-01-04")
The following params correspond to those listed in the
GovInfo API documentation, but the offset
param is not
supported. GovInfo documentation indicates that it was to be deprecated in December, 2022, and
though it is still available through the API, the offsetMark
parameter is supported instead.
Parameter descriptions are adapted from GovInfo API documentation.
gpo_published( start_date, end_date = NULL, page_size = 10, collection, congress = NULL, doc_class = NULL, bill_version = NULL, modified_since = NULL, court_code = NULL, court_type = NULL, state = NULL, topic = NULL, nature_suit_code = NULL, nature_suit = NULL, offset_mark = "*", is_glp = NULL )
gpo_published( start_date, end_date = NULL, page_size = 10, collection, congress = NULL, doc_class = NULL, bill_version = NULL, modified_since = NULL, court_code = NULL, court_type = NULL, state = NULL, topic = NULL, nature_suit_code = NULL, nature_suit = NULL, offset_mark = "*", is_glp = NULL )
start_date |
ISO8601 date and time formatted string (yyyy-MM-dd'T'HH:mm:ss'Z') Example: 2018-01-28T20:18:10Z |
end_date |
ISO8601 date and time formatted string (yyyy-MM-dd'T'HH:mm:ss'Z') Example: 2018-01-28T20:18:10Z |
page_size |
The number of records to return for a given request. |
collection |
Filter by GPO collection. |
congress |
Filter by Congress, e.g., 116, 117 |
doc_class |
Filter by collection-specific categories, which vary among collections. |
bill_version |
Specific to the |
modified_since |
Request only packages modified since a given date/time. ISO8601 date and time formatted string (yyyy-MM-dd'T'HH:mm:ss'Z') Example: 2018-01-28T20:18:10Z |
court_code |
|
court_type |
|
state |
Collection specific. |
topic |
Collection specific. |
nature_suit_code |
Collection specific. |
nature_suit |
Collection specific. |
offset_mark |
Indicates starting record for a given request. |
is_glp |
Collection specific. |
A tibble
gpo_published( start_date = "2024-01-01", end_date = "2024-01-03", collection = c("BILLS") )
gpo_published( start_date = "2024-01-01", end_date = "2024-01-03", collection = c("BILLS") )
Adapted, with gratitude, from Christopher Kenny's congress package
has_govinfo_key() get_govinfo_key()
has_govinfo_key() get_govinfo_key()
logical if has
, key if get
has_govinfo_key()
has_govinfo_key()
A callback for use with httr2::req_perform_iterative
next_req(resp, req)
next_req(resp, req)
resp |
Callback response. |
req |
Callback response. |
Adds api.data.gov key to .Renviron
set_govinfo_key(key, overwrite = FALSE, install = FALSE)
set_govinfo_key(key, overwrite = FALSE, install = FALSE)
key |
Character. API key to add. |
overwrite |
Defaults to FALSE. Boolean. Should existing |
install |
Defaults to FALSE. Boolean. Should |
key, invisibly
## Not run: set_govinfo_key("DEMO_KEY") ## End(Not run)
## Not run: set_govinfo_key("DEMO_KEY") ## End(Not run)
A helper for specifying time stamps to the GovInfo API
today()
today()
String. Represents the earliest possible UTC time for today's date.
today()
today()
A helper for specifying time stamps to the GovInfo API
tomorrow()
tomorrow()
String. Represents the earliest possible UTC time for tomorrow's date.
tomorrow()
tomorrow()
A helper for specifying time stamps to the GovInfo API
yesterday()
yesterday()
String. Represents the earliest possible UTC time for the previous day.
yesterday()
yesterday()