Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Nov 18, 2024
1 parent 8ecaa9c commit f46c166
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 230 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Imports:
dplyr,
furrr,
httr2,
ivs,
janitor,
lifecycle,
lubridate,
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ export(hospitals)
export(laboratories)
export(make_interval)
export(medline)
export(meta.funs)
export(meta.json)
export(meta.open)
export(meta.store)
export(ndc_lookup)
export(nppes)
export(open_payments)
Expand Down
32 changes: 16 additions & 16 deletions R/beneficiaries.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
#' period = "July",
#' state = "Georgia")
#'
#' beneficiaries(level = "State",
#' fips = "10")
#' beneficiaries(level = "State", fips = "10")
#'
#' @autoglobal
#' @export
Expand Down Expand Up @@ -112,21 +111,21 @@ beneficiaries <- function(year = NULL,
year <- as.character(year)

if (!is.null(period) && period %in% "Year") {
year <- rlang::arg_match(year, as.character(bene_years("year")))}
year <- rlang::arg_match0(year, as.character(bene_years("Year")))}

if (!is.null(period) && period %in% c("Month", month.name)) {
year <- rlang::arg_match(year, as.character(bene_years("month")))}
year <- rlang::arg_match0(year, as.character(bene_years("Month")))}
}

if (!is.null(period)) {
period <- rlang::arg_match(period, c("Year", "Month", month.name))
period <- rlang::arg_match0(period, c("Year", "Month", month.name))
if (period == "Month") period <- NULL
}

level <- level %nn% rlang::arg_match(level, c("National", "State", "County"))
level <- level %nn% rlang::arg_match0(level, c("National", "State", "County"))

