From 72d8c20dcfe360e8ab2d743f62bf9d37f7fd4cb1 Mon Sep 17 00:00:00 2001 From: Andrew Bruce Date: Mon, 9 Dec 2024 18:42:13 -0500 Subject: [PATCH] * removed lifecycle as a dependency * quality payment rewrite --- DESCRIPTION | 4 +- NAMESPACE | 12 +- R/add_counties.R | 38 ++-- R/beneficiaries.R | 5 +- R/betos.R | 7 +- R/clinicians.R | 102 ++++++---- R/generated-globals.R | 11 ++ R/helpers.R | 157 +++++++++++++++ R/hospitals.R | 58 +++--- R/laboratories.R | 6 +- R/ndc.R | 3 - R/open_payments.R | 4 +- R/opt_out.R | 26 ++- R/pending.R | 10 +- R/pins.R | 62 ++++++ R/prescribers.R | 4 +- R/provider-package.R | 4 +- R/providers.R | 11 +- R/quality_eligibility.R | 7 +- R/quality_pay2.R | 388 +++++++++++++++++++++++++++++++++++++ R/quality_payment.R | 8 +- R/reassignments.R | 27 ++- R/taxonomy_crosswalk.R | 7 +- R/utilization.R | 9 +- R/zzz.R | 38 ++-- data-raw/dev/distro.R | 11 ++ data-raw/dev/qual_pmt.R | 2 +- data-raw/pins_internal.R | 24 +++ man/add_counties.Rd | 35 ++-- man/beneficiaries.Rd | 5 +- man/betos.Rd | 7 +- man/clinicians.Rd | 18 +- man/get_pin.Rd | 20 ++ man/hospitals.Rd | 27 ++- man/laboratories.Rd | 6 +- man/list_pins.Rd | 18 ++ man/mount_board.Rd | 18 ++ man/ndc_lookup.Rd | 2 +- man/open_payments.Rd | 4 +- man/opt_out.Rd | 13 +- man/pending.Rd | 5 +- man/prescribers.Rd | 4 +- man/providers.Rd | 5 +- man/quality_eligibility.Rd | 7 +- man/quality_pay2.Rd | 75 +++++++ man/quality_payment.Rd | 18 +- man/reassignments.Rd | 7 +- man/sfcc.Rd | 21 ++ man/taxonomy_crosswalk.Rd | 7 +- man/utilization.Rd | 9 +- man/years_floor.Rd | 26 +++ 51 files changed, 1091 insertions(+), 311 deletions(-) create mode 100644 R/helpers.R create mode 100644 R/pins.R create mode 100644 R/quality_pay2.R create mode 100644 data-raw/pins_internal.R create mode 100644 man/get_pin.Rd create mode 100644 man/list_pins.Rd create mode 100644 man/mount_board.Rd create mode 100644 man/quality_pay2.Rd create mode 100644 man/sfcc.Rd create mode 100644 man/years_floor.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 13001521..d245829d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,7 +24,9 @@ Imports: furrr, httr2, janitor, - lifecycle, + fs, + kit, + pins, lubridate, purrr, rlang (>= 1.1.0), diff --git a/NAMESPACE b/NAMESPACE index bb55d6f1..b4470e2b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ export(distros_open) export(duration_vec) export(gen_data) export(geomean) +export(get_pin) export(gt_check_xmark) export(gt_datadict) export(gt_entype_badge) @@ -26,8 +27,10 @@ export(gt_qmark) export(hospitals) export(laboratories) export(last_dttm) +export(list_pins) export(make_interval) export(medline) +export(mount_board) export(ndc_lookup) export(nppes) export(open_payments) @@ -45,12 +48,14 @@ export(providers) export(qpp_years) export(quality_eligibility) export(quality_eligibility_) +export(quality_pay2) export(quality_payment) export(quality_payment_) export(reassignments) export(ror) export(rx_years) export(rxnorm) +export(sfcc) export(summary_stats) export(taxonomy_crosswalk) export(tidyup) @@ -58,9 +63,14 @@ export(util_years) export(utilization) export(utilization_) export(years_df) +export(years_floor) export(years_vec) import(rlang) +importFrom(collapse,"%=%") importFrom(collapse,"%==%") +importFrom(collapse,.c) +importFrom(collapse,fselect) +importFrom(collapse,get_elem) importFrom(httr2,req_perform) importFrom(httr2,req_perform_parallel) importFrom(httr2,request) @@ -68,7 +78,7 @@ importFrom(httr2,resp_body_json) importFrom(httr2,resp_date) importFrom(httr2,resp_header) importFrom(httr2,resp_headers) -importFrom(lifecycle,deprecated) +importFrom(purrr,map) importFrom(stats,setNames) importFrom(stringi,"%s+%") importFrom(zeallot,"%<-%") diff --git a/R/add_counties.R b/R/add_counties.R index 391da4d4..bd99e1bc 100644 --- a/R/add_counties.R +++ b/R/add_counties.R @@ -1,39 +1,35 @@ #' Add county name, FIPs, and geometry to data frame with zip codes +#' #' @param df data frame +#' #' @param statecol bare column name column containing state abbreviations +#' #' @param zipcol bare column name containing zip codes +#' #' @param add_fips add county FIPS code column, default is `FALSE` +#' #' @param add_geo add county geometry column, default is `FALSE` +#' #' @param as_sf convert tibble to an `{sf}` object, default is `FALSE` #' -#' @examplesIf interactive() +#' @examples +#' # Example data frame containing +#' # state abbreviation and zip code #' -#' # Example data frame containing state abbreviation and zip code -#' ex <- dplyr::tibble(state = "GA", -#' zip = "31605") -#' ex +#' (ex <- dplyr::tibble(state = "GA", zip = "31605")) #' -#' # Adds county name and latitude/longitude +#' # Add county and latitude/longitude #' ex |> add_counties(state, zip) #' -#' # Adds county FIPS -#' ex |> add_counties(state, -#' zip, -#' add_fips = TRUE) +#' # Add county FIPS +#' ex |> add_counties(state, zip, add_fips = TRUE) #' -#' # Adds county `geometry` column, +#' # Add county `geometry` column, #' # based on county FIPS column -#' ex |> add_counties(state, -#' zip, -#' add_fips = TRUE, -#' add_geo = TRUE) +#' ex |> add_counties(state, zip, add_fips = TRUE, add_geo = TRUE) #' -#' # Converts data frame to an `sf` object -#' ex |> add_counties(state, -#' zip, -#' add_fips = TRUE, -#' add_geo = TRUE, -#' as_sf = TRUE) +#' # Convert to an `sf` object +#' ex |> add_counties(state, zip, add_fips = TRUE, add_geo = TRUE, as_sf = TRUE) #' #' @autoglobal #' @export diff --git a/R/beneficiaries.R b/R/beneficiaries.R index 747f810b..a0898390 100644 --- a/R/beneficiaries.R +++ b/R/beneficiaries.R @@ -1,10 +1,7 @@ #' Beneficiary Enrollment in Medicare #' #' @description -#' `r lifecycle::badge("questioning")` -#' -#' [beneficiaries()] allows the user access current data on enrolled Medicare -#' beneficiaries. +#' Access current data on enrolled Medicare beneficiaries. #' #' @section Medicare Monthly Enrollment: #' Current monthly information on the number of Medicare beneficiaries with diff --git a/R/betos.R b/R/betos.R index 1c288f75..f43dfa51 100644 --- a/R/betos.R +++ b/R/betos.R @@ -1,11 +1,8 @@ #' Restructured BETOS Classification for HCPCS #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [betos()] allows the user to group HCPCS codes into clinically -#' meaningful categories based on the original _Berenson-Eggers Type of Service_ -#' (BETOS) classification. +#' Group HCPCS codes into clinically meaningful categories based on the +#' original _Berenson-Eggers Type of Service_ (BETOS) classification. #' #' @section From BETOS to RBCS: #' diff --git a/R/clinicians.R b/R/clinicians.R index 94276960..beb0ab62 100644 --- a/R/clinicians.R +++ b/R/clinicians.R @@ -1,74 +1,92 @@ #' Clinicians Enrolled in Medicare #' -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' [clinicians()] allows you to access information about providers enrolled in -#' Medicare, including the medical school that they attended and the year they graduated +#' @description Access information about providers enrolled in Medicare, +#' including the medical school that they attended and the year they graduated #' #' *Update Frequency:* **Monthly** #' #' @section Links: -#' + [National Downloadable File](https://data.cms.gov/provider-data/dataset/mj5m-pzi6) -#' + [Provider Data Catalog (PDC) Data Dictionary](https://data.cms.gov/provider-data/sites/default/files/data_dictionaries/physician/DOC_Data_Dictionary.pdf) #' +#' * [National Downloadable File](https://data.cms.gov/provider-data/dataset/mj5m-pzi6) +#' * [Provider Data Catalog (PDC) Data Dictionary](https://data.cms.gov/provider-data/sites/default/files/data_dictionaries/physician/DOC_Data_Dictionary.pdf) #' #' @param npi < *integer* > 10-digit Individual National Provider Identifier +#' #' @param pac < *integer* > 10-digit Individual PECOS Associate Control ID +#' #' @param enid < *character* > 15-digit Individual Medicare Enrollment ID +#' #' @param first,middle,last < *character* > Individual provider's name -#' @param gender < *character* > Individual provider's gender; `"F"` (Female) -#' or `"M"` (Male) +#' +#' @param gender < *character* > Individual provider's gender; `"F"` (Female) or +#' `"M"` (Male) +#' #' @param credential Individual provider’s credential +#' #' @param school < *character* > Individual provider’s medical school +#' #' @param grad_year < *integer* > Individual provider’s graduation year +#' #' @param specialty < *character* > Individual provider’s primary medical -#' specialty reported in the selected enrollment +#' specialty reported in the selected enrollment +#' #' @param facility_name < *character* > Name of facility associated with the -#' individual provider -#' @param pac_org < *integer* > 10-digit Organizational PECOS -#' Associate Control ID +#' individual provider +#' +#' @param pac_org < *integer* > 10-digit Organizational PECOS Associate Control +#' ID +#' #' @param city < *character* > Provider's city +#' #' @param state < *character* > Provider's state +#' #' @param zip < *character* > Provider's ZIP code +#' #' @param offset < *integer* > // __default:__ `0L` API pagination +#' #' @param tidy < *boolean* > // __default:__ `TRUE` Tidy output -#' @param na.rm < *boolean* > // __default:__ `TRUE` Remove empty rows and columns +#' +#' @param na.rm < *boolean* > // __default:__ `TRUE` Remove empty rows and +#' columns +#' #' @param ... Empty #' -#' @return A [tibble][tibble::tibble-package] with the columns: -#' -#' |**Field** |**Description** | -#' |:---------------|:-----------------------------------------------------| -#' |`npi` |10-digit individual NPI | -#' |`pac` |10-digit individual PAC ID | -#' |`enid` |15-digit individual enrollment ID | -#' |`first` |Provider's first name | -#' |`middle` |Provider's middle name | -#' |`last` |Provider's last name | -#' |`suffix` |Provider's name suffix | -#' |`gender` |Provider's gender | -#' |`credential` |Provider's credential | -#' |`school` |Provider's medical school | -#' |`grad_year` |Provider's graduation year | -#' |`specialty` |Provider's primary specialty | -#' |`specialty_sec` |Provider's secondary specialty | -#' |`facility_name` |Facility associated with provider | -#' |`pac_org` |Facility's 10-digit PAC ID | -#' |`members` |Number of providers associated with facility's PAC ID | -#' |`address` |Provider's street address | -#' |`city` |Provider's city | -#' |`state` |Provider's state | -#' |`zip` |Provider's zip code | -#' |`phone` |Provider's phone number | -#' |`telehealth` |Indicates if provider offers telehealth services | -#' |`assign_ind` |Indicates if provider accepts Medicare assignment | -#' |`assign_org` |Indicates if facility accepts Medicare assignment | +#' @returns A [tibble][tibble::tibble-package] with the columns: +#' +#' |**Field** |**Description** | +#' |:---------------|:-----------------------------------------------------| +#' |`npi` |10-digit individual NPI | +#' |`pac` |10-digit individual PAC ID | +#' |`enid` |15-digit individual enrollment ID | +#' |`first` |Provider's first name | +#' |`middle` |Provider's middle name | +#' |`last` |Provider's last name | +#' |`suffix` |Provider's name suffix | +#' |`gender` |Provider's gender | +#' |`credential` |Provider's credential | +#' |`school` |Provider's medical school | +#' |`grad_year` |Provider's graduation year | +#' |`specialty` |Provider's primary specialty | +#' |`specialty_sec` |Provider's secondary specialty | +#' |`facility_name` |Facility associated with provider | +#' |`pac_org` |Facility's 10-digit PAC ID | +#' |`members` |Number of providers associated with facility's PAC ID | +#' |`address` |Provider's street address | +#' |`city` |Provider's city | +#' |`state` |Provider's state | +#' |`zip` |Provider's zip code | +#' |`phone` |Provider's phone number | +#' |`telehealth` |Indicates if provider offers telehealth services | +#' |`assign_ind` |Indicates if provider accepts Medicare assignment | +#' |`assign_org` |Indicates if facility accepts Medicare assignment | #' #' @examplesIf interactive() #' clinicians(enid = "I20081002000549") # enid not working +#' #' clinicians(school = "NEW YORK UNIVERSITY SCHOOL OF MEDICINE") +#' #' @autoglobal +#' #' @export clinicians <- function(npi = NULL, pac = NULL, diff --git a/R/generated-globals.R b/R/generated-globals.R index ea9562d5..93a90c00 100644 --- a/R/generated-globals.R +++ b/R/generated-globals.R @@ -102,6 +102,7 @@ utils::globalVariables(c( # "cap", # + # # "category", # @@ -174,6 +175,7 @@ utils::globalVariables(c( "distribution_title", # # + # # # "distro", @@ -287,6 +289,7 @@ utils::globalVariables(c( "npi_type", # "on", + # # "org_id", # @@ -294,6 +297,7 @@ utils::globalVariables(c( "org_name", # "org_pac_id", + # # "org_size", # @@ -310,6 +314,7 @@ utils::globalVariables(c( "organizations_individualScenario", # "organizations_virtualGroups", + # # "participation_type", # @@ -347,6 +352,7 @@ utils::globalVariables(c( "prvdr_ctgry_sbtyp_cd", # "purpose", + # # "qualified", # @@ -361,9 +367,11 @@ utils::globalVariables(c( "rndrng_prvdr_geo_desc", # "rndrng_prvdr_geo_lvl", + # # "score", # + # # "set", # @@ -396,6 +404,7 @@ utils::globalVariables(c( "state_of_travel", # # + # # "status", # @@ -440,6 +449,7 @@ utils::globalVariables(c( "type_1", # "type_of_action", + # # "val", # @@ -466,6 +476,7 @@ utils::globalVariables(c( # # # + # # # # diff --git a/R/helpers.R b/R/helpers.R new file mode 100644 index 00000000..677706a9 --- /dev/null +++ b/R/helpers.R @@ -0,0 +1,157 @@ +#' Years between two dates, rounded down to nearest whole number +#' +#' @param from `` Start date +#' +#' @param to `` End date +#' +#' @returns `` vector; number of years between `from` and `to`, rounded +#' down to nearest whole number +#' +#' @examples +#' years_floor( +#' as.Date("2020-01-01"), +#' as.Date("2020-01-01") + 2057) +#' +#' @autoglobal +#' +#' @export +years_floor <- \(from, to) { + floor( + as.integer( + difftime(to, from, units = "weeks", tz = "UTC") + ) / 52.17857) +} + +#' Is `x` `NULL`? +#' +#' @param x vector +#' +#' @returns `` `TRUE` if `x` is `NULL`, `FALSE` otherwise +#' +#' @autoglobal +#' +#' @noRd +null <- \(x) is.null(x) + +#' Is `x` not `NULL`? +#' +#' @param x vector +#' +#' @returns `` `FALSE` if `x` is `NULL`, `TRUE` otherwise +#' +#' @autoglobal +#' +#' @noRd +not_null <- \(x) !is.null(x) + +#' Is `x` empty? +#' +#' @param x vector +#' +#' @returns `` +#' +#' @autoglobal +#' +#' @noRd +empty <- \(x) vctrs::vec_is_empty(x) + +#' Is `x` `NA`? +#' +#' @param x vector +#' +#' @returns `` +#' +#' @autoglobal +#' +#' @noRd +na <- \(x) cheapr::is_na(x) + +#' Is `x` not `NA`? +#' +#' @param x vector +#' +#' @returns `` +#' +#' @autoglobal +#' +#' @noRd +not_na <- \(x) !na(x) + +#' Detect by Regex +#' +#' @param s `` vector +#' +#' @param p `` regex pattern +#' +#' @returns `` vector the same length as `s` +#' +#' @autoglobal +#' +#' @noRd +rdetect <- \(s, p) stringfish::sf_grepl(s, p, nthreads = 4L) + +#' Remove by Regex +#' +#' @param s `` vector +#' +#' @param p `` regex pattern +#' +#' @param fix `` fixed pattern matching +#' +#' @returns `` vector the same length as `s` +#' +#' @autoglobal +#' +#' @noRd +rremove <- \(s, p, fix = FALSE) stringfish::sf_gsub(s, p, "", nthreads = 4L, fixed = fix) + +#' Count of characters in character vector +#' +#' @param x `` vector +#' +#' @returns `` vector of character counts +#' +#' @autoglobal +#' +#' @noRd +rnchar <- \(x) stringfish::sf_nchar(x, nthreads = 4L) + +#' Convert character vector to stringfish vector +#' +#' @param x `` vector +#' +#' @returns `` vector of class `sf_string` +#' +#' @autoglobal +#' +#' @noRd +sfconv <- \(x) stringfish::sf_convert(x) + +#' Concatenate Vectors +#' +#' @param ... Any number of vectors, coerced to `` vector, if necessary +#' +#' @returns concatenated `` vector +#' +#' @examples +#' sfcc(LETTERS, "A") +#' +#' @autoglobal +#' +#' @export +sfcc <- \(...) stringfish::sfc(...) + +#' Fast ifelse wrapper +#' +#' @param x `` vector +#' +#' @param yes,no Values to return depending on TRUE/FALSE element of `x`. Must +#' be same type and be either length 1 or same length of `x`. +#' +#' @returns vector of same length as `x` and attributes as `yes`. Data values +#' are taken from values of `yes` and `no`. +#' +#' @autoglobal +#' +#' @noRd +iifelse <- \(x, yes, no) kit::iif(test = x, yes = yes, no = no, nThread = 4L) diff --git a/R/hospitals.R b/R/hospitals.R index 05307098..db049e0a 100644 --- a/R/hospitals.R +++ b/R/hospitals.R @@ -1,17 +1,14 @@ #' Hospitals Enrolled in Medicare #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [hospitals()] allows the user to search for information on all hospitals -#' currently enrolled in Medicare. Data returned includes the hospital's -#' sub-group types, legal business name, doing-business-as name, organization -#' type and address. +#' Access information on all hospitals currently enrolled in Medicare. Data +#' returned includes the hospital's sub-group types, legal business name, +#' doing-business-as name, organization type and address. #' #' *Update Frequency:* **Monthly** #' #' @section Links: -#' + [Hospital Enrollments](https://data.cms.gov/provider-characteristics/hospitals-and-other-facilities/hospital-enrollments) +#' * [Hospital Enrollments](https://data.cms.gov/provider-characteristics/hospitals-and-other-facilities/hospital-enrollments) #' #' @param npi `` #' @@ -93,19 +90,19 @@ #' #' Indicates hospital’s subgroup/unit designation: #' -#' + `acute`: Acute Care -#' + `alc_drug`: Alcohol/Drug -#' + `child`: Children's Hospital -#' + `gen`: General -#' + `long`: Long-Term -#' + `short`: Short-Term -#' + `psych`: Psychiatric -#' + `rehab`: Rehabilitation -#' + `swing`: Swing-Bed Approved -#' + `psych_unit`: Psychiatric Unit -#' + `rehab_unit`: Rehabilitation Unit -#' + `spec`: Specialty Hospital -#' + `other`: Not listed on CMS form +#' * `acute`: Acute Care +#' * `alc_drug`: Alcohol/Drug +#' * `child`: Children's Hospital +#' * `gen`: General +#' * `long`: Long-Term +#' * `short`: Short-Term +#' * `psych`: Psychiatric +#' * `rehab`: Rehabilitation +#' * `swing`: Swing-Bed Approved +#' * `psych_unit`: Psychiatric Unit +#' * `rehab_unit`: Rehabilitation Unit +#' * `spec`: Specialty Hospital +#' * `other`: Not listed on CMS form #' #' @param reh `` #' @@ -159,19 +156,20 @@ #' #' hospitals(state = "GA", reh = TRUE) #' -#' hospitals(city = "Savannah", state = "GA") |> -#' dplyr::select(organization, subgroup) +#' hospitals(city = "Savannah", state = "GA") #' -#' hospitals(city = "Savannah", state = "GA", -#' subgroup = list(acute = FALSE)) |> -#' dplyr::select(organization, subgroup) +#' hospitals(city = "Savannah", +#' state = "GA", +#' subgroup = list(acute = FALSE)) #' -#' hospitals(city = "Savannah", state = "GA", -#' subgroup = list(gen = TRUE, -#' rehab = FALSE)) |> -#' dplyr::select(organization, subgroup) +#' hospitals(city = "Savannah", +#' state = "GA", +#' subgroup = list( +#' gen = TRUE, +#' rehab = FALSE)) #' #' @autoglobal +#' #' @export hospitals <- function(npi = NULL, facility_ccn = NULL, @@ -198,7 +196,7 @@ hospitals <- function(npi = NULL, enid_org <- enid_org %nn% check_enid(enid_org, type = "org") zip <- zip %nn% as.character(zip) facility_ccn <- facility_ccn %nn% as.character(facility_ccn) - registration <- registration %nn% rlang::arg_match(registration, c("P", "N")) + registration <- registration %nn% rlang::arg_match0(registration, c("P", "N")) multi_npi <- multi_npi %nn% tf_2_yn(multi_npi) reh <- reh %nn% tf_2_yn(reh) diff --git a/R/laboratories.R b/R/laboratories.R index f8c53a39..ed1a11d9 100644 --- a/R/laboratories.R +++ b/R/laboratories.R @@ -1,10 +1,8 @@ #' Clinical Laboratories #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [laboratories()] allows you to search for information on clinical laboratories -#' including demographics and the type of testing services the facility provides. +#' Access information on clinical laboratories including demographics and +#' the type of testing services the facility provides. #' #' @section Clinical Laboratory Improvement Amendments (CLIA): #' diff --git a/R/ndc.R b/R/ndc.R index 94395225..db077743 100644 --- a/R/ndc.R +++ b/R/ndc.R @@ -1,8 +1,5 @@ #' National Drug Code (NDC) Lookup #' -#' @description -#' `r lifecycle::badge("experimental")` -#' #' @section NDC: #' A National Drug Code (NDC) is a unique 10- or 11-digit, 3-segment numeric #' identifier assigned to each medication listed under Section 510 of the US diff --git a/R/open_payments.R b/R/open_payments.R index fd0bebd4..3fbc7edd 100644 --- a/R/open_payments.R +++ b/R/open_payments.R @@ -1,9 +1,7 @@ #' Relationships with Drug & Medical Device Companies #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [open_payments()] allows the user access to CMS' Open Payments Program API +#' Allows the user access to CMS' Open Payments Program API #' #' The __Open Payments__ program is a national disclosure program that collects and #' publishes information about financial relationships between drug and medical diff --git a/R/opt_out.R b/R/opt_out.R index 78e23c66..02d45c20 100644 --- a/R/opt_out.R +++ b/R/opt_out.R @@ -1,13 +1,10 @@ #' Providers Opted Out of Medicare #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' `opt_out()` allows the user to access information on providers who have -#' decided not to participate in Medicare. +#' Access information on providers who have decided not to participate in Medicare. #' #' @references -#' + [Medicare Opt Out Affidavits API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/opt-out-affidavits) +#' * [Medicare Opt Out Affidavits API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/opt-out-affidavits) #' #' @section Opting Out: #' @@ -20,9 +17,9 @@ #' #' To opt out, a provider must: #' -#' + Be of an *eligible specialty* type -#' + Submit an *opt-out affidavit* to Medicare -#' + Enter into a *private contract* with their Medicare patients, reflecting +#' * Be of an __eligible specialty__ type +#' * Submit an __opt-out affidavit__ to Medicare +#' * Enter into a __private contract__ with their Medicare patients, reflecting #' the agreement that they will pay out-of-pocket and that no one will submit #' the bill to Medicare for reimbursement #' @@ -41,21 +38,30 @@ #' participate in the Medicare program, they must officially withdraw within 90 #' days. DMEPOS suppliers must withdraw within 30 days. #' -#' Providers may *NOT* opt-out if they intend to be a Medicare Advantage +#' Providers may __NOT__ opt-out if they intend to be a Medicare Advantage #' (Part C) provider or furnish services covered by traditional Medicare #' fee-for-service (Part B). #' #' *Update Frequency:* **Monthly** #' #' @param npi < `integer` > 10-digit Opt-out National Provider Identifier +#' #' @param first,last < `character` > Opt-out provider's name +#' #' @param specialty < `character` > Opt-out provider's specialty +#' #' @param address < `character` > Opt-out provider's address +#' #' @param city < `character` > Opt-out provider's city +#' #' @param state < `character` > Opt-out provider's state abbreviation +#' #' @param zip < `character` > Opt-out provider's zip code +#' #' @param order_refer < `boolean` > Indicates order and refer eligibility +#' #' @param tidy < `boolean` > // __default:__ `TRUE` Tidy output +#' #' @param ... Empty #' #' @return A [tibble][tibble::tibble-package] with the columns: @@ -86,7 +92,9 @@ #' pull(npi) |> #' map(\(x) order_refer(npi = x)) |> #' list_rbind() +#' #' @autoglobal +#' #' @export opt_out <- function(npi = NULL, first = NULL, diff --git a/R/pending.R b/R/pending.R index 6b76d371..2e39d56b 100644 --- a/R/pending.R +++ b/R/pending.R @@ -1,15 +1,11 @@ #' Pending Medicare Enrollment Applications #' #' @description -#' `r lifecycle::badge("questioning")` -#' -#' [pending()] allows the user to search for providers with pending Medicare -#' enrollment applications. +#' Search for providers with pending Medicare enrollment applications. #' #' @references -#' -#' + [Medicare Pending Initial Logging and Tracking Physicians API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/pending-initial-logging-and-tracking-physicians) -#' + [Medicare Pending Initial Logging and Tracking Non-Physicians API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/pending-initial-logging-and-tracking-non-physicians) +#' * [Medicare Pending Initial Logging and Tracking Physicians API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/pending-initial-logging-and-tracking-physicians) +#' * [Medicare Pending Initial Logging and Tracking Non-Physicians API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/pending-initial-logging-and-tracking-non-physicians) #' #' @section Update Frequency: #' __QUARTERLY__ diff --git a/R/pins.R b/R/pins.R new file mode 100644 index 00000000..ae2852ae --- /dev/null +++ b/R/pins.R @@ -0,0 +1,62 @@ +#' Mount [pins][pins::pins-package] board +#' +#' @param source `` `"local"` or `"remote"` +#' +#' @returns `` or `` +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +mount_board <- function(source = c("local", "remote")) { + + gh_raw <- \(x) paste0("https://raw.githubusercontent.com/andrewallenbruce/", x) + + source <- match.arg(source) + + switch(source, + local = pins::board_folder(fs::path_package("extdata/pins", package = "provider")), + remote = pins::board_url(gh_raw("provider/master/inst/extdata/pins/")), + stop("Invalid source")) +} + +#' Get a pinned dataset from a [pins][pins::pins-package] board +#' +#' @param pin `` string name of pinned dataset +#' +#' @param ... additional arguments passed to `mount_board()` +#' +#' @returns `` or `` +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +get_pin <- function(pin, ...) { + + board <- mount_board(...) + + pin <- match.arg(pin, list_pins()) + + pins::pin_read(board, pin) +} + +#' List pins from a [pins][pins::pins-package] board +#' +#' @param ... arguments to pass to [mount_board()] +#' +#' @returns `` of [pins][pins::pins-package] +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +list_pins <- function(...) { + + board <- mount_board(...) + + pins::pin_list(board) +} diff --git a/R/prescribers.R b/R/prescribers.R index b93b0042..4a1cc35e 100644 --- a/R/prescribers.R +++ b/R/prescribers.R @@ -1,9 +1,7 @@ #' Prescriber Utilization & Demographics by Year #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [prescribers()] allows access to information on prescription drugs provided +#' Access information on prescription drugs provided #' to Medicare beneficiaries enrolled in Part D (Prescription Drug Coverage), #' by physicians and other health care providers; aggregated by provider, drug #' and geography. diff --git a/R/provider-package.R b/R/provider-package.R index 73ab1bd0..abd17153 100644 --- a/R/provider-package.R +++ b/R/provider-package.R @@ -2,11 +2,11 @@ "_PACKAGE" ## usethis namespace: start -#' @importFrom lifecycle deprecated #' @importFrom zeallot %<-% #' @importFrom stringi %s+% #' @import rlang -#' @importFrom collapse %==% +#' @importFrom purrr map +#' @importFrom collapse %==% get_elem .c %=% fselect #' @importFrom httr2 request req_perform resp_body_json resp_date resp_headers resp_header req_perform_parallel #' @importFrom stats setNames ## usethis namespace: end diff --git a/R/providers.R b/R/providers.R index 8520de09..3e5c8d41 100644 --- a/R/providers.R +++ b/R/providers.R @@ -1,14 +1,11 @@ #' Provider Enrollment in Medicare #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' `providers()` allows you to access enrollment level data on individual and -#' organizational providers that are actively approved to bill Medicare. +#' Access enrollment level data on individual and organizational providers that are actively approved to bill Medicare. #' #' @section Links: -#' + [Provider Enrollment API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/medicare-fee-for-service-public-provider-enrollment) -#' + [Provider Enrollment Data Dictionary](https://data.cms.gov/resources/medicare-fee-for-service-public-provider-enrollment-data-dictionary) +#' * [Provider Enrollment API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/medicare-fee-for-service-public-provider-enrollment) +#' * [Provider Enrollment Data Dictionary](https://data.cms.gov/resources/medicare-fee-for-service-public-provider-enrollment-data-dictionary) #' #' *Update Frequency:* **Quarterly** #' @@ -46,7 +43,9 @@ #' providers(enid = "I20040309000221") #' providers(npi = 1417918293, specialty_code = "14-41") #' providers(pac = 2860305554, gender = "9") +#' #' @autoglobal +#' #' @export providers <- function(npi = NULL, pac = NULL, diff --git a/R/quality_eligibility.R b/R/quality_eligibility.R index 26a27c64..e4d61560 100644 --- a/R/quality_eligibility.R +++ b/R/quality_eligibility.R @@ -1,11 +1,8 @@ #' Quality Payment Program Eligibility #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [quality_eligibility()] allows the user access to information on eligibility -#' in the Merit-based Incentive Payment System (MIPS) and Advanced Alternative -#' Payment Models (APMs) tracks. +#' Access to information on eligibility in the Merit-based Incentive Payment +#' System (MIPS) and Advanced Alternative Payment Models (APMs) tracks. #' #' Data pulled from across CMS is used to create an eligibility determination #' for a clinician. Using what CMS knows about a clinician from their billing diff --git a/R/quality_pay2.R b/R/quality_pay2.R new file mode 100644 index 00000000..47c75bb9 --- /dev/null +++ b/R/quality_pay2.R @@ -0,0 +1,388 @@ +#' Quality Payment Program REWRITE +#' +#' @param year `` // **required** QPP performance year, in `YYYY` format. +#' Run [qpp_years()] to return a vector of the years currently available. +#' +#' @param npi `` 10-digit Individual National Provider Identifier +#' assigned to the clinician when they enrolled in Medicare. Multiple rows for +#' the same NPI indicate multiple TIN/NPI combinations. +#' +#' @param state `` State or US territory code location of the TIN +#' associated with the clinician. +#' +#' @param specialty `` Specialty corresponding to the type of +#' service that the clinician submitted most on their Medicare Part B claims +#' for this TIN/NPI combination. +#' +#' + Nurse Practitioner +#' + Internal Medicine +#' + Physician Assistant +#' + Family Practice +#' + Emergency Medicine +#' + Diagnostic Radiology +#' + Anesthesiology +#' + Neurology +#' + Cardiology +#' +#' @param type `` Participation type; level at which the +#' performance data was collected, submitted or reported for the final score +#' attributed to the clinician; drives most of the data returned. +#' +#' + `"Group"` +#' + `"Individual"` +#' + `"MIPS APM"` +#' +#' @param tidy `` // __default:__ `TRUE` Tidy output +#' +#' @param nest `` // __default:__ `TRUE` Nest `status` & `measures` +#' +#' @param eligibility `` // __default:__ `TRUE` Append results +#' from [quality_eligibility()] +#' +#' @param ... Empty +#' +#' @returns A [tibble][tibble::tibble-package] containing the search results. +#' +#' @examplesIf interactive() +#' quality_pay2(year = "2020", npi = 1144544834) +#' +#' quality_pay2(year = "2022", npi = 1043477615) +#' +#' @autoglobal +#' +#' @export +quality_pay2 <- function(year, + npi = NULL, + state = NULL, + specialty = NULL, + type = NULL, + tidy = FALSE, + nest = FALSE, + eligibility = FALSE, + ...) { + + + stopifnot(not_null(year), is.character(year)) + year <- match.arg(year, as.character(qpp_years())) + + args <- rlang::list2(if (null(npi)) NULL else validate_npi(npi), state, specialty, type) |> + rlang::set_names(c("npi", "practice state or us territory", "clinician specialty", "participation type")) + + # id <- "b3438273-b4a6-44ca-8fb2-9e6026b74642" + + id <- api_years("qpp") |> data.table::as.data.table() + id[year == 2022] + + url <- paste0("https://data.cms.gov/data-api/v1/dataset/", + id, "/data?", encode_param(args)) + + response <- httr2::request(url) |> httr2::req_perform() + + if (vctrs::vec_is_empty(response$body)) { + + cli_args <- dplyr::tribble( + ~x, ~y, + "year", year, + "npi", npi, + "state", state, + "specialty", specialty, + "type", type) |> + tidyr::unnest(cols = c(y)) + + format_cli(cli_args) + return(invisible(NULL)) + } + + results <- httr2::resp_body_json(response, simplifyVector = TRUE) + + if (!tidy) results <- df2chr(results) + + if (tidy) { + results$year <- year + results <- tidyup(results, + int = c("year", + "practice_size", + "years_in_medicare", + "medicare_patients", + "services"), + dbl = c("allowed_charges", + "payment_adjustment_percentage", + "final_score", + "quality_category_score", + "promoting_interoperability_pi_category_score", + "ia_score", + "cost_score", + "complex_patient_bonus", + "quality_improvement_bonus"), + yn = c("engaged", + "opted_into_mips", + "small_practitioner", + "rural_clinician", + "hpsa_clinician", + "ambulatory_surgical_center", + "hospital_based_clinician", + "non_patient_facing", + "facility_based", + "extreme_hardship", + "extreme_hardship_quality", + "quality_bonus", + "extreme_hardship_pi", + "pi_hardship", + "pi_reweighting", + "pi_bonus", + "extreme_hardship_ia", + "ia_study", + "extreme_hardship_cost")) |> + cols_qpp("tidy") # FIXME |> + # dplyr::mutate(participation_type = fct_part(participation_type), + # state = fct_stabb(state)) + + if (nest) { + pcol <- list(q = c('quality_measure_id_', 'quality_measure_score_') %s+% rep(1:10, each = 2), + p = c('pi_measure_id_', 'pi_measure_score_') %s+% rep(1:11, each = 2), + i = c('ia_measure_id_', 'ia_measure_score_') %s+% rep(1:4, each = 2), + c = c('cost_measure_id_', 'cost_measure_score_') %s+% rep(1:2, each = 2)) + + pcol <- unlist(pcol, use.names = FALSE) + + top <- results |> + dplyr::select(-c(dplyr::contains("measure_"), + dplyr::contains("ind_"))) |> + dplyr::arrange(year, participation_type) + + measures <- dplyr::select( + results, + year, + npi, + participation_type, + dplyr::any_of(pcol)) |> + dplyr::arrange(year, participation_type) |> + tidyr::pivot_longer( + cols = dplyr::any_of(pcol), + names_to = c("category", "x", "set", "cat_id"), + names_pattern = "(.*)_(.*)_(.*)_(.)", + values_to = "val") |> + dplyr::filter(!is.na(val)) |> + dplyr::mutate(x = NULL, + cat_id = NULL) |> + tidyr::pivot_wider(names_from = set, + values_from = val, + values_fn = list) |> + tidyr::unnest(c(id, score)) |> + dplyr::mutate(score = as.double(score), + category = fct_measure(category)) |> + dplyr::rename(measure_id = id) |> + tidyr::nest(.by = c(year, npi, participation_type), + .key = "qpp_measures") + + statuses <- dplyr::select(results, + year, + npi, + participation_type, + dplyr::contains("ind_")) |> + dplyr::arrange(year, participation_type) |> + tidyr::pivot_longer( + cols = dplyr::starts_with("ind_"), + names_to = c("x", "qualified"), + names_pattern = "(...)_(.*)", + values_to = "status") |> + dplyr::mutate(x = NULL) |> + dplyr::filter(!is.na(status) & status != FALSE) |> + dplyr::mutate(qualified = fct_status(qualified), + status = NULL) |> + tidyr::nest(.by = c(year, npi, participation_type), + .key = "qpp_status") + + by <- dplyr::join_by(year, npi, participation_type) + + results <- dplyr::left_join(top, measures, by) |> + dplyr::left_join(statuses, by) |> + cols_qpp("nest") |> + dplyr::group_by(year) |> + dplyr::mutate(org_id = dplyr::row_number(), .before = org_size) |> + dplyr::ungroup() + + if (eligibility) { + by = dplyr::join_by(year, npi, org_id) + npi <- unique(results$npi) + elig <- quality_eligibility(year = year, npi = c(npi)) + results <- dplyr::left_join(results, elig, by) |> + cols_qcomb() + } + } + } + return(results) +} + +#' Parallelized [quality_payment()] +#' +#' @param year < *integer* > // **required** Year data was reported, in `YYYY` +#' format. Run [qpp_years()] to return a vector of the years currently available. +#' +#' @param ... Pass arguments to [quality_payment()]. +#' +#' @rdname quality_payment +#' +#' @autoglobal +#' +#' @export +quality_payment_ <- function(year = qpp_years(), ...) { + furrr::future_map_dfr(year, quality_payment, ..., + .options = furrr::furrr_options(seed = NULL)) +} + +#' @autoglobal +#' +#' @noRd +cols_qcomb <- function(df) { + + cols <- c('year', + 'npi', + 'npi_type', + 'first', + 'middle', + 'last', + 'state', + 'first_approved_date', + 'years_in_medicare', + 'participation_type', + 'beneficiaries', + 'services', + 'charges' = 'allowed_charges', + 'final_score', + 'pay_adjust', + 'quality_score', + 'pi_score', + 'ia_score', + 'cost_score', + 'complex_bonus', + 'qi_bonus', + 'qp_status', + 'qp_score_type', + 'ams_mips_eligible', + 'newly_enrolled', + 'is_maqi', + + 'org_id', + 'org_size', + 'org_name', + 'org_address', + 'org_city', + 'org_state', + 'org_zip', + 'org_hosp_vbp_name', + 'org_facility_based', + + 'apms_id', + 'apms_name', + 'apms_entity_name', + 'apms_sub_id', + 'apms_sub_name', + 'apms_relationship', + + 'ind_lvt_status_code', + 'ind_lvt_status_desc', + 'ind_hosp_vbp_score', + + 'specialty', + + 'specialty_desc', + 'specialty_type', + 'specialty_cat', + + 'ind_specialty_code', + 'ind_specialty_desc', + 'ind_specialty_type', + 'ind_specialty_cat', + + 'qpp_status', + 'qpp_measures', + 'ind_status', + 'grp_status', + 'apms_status' + ) + + df |> dplyr::select(dplyr::any_of(cols)) + +} + +#' @autoglobal +#' +#' @noRd +cols_qpp <- function(df, step = c("tidy", "nest")) { + + if (step == "tidy") { + + cols <- c('year', + 'npi', + 'state' = 'practice_state_or_us_territory', + 'org_size' = 'practice_size', + 'specialty' = 'clinician_specialty', + #'med_years' = 'years_in_medicare', + 'participation_type', + 'beneficiaries' = 'medicare_patients', + 'services', + 'allowed_charges', + 'final_score', + 'pay_adjust' = 'payment_adjustment_percentage', + 'quality_score' = 'quality_category_score', + 'pi_score' = 'promoting_interoperability_pi_category_score', + 'ia_score', + 'cost_score', + 'complex_bonus' = 'complex_patient_bonus', + 'qi_bonus' = 'quality_improvement_bonus', + 'ind_quality_bonus' = 'quality_bonus', + 'ind_engaged' = 'engaged', + 'ind_opted_into_mips' = 'opted_into_mips', + 'ind_small_practitioner' = 'small_practitioner', + 'ind_rural' = 'rural_clinician', + 'ind_hpsa' = 'hpsa_clinician', + 'ind_asc' = 'ambulatory_surgical_center', + 'ind_hospital_based' = 'hospital_based_clinician', + 'ind_non_patient_facing' = 'non_patient_facing', + 'ind_facility_based' = 'facility_based', + 'ind_extreme_hardship' = 'extreme_hardship', + 'ind_extreme_hardship_quality' = 'extreme_hardship_quality', + 'ind_extreme_hardship_pi' = 'extreme_hardship_pi', + 'ind_pi_hardship' = 'pi_hardship', + 'ind_pi_reweighting' = 'pi_reweighting', + 'ind_pi_bonus' = 'pi_bonus', + #'pi_cehrt_id', + 'ind_extreme_hardship_ia' = 'extreme_hardship_ia', + 'ind_ia_study' = 'ia_study', + 'ind_extreme_hardship_cost' = 'extreme_hardship_cost', + paste0('quality_measure_id_', 1:10), + paste0('quality_measure_score_', 1:10), + paste0('pi_measure_id_', 1:11), + paste0('pi_measure_score_', 1:11), + paste0('ia_measure_id_', 1:4), + paste0('ia_measure_score_', 1:4), + paste0('cost_measure_id_', 1:2), + paste0('cost_measure_score_', 1:2)) + } + + if (step == "nest") { + + cols <- c('year', + 'npi', + 'state', + 'org_size', + 'specialty', + # 'med_years', + 'participation_type', + 'beneficiaries', + 'services', + 'allowed_charges', + 'final_score', + 'pay_adjust', + 'quality_score', + 'pi_score', + 'ia_score', + 'cost_score', + 'complex_bonus', + 'qi_bonus', + 'qpp_status', + 'qpp_measures') + } + df |> dplyr::select(dplyr::any_of(cols)) +} diff --git a/R/quality_payment.R b/R/quality_payment.R index 31e3ba33..8572ba80 100644 --- a/R/quality_payment.R +++ b/R/quality_payment.R @@ -1,9 +1,7 @@ #' Quality Payment Program Experience #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [quality_payment()] allows the user access to information on participation +#' Allows the user access to information on participation #' and performance in the Merit-based Incentive Payment System (MIPS) and #' Advanced Alternative Payment Models (APMs) tracks. #' @@ -15,7 +13,7 @@ #' TIN/NPI level on what was published in the previous performance year. #' #' @section Links: -#' + [Quality Payment Program Experience](https://data.cms.gov/quality-of-care/quality-payment-program-experience) +#' * [Quality Payment Program Experience](https://data.cms.gov/quality-of-care/quality-payment-program-experience) #' #' @section Update Frequency: #' __Annually__ @@ -24,7 +22,7 @@ NULL #' -#' @param year `` // **required** QPP performance year, in `YYYY`format. +#' @param year `` // **required** QPP performance year, in `YYYY` format. #' Run [qpp_years()] to return a vector of the years currently available. #' #' @param npi `` 10-digit Individual National Provider Identifier diff --git a/R/reassignments.R b/R/reassignments.R index 5c605e96..a47fa8a8 100644 --- a/R/reassignments.R +++ b/R/reassignments.R @@ -1,37 +1,47 @@ #' Reassignment of Benefits #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [reassignments()] returns information about: -#' + Individual providers who are reassigning benefits or are an employee of -#' + Organizational/Group providers who are receiving reassignment of benefits -#' from or are the employer of the individual provider +#' Returns information about: +#' * Individual providers who are reassigning benefits or are an employee of +#' * Organizational/Group providers who are receiving reassignment of benefits from or are the employer of the individual provider #' #' It provides information regarding the physician and the group practice they #' reassign their billing to, including individual employer association counts. #' #' @section Links: -#' + [Medicare Revalidation Reassignment List API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/revalidation-reassignment-list) +#' * [Medicare Revalidation Reassignment List API](https://data.cms.gov/provider-characteristics/medicare-provider-supplier-enrollment/revalidation-reassignment-list) #' #' *Update Frequency:* **Monthly** #' #' @param npi `` __Individual__ 10-digit National Provider Identifier +#' #' @param pac `` __Individual__ 10-digit PECOS Associate Control ID +#' #' @param enid `` __Individual__ 15-digit Medicare Enrollment ID +#' #' @param first,last `` __Individual__ Provider's name +#' #' @param state `` __Individual__ Enrollment state abbreviation +#' #' @param specialty `` __Individual__ Enrollment specialty +#' #' @param organization `` __Organizational__ Legal business name +#' #' @param pac_org `` __Organizational__ 10-digit PECOS Associate Control ID +#' #' @param enid_org `` __Organizational__ 15-digit Medicare Enrollment ID +#' #' @param state_org `` __Organizational__ Enrollment state abbreviation +#' #' @param entry `` Entry type, reassignment (`"R"`) or employment (`"E"`) +#' #' @param tidy `` // __default:__ `TRUE` Tidy output +#' #' @param na.rm `` // __default:__ `TRUE` Remove empty rows and columns +#' #' @param ... Empty #' -#' @return A [tibble][tibble::tibble-package] with the columns: +#' @returns A [tibble][tibble::tibble-package] with the columns: #' #' |**Field** |**Description** | #' |:---------------|:------------------------------------------------------------------| @@ -55,6 +65,7 @@ #' reassignments(pac_org = 3173525888) #' #' @autoglobal +#' #' @export reassignments <- function(npi = NULL, pac = NULL, diff --git a/R/taxonomy_crosswalk.R b/R/taxonomy_crosswalk.R index a05d5443..3b263e96 100644 --- a/R/taxonomy_crosswalk.R +++ b/R/taxonomy_crosswalk.R @@ -1,11 +1,8 @@ #' Taxonomy Code // Medicare Specialty #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' `taxonomy_crosswalk()` allows you to search the types of providers and -#' suppliers eligible for Medicare programs by taxonomy code or Medicare -#' specialty type code. +#' Allows you to search the types of providers and suppliers eligible for +#' Medicare programs by taxonomy code or Medicare specialty type code. #' #' ## Taxonomy Codes #' The **Healthcare Provider Taxonomy Code Set** is a hierarchical HIPAA diff --git a/R/utilization.R b/R/utilization.R index a61d8e6b..e1a55a12 100644 --- a/R/utilization.R +++ b/R/utilization.R @@ -1,12 +1,9 @@ #' Provider Utilization & Demographics by Year #' #' @description -#' `r lifecycle::badge("experimental")` -#' -#' [utilization()] allows access to information on services and -#' procedures provided to Original Medicare (fee-for-service) Part B -#' beneficiaries by physicians and other healthcare professionals; aggregated -#' by provider, service and geography. +#' Access information on services and procedures provided to Original +#' Medicare (fee-for-service) Part B beneficiaries by physicians and other +#' healthcare professionals; aggregated by provider, service and geography. #' #' @section By Provider: #' __type =__`"Provider"`: diff --git a/R/zzz.R b/R/zzz.R index ee0cb003..f46f050d 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -159,18 +159,14 @@ distros_dac <- \() { unname(ids), "?show-reference-ids=true") - resp <- httr2::req_perform_parallel( - purrr::map(urls, httr2::request), + resp <- req_perform_parallel( + map(urls, request), on_error = "continue") |> setNames(names(ids)) - af <- httr2::resp_body_json( - collapse::get_elem(resp, "affiliations"), - simplifyVector = TRUE) + af <- resp_body_json(get_elem(resp, "affiliations"), simplifyVector = TRUE) - cl <- httr2::resp_body_json( - collapse::get_elem(resp, "clinicians"), - simplifyVector = TRUE) + cl <- resp_body_json(get_elem(resp, "clinicians"), simplifyVector = TRUE) affiliations <- list( @@ -215,12 +211,12 @@ distros_open <- function() { "api/1/metastore/schemas/dataset/", "items?show-reference-ids") - resp <- httr2::request(url) |> - httr2::req_perform() |> - httr2::resp_body_json( + resp <- request(url) |> + req_perform() |> + resp_body_json( check_type = FALSE, simplifyVector = TRUE) |> - dplyr::tibble() + data.table::as.data.table() root <- dplyr::reframe( resp, @@ -233,18 +229,16 @@ distros_open <- function() { temporal, periodicity = accrualPeriodicity) - nests <- dplyr::select(resp, identifier, distribution) |> + nests <- fselect(resp, identifier, distribution) |> data.table::as.data.table() |> mlr3misc::unnest("distribution", prefix = "{col}_") |> mlr3misc::unnest("distribution_data", prefix = "{col}_") |> - # collapse::frename(distribution_data_ref = `distribution_data_%Ref:downloadURL`) |> - collapse::fselect( + fselect( identifier, distribution_identifier, distribution_data_title, distribution_data_downloadURL, - distribution_data_describedBy) |> - dplyr::tibble() + distribution_data_describedBy) list( root = root, @@ -256,13 +250,3 @@ distros_open <- function() { # "[SELECT * FROM ", id$distribution$identifier, "]", # encode_param(args, type = "sql"), # "[LIMIT 10000 OFFSET ", offset, "];&show_db_columns") -# -# lastmod <- regmatches( -# lastmod, -# regexpr("[0-9]{2} [A-Za-z]{3} [0-9]{4}", lastmod, perl = TRUE)) |> -# as.Date(format = "%d %b %Y") -# -# resps <- httr2::req_perform_parallel( -# purrr::map(urls, httr2::request), on_error = "continue") |> -# httr2::resps_successes() |> -# httr2::resps_data(\(resp) httr2::resp_body_json(resp, simplifyVector = TRUE)) diff --git a/data-raw/dev/distro.R b/data-raw/dev/distro.R index be5f83d2..76a75299 100644 --- a/data-raw/dev/distro.R +++ b/data-raw/dev/distro.R @@ -140,3 +140,14 @@ unnest_dt2 <- function(tbl, ...) { tbl } + +# +# lastmod <- regmatches( +# lastmod, +# regexpr("[0-9]{2} [A-Za-z]{3} [0-9]{4}", lastmod, perl = TRUE)) |> +# as.Date(format = "%d %b %Y") +# +# resps <- httr2::req_perform_parallel( +# purrr::map(urls, httr2::request), on_error = "continue") |> +# httr2::resps_successes() |> +# httr2::resps_data(\(resp) httr2::resp_body_json(resp, simplifyVector = TRUE)) diff --git a/data-raw/dev/qual_pmt.R b/data-raw/dev/qual_pmt.R index 21c16214..4adbe600 100644 --- a/data-raw/dev/qual_pmt.R +++ b/data-raw/dev/qual_pmt.R @@ -1,4 +1,4 @@ -year = 2022 +year = "2022" npi = 1043477615 state = NULL specialty = NULL diff --git a/data-raw/pins_internal.R b/data-raw/pins_internal.R new file mode 100644 index 00000000..e38e7e53 --- /dev/null +++ b/data-raw/pins_internal.R @@ -0,0 +1,24 @@ +pin_update <- function(x, name, title, description, force = FALSE) { + + board <- pins::board_folder( + here::here("inst/extdata/pins")) + + board |> + pins::pin_write( + x, + name = name, + title = title, + description = description, + type = "qs", + force_identical_write = force) + + board |> pins::write_board_manifest() +} + +delete_pins <- function(pin_names) { + + board <- pins::board_folder( + here::here("inst/extdata/pins")) + + pins::pin_delete(board, names = pin_names) +} diff --git a/man/add_counties.Rd b/man/add_counties.Rd index 50232e41..9fffe2ff 100644 --- a/man/add_counties.Rd +++ b/man/add_counties.Rd @@ -30,33 +30,22 @@ add_counties( Add county name, FIPs, and geometry to data frame with zip codes } \examples{ -\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# Example data frame containing +# state abbreviation and zip code -# Example data frame containing state abbreviation and zip code -ex <- dplyr::tibble(state = "GA", - zip = "31605") -ex +(ex <- dplyr::tibble(state = "GA", zip = "31605")) -# Adds county name and latitude/longitude +# Add county and latitude/longitude ex |> add_counties(state, zip) -# Adds county FIPS -ex |> add_counties(state, - zip, - add_fips = TRUE) +# Add county FIPS +ex |> add_counties(state, zip, add_fips = TRUE) -# Adds county `geometry` column, +# Add county `geometry` column, # based on county FIPS column -ex |> add_counties(state, - zip, - add_fips = TRUE, - add_geo = TRUE) - -# Converts data frame to an `sf` object -ex |> add_counties(state, - zip, - add_fips = TRUE, - add_geo = TRUE, - as_sf = TRUE) -\dontshow{\}) # examplesIf} +ex |> add_counties(state, zip, add_fips = TRUE, add_geo = TRUE) + +# Convert to an `sf` object +ex |> add_counties(state, zip, add_fips = TRUE, add_geo = TRUE, as_sf = TRUE) + } diff --git a/man/beneficiaries.Rd b/man/beneficiaries.Rd index b2fbcb3e..815434f0 100644 --- a/man/beneficiaries.Rd +++ b/man/beneficiaries.Rd @@ -72,10 +72,7 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} - -\code{\link[=beneficiaries]{beneficiaries()}} allows the user access current data on enrolled Medicare -beneficiaries. +Access current data on enrolled Medicare beneficiaries. } \section{Medicare Monthly Enrollment}{ diff --git a/man/betos.Rd b/man/betos.Rd index 26bc1939..b60e5aa8 100644 --- a/man/betos.Rd +++ b/man/betos.Rd @@ -59,11 +59,8 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=betos]{betos()}} allows the user to group HCPCS codes into clinically -meaningful categories based on the original \emph{Berenson-Eggers Type of Service} -(BETOS) classification. +Group HCPCS codes into clinically meaningful categories based on the +original \emph{Berenson-Eggers Type of Service} (BETOS) classification. } \section{From BETOS to RBCS}{ diff --git a/man/clinicians.Rd b/man/clinicians.Rd index a49294b9..4a780dd6 100644 --- a/man/clinicians.Rd +++ b/man/clinicians.Rd @@ -36,8 +36,8 @@ clinicians( \item{first, middle, last}{< \emph{character} > Individual provider's name} -\item{gender}{< \emph{character} > Individual provider's gender; \code{"F"} (Female) -or \code{"M"} (Male)} +\item{gender}{< \emph{character} > Individual provider's gender; \code{"F"} (Female) or +\code{"M"} (Male)} \item{credential}{Individual provider’s credential} @@ -51,8 +51,8 @@ specialty reported in the selected enrollment} \item{facility_name}{< \emph{character} > Name of facility associated with the individual provider} -\item{pac_org}{< \emph{integer} > 10-digit Organizational PECOS -Associate Control ID} +\item{pac_org}{< \emph{integer} > 10-digit Organizational PECOS Associate Control +ID} \item{city}{< \emph{character} > Provider's city} @@ -64,7 +64,8 @@ Associate Control ID} \item{tidy}{< \emph{boolean} > // \strong{default:} \code{TRUE} Tidy output} -\item{na.rm}{< \emph{boolean} > // \strong{default:} \code{TRUE} Remove empty rows and columns} +\item{na.rm}{< \emph{boolean} > // \strong{default:} \code{TRUE} Remove empty rows and +columns} \item{...}{Empty} } @@ -98,10 +99,8 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=clinicians]{clinicians()}} allows you to access information about providers enrolled in -Medicare, including the medical school that they attended and the year they graduated +Access information about providers enrolled in Medicare, +including the medical school that they attended and the year they graduated \emph{Update Frequency:} \strong{Monthly} } @@ -116,6 +115,7 @@ Medicare, including the medical school that they attended and the year they grad \examples{ \dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} clinicians(enid = "I20081002000549") # enid not working + clinicians(school = "NEW YORK UNIVERSITY SCHOOL OF MEDICINE") \dontshow{\}) # examplesIf} } diff --git a/man/get_pin.Rd b/man/get_pin.Rd new file mode 100644 index 00000000..b4948bc9 --- /dev/null +++ b/man/get_pin.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pins.R +\name{get_pin} +\alias{get_pin} +\title{Get a pinned dataset from a \link[pins:pins-package]{pins} board} +\usage{ +get_pin(pin, ...) +} +\arguments{ +\item{pin}{\verb{} string name of pinned dataset} + +\item{...}{additional arguments passed to \code{mount_board()}} +} +\value{ +\verb{} or \verb{} +} +\description{ +Get a pinned dataset from a \link[pins:pins-package]{pins} board +} +\keyword{internal} diff --git a/man/hospitals.Rd b/man/hospitals.Rd index 559a15e1..458ba66e 100644 --- a/man/hospitals.Rd +++ b/man/hospitals.Rd @@ -171,12 +171,9 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=hospitals]{hospitals()}} allows the user to search for information on all hospitals -currently enrolled in Medicare. Data returned includes the hospital's -sub-group types, legal business name, doing-business-as name, organization -type and address. +Access information on all hospitals currently enrolled in Medicare. Data +returned includes the hospital's sub-group types, legal business name, +doing-business-as name, organization type and address. \emph{Update Frequency:} \strong{Monthly} } @@ -193,16 +190,16 @@ hospitals(pac_org = 6103733050) hospitals(state = "GA", reh = TRUE) -hospitals(city = "Savannah", state = "GA") |> - dplyr::select(organization, subgroup) +hospitals(city = "Savannah", state = "GA") -hospitals(city = "Savannah", state = "GA", - subgroup = list(acute = FALSE)) |> - dplyr::select(organization, subgroup) +hospitals(city = "Savannah", + state = "GA", + subgroup = list(acute = FALSE)) -hospitals(city = "Savannah", state = "GA", - subgroup = list(gen = TRUE, - rehab = FALSE)) |> - dplyr::select(organization, subgroup) +hospitals(city = "Savannah", + state = "GA", + subgroup = list( + gen = TRUE, + rehab = FALSE)) \dontshow{\}) # examplesIf} } diff --git a/man/laboratories.Rd b/man/laboratories.Rd index 33304c58..18379308 100644 --- a/man/laboratories.Rd +++ b/man/laboratories.Rd @@ -52,10 +52,8 @@ laboratories( A \link[tibble:tibble-package]{tibble} containing the search results. } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=laboratories]{laboratories()}} allows you to search for information on clinical laboratories -including demographics and the type of testing services the facility provides. +Access information on clinical laboratories including demographics and +the type of testing services the facility provides. } \section{Clinical Laboratory Improvement Amendments (CLIA)}{ diff --git a/man/list_pins.Rd b/man/list_pins.Rd new file mode 100644 index 00000000..b11d7e6a --- /dev/null +++ b/man/list_pins.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pins.R +\name{list_pins} +\alias{list_pins} +\title{List pins from a \link[pins:pins-package]{pins} board} +\usage{ +list_pins(...) +} +\arguments{ +\item{...}{arguments to pass to \code{\link[=mount_board]{mount_board()}}} +} +\value{ +\verb{} of \link[pins:pins-package]{pins} +} +\description{ +List pins from a \link[pins:pins-package]{pins} board +} +\keyword{internal} diff --git a/man/mount_board.Rd b/man/mount_board.Rd new file mode 100644 index 00000000..afa9151c --- /dev/null +++ b/man/mount_board.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pins.R +\name{mount_board} +\alias{mount_board} +\title{Mount \link[pins:pins-package]{pins} board} +\usage{ +mount_board(source = c("local", "remote")) +} +\arguments{ +\item{source}{\verb{} \code{"local"} or \code{"remote"}} +} +\value{ +\verb{} or \verb{} +} +\description{ +Mount \link[pins:pins-package]{pins} board +} +\keyword{internal} diff --git a/man/ndc_lookup.Rd b/man/ndc_lookup.Rd index ee8763e0..5acc5db1 100644 --- a/man/ndc_lookup.Rd +++ b/man/ndc_lookup.Rd @@ -29,7 +29,7 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +National Drug Code (NDC) Lookup } \section{NDC}{ diff --git a/man/open_payments.Rd b/man/open_payments.Rd index 1f23e818..aa5b2b31 100644 --- a/man/open_payments.Rd +++ b/man/open_payments.Rd @@ -96,9 +96,7 @@ format. Run \code{\link[=open_years]{open_years()}} to return a vector of the ye A \link[tibble:tibble-package]{tibble} containing the search results. } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=open_payments]{open_payments()}} allows the user access to CMS' Open Payments Program API +Allows the user access to CMS' Open Payments Program API The \strong{Open Payments} program is a national disclosure program that collects and publishes information about financial relationships between drug and medical diff --git a/man/opt_out.Rd b/man/opt_out.Rd index a19b357b..2f9b3b2c 100644 --- a/man/opt_out.Rd +++ b/man/opt_out.Rd @@ -57,10 +57,7 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{opt_out()} allows the user to access information on providers who have -decided not to participate in Medicare. +Access information on providers who have decided not to participate in Medicare. } \section{Opting Out}{ @@ -74,9 +71,9 @@ the provider out-of-pocket. To opt out, a provider must: \itemize{ -\item Be of an \emph{eligible specialty} type -\item Submit an \emph{opt-out affidavit} to Medicare -\item Enter into a \emph{private contract} with their Medicare patients, reflecting +\item Be of an \strong{eligible specialty} type +\item Submit an \strong{opt-out affidavit} to Medicare +\item Enter into a \strong{private contract} with their Medicare patients, reflecting the agreement that they will pay out-of-pocket and that no one will submit the bill to Medicare for reimbursement } @@ -98,7 +95,7 @@ If a provider retires, surrenders their license, or no longer wants to participate in the Medicare program, they must officially withdraw within 90 days. DMEPOS suppliers must withdraw within 30 days. -Providers may \emph{NOT} opt-out if they intend to be a Medicare Advantage +Providers may \strong{NOT} opt-out if they intend to be a Medicare Advantage (Part C) provider or furnish services covered by traditional Medicare fee-for-service (Part B). diff --git a/man/pending.Rd b/man/pending.Rd index f1db145e..b3f5c1e3 100644 --- a/man/pending.Rd +++ b/man/pending.Rd @@ -42,10 +42,7 @@ A \code{\link[=tibble]{tibble()}} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} - -\code{\link[=pending]{pending()}} allows the user to search for providers with pending Medicare -enrollment applications. +Search for providers with pending Medicare enrollment applications. } \section{Update Frequency}{ diff --git a/man/prescribers.Rd b/man/prescribers.Rd index afb3199c..afef1c9f 100644 --- a/man/prescribers.Rd +++ b/man/prescribers.Rd @@ -104,9 +104,7 @@ the National Drug Codes (NDCs) from PDEs to a drug information database.} \item{...}{Pass arguments to \code{\link[=prescribers]{prescribers()}}.} } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=prescribers]{prescribers()}} allows access to information on prescription drugs provided +Access information on prescription drugs provided to Medicare beneficiaries enrolled in Part D (Prescription Drug Coverage), by physicians and other health care providers; aggregated by provider, drug and geography. diff --git a/man/providers.Rd b/man/providers.Rd index 60b40c5f..ef12c011 100644 --- a/man/providers.Rd +++ b/man/providers.Rd @@ -64,10 +64,7 @@ providers( } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{providers()} allows you to access enrollment level data on individual and -organizational providers that are actively approved to bill Medicare. +Access enrollment level data on individual and organizational providers that are actively approved to bill Medicare. } \section{Links}{ diff --git a/man/quality_eligibility.Rd b/man/quality_eligibility.Rd index 25f52000..d78ff1cf 100644 --- a/man/quality_eligibility.Rd +++ b/man/quality_eligibility.Rd @@ -42,11 +42,8 @@ the same NPI indicate multiple TIN/NPI combinations.} A \link[tibble:tibble-package]{tibble} containing the search results. } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=quality_eligibility]{quality_eligibility()}} allows the user access to information on eligibility -in the Merit-based Incentive Payment System (MIPS) and Advanced Alternative -Payment Models (APMs) tracks. +Access to information on eligibility in the Merit-based Incentive Payment +System (MIPS) and Advanced Alternative Payment Models (APMs) tracks. Data pulled from across CMS is used to create an eligibility determination for a clinician. Using what CMS knows about a clinician from their billing diff --git a/man/quality_pay2.Rd b/man/quality_pay2.Rd new file mode 100644 index 00000000..df4526ab --- /dev/null +++ b/man/quality_pay2.Rd @@ -0,0 +1,75 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/quality_pay2.R +\name{quality_pay2} +\alias{quality_pay2} +\title{Quality Payment Program REWRITE} +\usage{ +quality_pay2( + year, + npi = NULL, + state = NULL, + specialty = NULL, + type = NULL, + tidy = FALSE, + nest = FALSE, + eligibility = FALSE, + ... +) +} +\arguments{ +\item{year}{\verb{} // \strong{required} QPP performance year, in \code{YYYY} format. +Run \code{\link[=qpp_years]{qpp_years()}} to return a vector of the years currently available.} + +\item{npi}{\verb{} 10-digit Individual National Provider Identifier +assigned to the clinician when they enrolled in Medicare. Multiple rows for +the same NPI indicate multiple TIN/NPI combinations.} + +\item{state}{\verb{} State or US territory code location of the TIN +associated with the clinician.} + +\item{specialty}{\verb{} Specialty corresponding to the type of +service that the clinician submitted most on their Medicare Part B claims +for this TIN/NPI combination. +\itemize{ +\item Nurse Practitioner +\item Internal Medicine +\item Physician Assistant +\item Family Practice +\item Emergency Medicine +\item Diagnostic Radiology +\item Anesthesiology +\item Neurology +\item Cardiology +}} + +\item{type}{\verb{} Participation type; level at which the +performance data was collected, submitted or reported for the final score +attributed to the clinician; drives most of the data returned. +\itemize{ +\item \code{"Group"} +\item \code{"Individual"} +\item \code{"MIPS APM"} +}} + +\item{tidy}{\verb{} // \strong{default:} \code{TRUE} Tidy output} + +\item{nest}{\verb{} // \strong{default:} \code{TRUE} Nest \code{status} & \code{measures}} + +\item{eligibility}{\verb{} // \strong{default:} \code{TRUE} Append results +from \code{\link[=quality_eligibility]{quality_eligibility()}}} + +\item{...}{Empty} +} +\value{ +A \link[tibble:tibble-package]{tibble} containing the search results. +} +\description{ +Quality Payment Program REWRITE +} +\examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +quality_pay2(year = "2020", npi = 1144544834) + +quality_pay2(year = "2022", npi = 1043477615) +\dontshow{\}) # examplesIf} +} diff --git a/man/quality_payment.Rd b/man/quality_payment.Rd index 3976dc79..82a75cc2 100644 --- a/man/quality_payment.Rd +++ b/man/quality_payment.Rd @@ -1,10 +1,12 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/quality_payment.R -\name{quality_payment} -\alias{quality_payment} +% Please edit documentation in R/quality_pay2.R, R/quality_payment.R +\name{quality_payment_} \alias{quality_payment_} -\title{Quality Payment Program Experience} +\alias{quality_payment} +\title{Parallelized \code{\link[=quality_payment]{quality_payment()}}} \usage{ +quality_payment_(year = qpp_years(), ...) + quality_payment( year, npi = NULL, @@ -23,6 +25,8 @@ quality_payment_(year = qpp_years(), ...) \item{year}{< \emph{integer} > // \strong{required} Year data was reported, in \code{YYYY} format. Run \code{\link[=qpp_years]{qpp_years()}} to return a vector of the years currently available.} +\item{...}{Pass arguments to \code{\link[=quality_payment]{quality_payment()}}.} + \item{npi}{\verb{} 10-digit Individual National Provider Identifier assigned to the clinician when they enrolled in Medicare. Multiple rows for the same NPI indicate multiple TIN/NPI combinations.} @@ -60,16 +64,12 @@ attributed to the clinician; drives most of the data returned. \item{eligibility}{\verb{} // \strong{default:} \code{TRUE} Append results from \code{\link[=quality_eligibility]{quality_eligibility()}}} - -\item{...}{Pass arguments to \code{\link[=quality_payment]{quality_payment()}}.} } \value{ A \link[tibble:tibble-package]{tibble} containing the search results. } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=quality_payment]{quality_payment()}} allows the user access to information on participation +Allows the user access to information on participation and performance in the Merit-based Incentive Payment System (MIPS) and Advanced Alternative Payment Models (APMs) tracks. } diff --git a/man/reassignments.Rd b/man/reassignments.Rd index d44c1094..704b3ec4 100644 --- a/man/reassignments.Rd +++ b/man/reassignments.Rd @@ -68,13 +68,10 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=reassignments]{reassignments()}} returns information about: +Returns information about: \itemize{ \item Individual providers who are reassigning benefits or are an employee of -\item Organizational/Group providers who are receiving reassignment of benefits -from or are the employer of the individual provider +\item Organizational/Group providers who are receiving reassignment of benefits from or are the employer of the individual provider } It provides information regarding the physician and the group practice they diff --git a/man/sfcc.Rd b/man/sfcc.Rd new file mode 100644 index 00000000..cb57d876 --- /dev/null +++ b/man/sfcc.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers.R +\name{sfcc} +\alias{sfcc} +\title{Concatenate Vectors} +\usage{ +sfcc(...) +} +\arguments{ +\item{...}{Any number of vectors, coerced to \verb{} vector, if necessary} +} +\value{ +concatenated \verb{} vector +} +\description{ +Concatenate Vectors +} +\examples{ +sfcc(LETTERS, "A") + +} diff --git a/man/taxonomy_crosswalk.Rd b/man/taxonomy_crosswalk.Rd index e696f55c..339fd7c5 100644 --- a/man/taxonomy_crosswalk.Rd +++ b/man/taxonomy_crosswalk.Rd @@ -39,11 +39,8 @@ A \link[tibble:tibble-package]{tibble} with the columns:\tabular{ll}{ } } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{taxonomy_crosswalk()} allows you to search the types of providers and -suppliers eligible for Medicare programs by taxonomy code or Medicare -specialty type code. +Allows you to search the types of providers and suppliers eligible for +Medicare programs by taxonomy code or Medicare specialty type code. \subsection{Taxonomy Codes}{ The \strong{Healthcare Provider Taxonomy Code Set} is a hierarchical HIPAA diff --git a/man/utilization.Rd b/man/utilization.Rd index d9f0774f..61f19cf4 100644 --- a/man/utilization.Rd +++ b/man/utilization.Rd @@ -110,12 +110,9 @@ Classifications to HCPCS codes} \item{...}{Pass arguments to \code{\link[=utilization]{utilization()}}.} } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} - -\code{\link[=utilization]{utilization()}} allows access to information on services and -procedures provided to Original Medicare (fee-for-service) Part B -beneficiaries by physicians and other healthcare professionals; aggregated -by provider, service and geography. +Access information on services and procedures provided to Original +Medicare (fee-for-service) Part B beneficiaries by physicians and other +healthcare professionals; aggregated by provider, service and geography. } \section{By Provider}{ diff --git a/man/years_floor.Rd b/man/years_floor.Rd new file mode 100644 index 00000000..7a8be05b --- /dev/null +++ b/man/years_floor.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers.R +\name{years_floor} +\alias{years_floor} +\title{Years between two dates, rounded down to nearest whole number} +\usage{ +years_floor(from, to) +} +\arguments{ +\item{from}{\verb{} Start date} + +\item{to}{\verb{} End date} +} +\value{ +\verb{} vector; number of years between \code{from} and \code{to}, rounded +down to nearest whole number +} +\description{ +Years between two dates, rounded down to nearest whole number +} +\examples{ +years_floor( + as.Date("2020-01-01"), + as.Date("2020-01-01") + 2057) + +}