if (!is.null(state)) {
state <- rlang::arg_match(state, c(state.abb, state.name, "US"))
state <- rlang::arg_match0(state, c(state.abb, state.name, "US"))

if (state %in% c(state.name, "United States")) {
state_name <- state
Expand All @@ -137,14 +136,14 @@ beneficiaries <- function(year = NULL,
if (is.null(state)) state_name <- NULL

args <- dplyr::tribble(
~param, ~arg,
"YEAR", year,
"MONTH", period,
"BENE_GEO_LVL", level,
"BENE_STATE_ABRVTN", state,
"BENE_STATE_DESC", state_name,
"BENE_COUNTY_DESC", county,
"BENE_FIPS_CD", fips)
~param, ~arg,
"YEAR", year,
"MONTH", period,
"BENE_GEO_LVL", level,
"BENE_STATE_ABRVTN", state,
"BENE_STATE_DESC", state_name,
"BENE_COUNTY_DESC", county,
"BENE_FIPS_CD", fips)

response <- httr2::request(build_url("ben", args)) |>
httr2::req_perform()
Expand All @@ -162,6 +161,7 @@ beneficiaries <- function(year = NULL,
tidyr::unnest(cols = c(y))

format_cli(cli_args)

return(invisible(NULL))
}

Expand All @@ -173,7 +173,7 @@ beneficiaries <- function(year = NULL,
level = fct_level(level),
state = fct_stabb(state),
state_name = fct_stname(state_name))
if (!is.null(period) && period == "Month") results <- dplyr::filter(results, period %in% month.name)
if (!is.null(period) && period == "Month") results <- dplyr::filter(results, period %in% month.name)
}
return(results)
}
Expand Down
84 changes: 0 additions & 84 deletions R/generated-globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ utils::globalVariables(c(
# <ror>
# <change_year>
":=",
# <meta.store>
"@type",
# <laboratories>
"a2la",
# <laboratories>
"aabb",
# <laboratories>
"accredited",
# <meta.json>
"accrualPeriodicity",
# <mips_2021>
"aco_id_1",
# <mips_2021>
Expand Down Expand Up @@ -162,64 +158,23 @@ utils::globalVariables(c(
"definition",
# <gt_datadict>
"Definition",
# <meta.json>
"describedBy",
# <cms_dataset_search>
# <meta.json>
# <meta.open>
"description",
# <taxonomy_codes>
# <gt_datadict>
"Description",
# <download_nucc_csv>
"display_name",
# <cms_update>
# <meta.json>
# <meta.open>
# <open_ids>
"distribution",
# <meta.open>
"distribution.data",
# <meta.open>
"distribution.data_%Ref:downloadURL",
# <meta.open>
"distribution.data_%Ref:downloadURL.data",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_checksum",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_filePath",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_identifier",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_mimeType",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_perspective",
# <meta.open>
"distribution.data_%Ref:downloadURL.data_version",
# <meta.open>
"distribution.data_%Ref:downloadURL.identifier",
# <meta.open>
"distribution.data_@type",
# <meta.open>
"distribution.data_format",
# <meta.open>
"distribution.data_mediaType",
# <meta.open>
"distribution.data_title",
# <meta.open>
"distribution.identifier",
# <meta.open>
"distribution.title",
# <cms_update>
# <meta.json>
"distribution_accessURL",
# <cms_update>
"distribution_format",
# <cms_update>
# <meta.json>
"distribution_modified",
# <cms_update>
# <meta.json>
"distribution_title",
# <outpatient>
# <prescribers>
Expand Down Expand Up @@ -248,11 +203,6 @@ utils::globalVariables(c(
"five_star_benchmark",
# <hospitals>
"flag",
# <meta.store>
"function_call",
# <meta.store>
# <meta.json>
"function_name",
# <nppes>
# <tidyup_provider.rx>
# <tidyup_provider.util>
Expand Down Expand Up @@ -287,8 +237,6 @@ utils::globalVariables(c(
# <nppes>
"id",
# <cms_dataset_search>
# <meta.store>
# <meta.open>
# <open_payments>
# <open_ids>
"identifier",
Expand All @@ -301,22 +249,13 @@ utils::globalVariables(c(
# <reassignments>
"individual_state_code",
# <make_interval>
# <meta.open>
"interval",
# <mips_2021>
"invs_msr",
# <ccn.facility_ranges>
"is_between",
# <meta.store>
# <meta.open>
"issued",
# <laboratories>
"jcaho",
# <cms_dataset_search>
"keyword",
# <meta.store>
# <meta.json>
"landingPage",
# <compare_hcpcs>
# <tidyup_geography.rx>
# <tidyup_drug.rx>
Expand All @@ -336,9 +275,6 @@ utils::globalVariables(c(
"medical",
# <cms_update>
# <cms_dataset_search>
# <meta.store>
# <meta.json>
# <meta.open>
# <open_ids>
"modified",
# <open_payments>
Expand Down Expand Up @@ -391,14 +327,6 @@ utils::globalVariables(c(
"pay_total",
# <open_payments>
"pdi_1",
# <meta.open>
"period",
# <meta.open>
"period_end",
# <meta.open>
"period_start",
# <meta.open>
"periodicity",
# <laboratories>
"pgm_trmntn_cd",
# <tidyup_geography.util>
Expand All @@ -424,9 +352,6 @@ utils::globalVariables(c(
"prvdr_ctgry_cd",
# <laboratories>
"prvdr_ctgry_sbtyp_cd",
# <meta.store>
# <meta.open>
"publisher",
# <nppes>
"purpose",
# <quality_payment>
Expand All @@ -437,10 +362,6 @@ utils::globalVariables(c(
"recipient_state",
# <reassignments>
"record_type",
# <meta.json>
"references",
# <meta.store>
"released",
# <laboratories>
"rgn_cd",
# <tidyup_geography.util>
Expand Down Expand Up @@ -512,13 +433,10 @@ utils::globalVariables(c(
"taxonomy_grouping",
# <taxonomy_codes>
"taxonomy_specialization",
# <meta.json>
"temporal",
# <quality_eligibility>
"timelength_days",
# <cms_update>
# <cms_dataset_search>
# <meta.open>
# <medline>
# <open_ids>
"title",
Expand All @@ -543,8 +461,6 @@ utils::globalVariables(c(
"type_1",
# <laboratories>
"type_of_action",
# <meta.open>
"update_schedule",
# <quality_payment>
"val",
# <open_payments>
Expand Down
12 changes: 6 additions & 6 deletions R/years.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#'
#' @examples
#' # `beneficiaries()`
#' bene_years(period = "year")
#' bene_years(period = "Year")
#'
#' bene_years(period = "month")
#' bene_years(period = "Month")
#'
#' # `open_payments()`
#' open_years()
Expand Down Expand Up @@ -110,7 +110,7 @@ qpp_years <- function() {
)
}

#' @param period `<chr>` One of `"year"` or `"month"`
#' @param period `<chr>` One of `"Year"` or `"Month"`
#'
#' @rdname years
#'
Expand All @@ -119,18 +119,18 @@ qpp_years <- function() {
#' @autoglobal
#'
#' @export
bene_years <- function(period = c("year", "month")) {
bene_years <- function(period = c("Year", "Month")) {

period <- match.arg(period)

if (period == "year") { # NOT WORKING
if (period == "Year") { # NOT WORKING
out <- beneficiaries(
period = "Year",
level = "National",
tidy = FALSE)$YEAR
}

if (period == "month") {
if (period == "Month") {
out <- beneficiaries(
period = "January",
level = "National",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions man/beneficiaries.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions man/meta.funs.Rd

This file was deleted.

30 changes: 0 additions & 30 deletions man/meta.json.Rd

This file was deleted.

Loading

0 comments on commit f46c166

Please sign in to comment.