diff --git a/DESCRIPTION b/DESCRIPTION index e8792d9b..2455f2ba 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,8 +3,8 @@ Package: provider Title: Access Public Healthcare Provider Data Version: 0.0.1 Authors@R: - person("Andrew", "Bruce", , "andrewbruce.himni@gmail.com", role = c("aut", "cre", "cph")) -Maintainer: Andrew Bruce + person("Andrew", "Bruce", , "andrew.bruce@northstarrevenueintegrity.com", role = c("aut", "cre", "cph")) +Maintainer: Andrew Bruce Description: Provides various features to facilitate easy access to publicly available healthcare provider data. Includes functions to tidy the data being accessed, whether for reporting purposes or @@ -36,18 +36,18 @@ Imports: zeallot Suggests: covr, - fs, - fuimus, data.table, fipio, fontawesome, + fs, + fuimus, future, - ggraph, + gghighlight, ggplot2, - ggthemes, - ggsflabel, + ggraph, ggrepel, - gghighlight, + ggsflabel, + ggthemes, glue, gt, gtExtras, @@ -64,11 +64,11 @@ Suggests: scales, sf, stats, - zipcodeR, - tidygraph, + testthat (>= 3.0.0), tidygeocoder, + tidygraph, tigris, - testthat (>= 3.0.0) + zipcodeR VignetteBuilder: knitr Remotes: @@ -77,13 +77,13 @@ Remotes: github::nt-williams/rxnorm, github::rstudio/gt, github::yutannihilation/ggsflabel +Config/roxyglobals/filename: generated-globals.R +Config/roxyglobals/unique: TRUE +Config/testthat/edition: 3 +Config/testthat/parallel: true Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE, roclets = c("collate", "namespace", "rd", "roxyglobals::global_roclet")) RoxygenNote: 7.3.1 -Config/testthat/edition: 3 -Config/testthat/parallel: true -Config/roxyglobals/filename: globals.R -Config/roxyglobals/unique: FALSE diff --git a/R/generated-globals.R b/R/generated-globals.R new file mode 100644 index 00000000..7f3dd109 --- /dev/null +++ b/R/generated-globals.R @@ -0,0 +1,602 @@ +# Generated by roxyglobals: do not edit by hand + +utils::globalVariables(c( + # + ".name_1", + # + ".pdi_1", + # + # + # + ":=", + # + "@type", + # + "a2la", + # + "aabb", + # + "accredited", + # + "accrualPeriodicity", + # + "aco_id_1", + # + "aco_id_2", + # + "aco_nm_1", + # + "aco_nm_2", + # + "acr_a2la", + # + "acr_a2la_date", + # + "acr_a2la_ind", + # + "acr_aabb", + # + "acr_aabb_date", + # + "acr_aabb_ind", + # + "acr_aoa", + # + "acr_aoa_date", + # + "acr_aoa_ind", + # + "acr_ashi", + # + "acr_ashi_date", + # + "acr_ashi_ind", + # + "acr_cap", + # + "acr_cap_date", + # + "acr_cap_ind", + # + "acr_cola", + # + "acr_cola_date", + # + "acr_cola_ind", + # + "acr_jcaho", + # + "acr_jcaho_date", + # + "acr_jcaho_ind", + # + # + # + # + # + # + # + # + "address", + # + "addresses", + # + "aoa", + # + "apm_affl_1", + # + "apm_affl_2", + # + "apm_affl_3", + # + "applicable_manufacturer_or_applicable_gpo_making_payment_state", + # + "arg", + # + "ashi", + # + "attestation_value", + # + "basic", + # + "bene_race_detailed", + # + # + "bene_race_wht", + # + "cap", + # + # + "category", + # + "Category", + # + "category_1", + # + "Category_Level", + # + "ccxp_ind", + # + "classification", + # + "Classification", + # + "Classification_Level", + # + "clia_number", + # + "cmplnc_stus_cd", + # + "code", + # + "Code", + # + "cola", + # + "collection_type", + # + "condition", + # + "confirmed", + # + "confirmed_date", + # + "copy", + # + "county_fips", + # + "covered", + # + "covered_1", + # + "covered_recipient_license_state_code1", + # + "covered_recipient_type", + # + "crtfct_type_cd", + # + "crtfctn_actn_type_cd", + # + "current_clia_lab_clsfctn_cd", + # + "data", + # + "definition", + # + "Definition", + # + "demographic", + # + "describedBy", + # + # + # + "description", + # + # + "Description", + # + "display_name", + # + # + # + # + "distribution", + # + "distribution.data", + # + "distribution.data_%Ref:downloadURL", + # + "distribution.data_%Ref:downloadURL.data", + # + "distribution.data_%Ref:downloadURL.data_checksum", + # + "distribution.data_%Ref:downloadURL.data_filePath", + # + "distribution.data_%Ref:downloadURL.data_identifier", + # + "distribution.data_%Ref:downloadURL.data_mimeType", + # + "distribution.data_%Ref:downloadURL.data_perspective", + # + "distribution.data_%Ref:downloadURL.data_version", + # + "distribution.data_%Ref:downloadURL.identifier", + # + "distribution.data_@type", + # + "distribution.data_format", + # + "distribution.data_mediaType", + # + "distribution.data_title", + # + "distribution.identifier", + # + "distribution.title", + # + # + "distribution_accessURL", + # + "distribution_format", + # + # + "distribution_modified", + # + # + "distribution_title", + # + # + # + # + # + "distro", + # + "drug", + # + "duration", + # + "eligible", + # + # + # + "entity_type", + # + "ep", + # + "facility_name", + # + "family", + # + "first_approved_date", + # + "five_star_benchmark", + # + "flag", + # + "function_call", + # + # + "function_name", + # + # + # + # + "gender", + # + "gndr", + # + "gnrl_cntl_type_cd", + # + "gnrl_fac_type_cd", + # + "group_id", + # + "group_state_code", + # + "Grouping", + # + "Grouping_Level", + # + "grp_status", + # + "hcc_risk_avg", + # + # + "hcpcs", + # + "hierarchy", + # + "html", + # + # + "id", + # + # + # + # + # + "identifier", + # + "incorp_state", + # + "ind_pac_id", + # + "ind_status", + # + "individual_state_code", + # + # + "interval", + # + "invs_msr", + # + "is_between", + # + # + "issued", + # + "jcaho", + # + "keyword", + # + # + "landingPage", + # + # + # + # + # + "level", + # + "Level", + # + "lg", + # + "location_type", + # + "measure_cd", + # + "measure_title", + # + "medical", + # + # + # + # + # + # + "modified", + # + # + "name", + # + "name_1", + # + "nature_of_payment_or_transfer_of_value", + # + "ndc", + # + "ndc_1", + # + "npi", + # + "npi_type", + # + "on", + # + "org_id", + # + # + "org_name", + # + "org_pac_id", + # + "org_size", + # + "org_state", + # + "organization", + # + "organizations", + # + "organizations_apms", + # + "organizations_groupScenario", + # + "organizations_individualScenario", + # + "organizations_virtualGroups", + # + "participation_type", + # + "patient_count", + # + "pay_count", + # + "pay_total", + # + "pdi_1", + # + "period", + # + "period_end", + # + "period_start", + # + "periodicity", + # + "pgm_trmntn_cd", + # + "place_of_srvc", + # + # + "pos", + # + "pr", + # + "prevalence", + # + "prf_rate", + # + "procedure", + # + "proprietary_nonprofit", + # + "provider_first_name", + # + "provider_last_name", + # + "provider_name", + # + "prvdr_ctgry_cd", + # + "prvdr_ctgry_sbtyp_cd", + # + # + "publisher", + # + "purpose", + # + "qualified", + # + "rbcs_major_ind", + # + "recipient_state", + # + "record_type", + # + "references", + # + "released", + # + "rgn_cd", + # + "rndrng_prvdr_geo_desc", + # + "rndrng_prvdr_geo_lvl", + # + "score", + # + "section", + # + # + "set", + # + "specialization", + # + "Specialization", + # + "Specialization_Level", + # + # + "specialty", + # + "star_value", + # + # + # + # + # + # + "state", + # + # + # + # + # + # + "state.abb", + # + # + # + "state.name", + # + "state_cd", + # + "state_code", + # + "state_of_travel", + # + # + # + "status", + # + "subcategory", + # + "subgroup_general", + # + "subgroup_other", + # + "sublevel", + # + "subtotal", + # + "summary._value", + # + "taxonomy_category", + # + "taxonomy_classification", + # + "taxonomy_code", + # + "taxonomy_grouping", + # + "taxonomy_specialization", + # + "temporal", + # + "timelength_days", + # + # + # + # + # + "title", + # + "title._value", + # + "tot_allowed", + # + # + "tot_benes", + # + "tot_payment", + # + "tot_srvcs", + # + "total", + # + "trmntn_exprtn_dt", + # + "tx", + # + "type_1", + # + "type_of_action", + # + "update_schedule", + # + "val", + # + # + "value", + # + "Variable", + # + "x", + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + "y", + # + # + # + # + # + # + "year", + # + "zip", + NULL +)) diff --git a/R/globals.R b/R/globals.R deleted file mode 100644 index 2cc9465f..00000000 --- a/R/globals.R +++ /dev/null @@ -1,354 +0,0 @@ -# Generated by roxyglobals: do not edit by hand - -utils::globalVariables(c( - "zip", # - "state", # - ":=", # - "county_fips", # - "y", # - "state.abb", # - "state.name", # - "y", # - "y", # - "rbcs_major_ind", # - "hcpcs", # - "category", # - "subcategory", # - "family", # - "procedure", # - "copy", # - ":=", # - "lg", # - "year", # - ":=", # - "interval", # - "is_between", # - "y", # - "address", # - "gndr", # - "title", # - "modified", # - "distribution", # - "distribution_format", # - "distribution_title", # - "distribution_modified", # - "distribution_accessURL", # - "year", # - "id", # - "title", # - "modified", # - "keyword", # - "identifier", # - "description", # - "arg", # - "year", # - "hcpcs", # - "pos", # - "level", # - "year", # - "level", # - "sublevel", # - "prevalence", # - "condition", # - "state.abb", # - "distro", # - "y", # - "demographic", # - "y", # - "address", # - "location_type", # - "proprietary_nonprofit", # - "subgroup_general", # - "subgroup_other", # - "subtotal", # - "flag", # - "incorp_state", # - "y", # - "address", # - "provider_name", # - "pgm_trmntn_cd", # - "crtfctn_actn_type_cd", # - "cmplnc_stus_cd", # - "rgn_cd", # - "gnrl_cntl_type_cd", # - "crtfct_type_cd", # - "gnrl_fac_type_cd", # - "current_clia_lab_clsfctn_cd", # - "prvdr_ctgry_cd", # - "prvdr_ctgry_sbtyp_cd", # - "state_cd", # - "trmntn_exprtn_dt", # - "duration", # - "clia_number", # - "acr_a2la", # - "acr_a2la_ind", # - "acr_a2la_date", # - "acr_aabb", # - "acr_aabb_ind", # - "acr_aabb_date", # - "acr_aoa", # - "acr_aoa_ind", # - "acr_aoa_date", # - "acr_ashi", # - "acr_ashi_ind", # - "acr_ashi_date", # - "acr_cap", # - "acr_cap_ind", # - "acr_cap_date", # - "acr_cola", # - "acr_cola_ind", # - "acr_cola_date", # - "acr_jcaho", # - "acr_jcaho_ind", # - "acr_jcaho_date", # - "a2la", # - "aabb", # - "aoa", # - "ashi", # - "cap", # - "cola", # - "jcaho", # - "accredited", # - "organization", # - "confirmed", # - "confirmed_date", # - "type_of_action", # - "function_name", # - "issued", # - "modified", # - "released", # - "identifier", # - "landingPage", # - "publisher", # - "@type", # - "function_call", # - "function_name", # - "description", # - "describedBy", # - "distribution", # - "landingPage", # - "modified", # - "references", # - "accrualPeriodicity", # - "temporal", # - "distribution_title", # - "distribution_modified", # - "distribution_accessURL", # - "period", # - "distribution", # - "distribution.data", # - "distribution.data_%Ref:downloadURL", # - "distribution.data_%Ref:downloadURL.data", # - "distribution.data_title", # - "distribution.data_mediaType", # - "distribution.data_format", # - "distribution.data_%Ref:downloadURL.identifier", # - "distribution.data_%Ref:downloadURL.data_filePath", # - "distribution.data_%Ref:downloadURL.data_identifier", # - "distribution.data_%Ref:downloadURL.data_mimeType", # - "distribution.data_%Ref:downloadURL.data_perspective", # - "distribution.data_%Ref:downloadURL.data_version", # - "distribution.data_%Ref:downloadURL.data_checksum", # - "distribution.data_@type", # - "title", # - "issued", # - "modified", # - "description", # - "period_start", # - "period_end", # - "distribution.title", # - "update_schedule", # - "periodicity", # - "interval", # - "identifier", # - "publisher", # - "distribution.identifier", # - "y", # - "org_pac_id", # - "facility_name", # - "aco_id_1", # - "aco_nm_1", # - "aco_id_2", # - "aco_nm_2", # - "measure_cd", # - "measure_title", # - "invs_msr", # - "attestation_value", # - "prf_rate", # - "patient_count", # - "star_value", # - "five_star_benchmark", # - "collection_type", # - "ccxp_ind", # - "ind_pac_id", # - "provider_first_name", # - "provider_last_name", # - "apm_affl_1", # - "apm_affl_2", # - "apm_affl_3", # - "y", # - "title", # - "title._value", # - "summary._value", # - "html", # - "y", # - "basic", # - "addresses", # - "address", # - "purpose", # - "tx", # - "id", # - "pr", # - "on", # - "ep", # - "gender", # - "entity_type", # - "status", # - "identifier", # - "y", # - "covered_recipient_type", # - "recipient_state", # - "applicable_manufacturer_or_applicable_gpo_making_payment_state", # - "covered_recipient_license_state_code1", # - "state_of_travel", # - "nature_of_payment_or_transfer_of_value", # - "address", # - "name_1", # - "covered_1", # - "type_1", # - "category_1", # - "ndc_1", # - "pdi_1", # - ".name_1", # - ".pdi_1", # - "total", # - "value", # - "name", # - "covered", # - "group_id", # - "pay_total", # - "pay_count", # - "ndc", # - "title", # - "modified", # - "distribution", # - "data", # - "year", # - "set", # - "identifier", # - "y", # - "state_code", # - "y", # - "status", # - "eligible", # - "distro", # - "y", # - "y", # - "state.abb", # - "distro", # - "y", # - "state", # - "level", # - "state", # - "level", # - "address", # - "entity_type", # - "gender", # - "state", # - "tot_benes", # - "bene_race_wht", # - "y", # - "y", # - "organizations", # - "organizations_individualScenario", # - "organizations_groupScenario", # - "organizations_apms", # - "organizations_virtualGroups", # - "npi_type", # - "org_state", # - "first_approved_date", # - "timelength_days", # - "org_name", # - "year", # - "npi", # - "org_name", # - "value", # - "name", # - "ind_status", # - "grp_status", # - "distro", # - "y", # - "participation_type", # - "val", # - "set", # - "score", # - "category", # - "status", # - "qualified", # - "org_size", # - "org_id", # - "y", # - "individual_state_code", # - "group_state_code", # - "record_type", # - "hierarchy", # - "taxonomy_code", # - "taxonomy_category", # - "taxonomy_grouping", # - "taxonomy_classification", # - "taxonomy_specialization", # - "Category", # - "Grouping", # - "Classification", # - "Specialization", # - "Category_Level", # - "Grouping_Level", # - "Classification_Level", # - "Specialization_Level", # - "Code", # - "Description", # - "Level", # - "code", # - "section", # - "classification", # - "specialization", # - "display_name", # - "definition", # - "y", # - "state.abb", # - "distro", # - "y", # - "address", # - "specialty", # - "tot_allowed", # - "tot_payment", # - "tot_srvcs", # - "tot_benes", # - "entity_type", # - "gender", # - "state", # - "bene_race_wht", # - "bene_race_detailed", # - "hcc_risk_avg", # - "medical", # - "drug", # - "address", # - "specialty", # - "gender", # - "state", # - "pos", # - "level", # - "rndrng_prvdr_geo_desc", # - "place_of_srvc", # - "rndrng_prvdr_geo_lvl", # - "state.abb", # - "state.name", # - "Variable", # - "Description", # - "Definition", # - "state.abb", # - "state.name", # - "x", # - "y", # - NULL -)) diff --git a/R/quality_payment.R b/R/quality_payment.R index 41c12fba..9b7aea1c 100644 --- a/R/quality_payment.R +++ b/R/quality_payment.R @@ -312,8 +312,8 @@ cols_qcomb <- function(df) { } -#' @noRd #' @autoglobal +#' @noRd cols_qpp <- function(df, step = c("tidy", "nest")) { if (step == "tidy") { diff --git a/README.Rmd b/README.Rmd index c70b5a8a..403c4935 100644 --- a/README.Rmd +++ b/README.Rmd @@ -19,6 +19,8 @@ knitr::opts_chunk$set( # provider +> Providing easy access to [healthcare provider](https://en.wikipedia.org/wiki/Health_care_provider) data through publicly available APIs. + [![R-CMD-check](https://github.com/andrewallenbruce/provider/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrewallenbruce/provider/actions/workflows/R-CMD-check.yaml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://choosealicense.com/licenses/mit/) @@ -26,10 +28,9 @@ knitr::opts_chunk$set( [![last commit](https://img.shields.io/github/last-commit/andrewallenbruce/provider.svg)](https://github.com/andrewallenbruce/provider/commits/main) [![Codecov test coverage](https://codecov.io/gh/andrewallenbruce/provider/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrewallenbruce/provider?branch=main) [![CodeFactor](https://www.codefactor.io/repository/github/andrewallenbruce/provider/badge)](https://www.codefactor.io/repository/github/andrewallenbruce/provider) -![GitHub milestone](https://img.shields.io/github/milestones/progress/andrewallenbruce/provider/1?color=white&logo=milestones) -> Providing easy access to [healthcare provider](https://en.wikipedia.org/wiki/Health_care_provider) data through publicly available APIs. + ## :package: Installation diff --git a/README.md b/README.md index f56616cf..905ba349 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ # provider +> Providing easy access to [healthcare +> provider](https://en.wikipedia.org/wiki/Health_care_provider) data +> through publicly available APIs. + [![R-CMD-check](https://github.com/andrewallenbruce/provider/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrewallenbruce/provider/actions/workflows/R-CMD-check.yaml) @@ -15,14 +19,8 @@ commit](https://img.shields.io/github/last-commit/andrewallenbruce/provider.svg) [![Codecov test coverage](https://codecov.io/gh/andrewallenbruce/provider/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrewallenbruce/provider?branch=main) [![CodeFactor](https://www.codefactor.io/repository/github/andrewallenbruce/provider/badge)](https://www.codefactor.io/repository/github/andrewallenbruce/provider) -![GitHub -milestone](https://img.shields.io/github/milestones/progress/andrewallenbruce/provider/1?color=white&logo=milestones) -> Providing easy access to [healthcare -> provider](https://en.wikipedia.org/wiki/Health_care_provider) data -> through publicly available APIs. - ## :package: Installation You can install **`provider`** from [GitHub](https://github.com/) with: @@ -49,15 +47,9 @@ affiliations(npi = 1023630738, glimpse() ``` - #> Rows: 1 - #> Columns: 7 - #> $ npi "1023630738" - #> $ pac "9032521372" - #> $ first "ALYSIA" - #> $ last "SMITH" - #> $ facility_type Nursing home - #> $ facility_ccn "37Z324" - #> $ parent_ccn "371324" + #> ✖ No results for npi = 1023630738, pac = 9032521372, and facility_ccn = 37Z324 + + #> NULL ### `beneficiaries()` @@ -79,25 +71,25 @@ beneficiaries(year = 2022, #> $ state_name Georgia #> $ county "Lowndes" #> $ fips "13185" - #> $ bene_total 19782 + #> $ bene_total 19786 #> $ bene_orig 11732 - #> $ bene_ma_oth 8051 - #> $ bene_total_aged 16290 + #> $ bene_ma_oth 8054 + #> $ bene_total_aged 16296 #> $ bene_aged_esrd 129 - #> $ bene_aged_no_esrd 16161 - #> $ bene_total_dsb 3492 - #> $ bene_dsb_esrd 143 - #> $ bene_dsb_no_esrd 3350 - #> $ bene_total_ab 18314 - #> $ bene_ab_orig 10270 - #> $ bene_ab_ma_oth 8044 - #> $ bene_total_rx 14028 - #> $ bene_rx_pdp 6431 - #> $ bene_rx_mapd 7596 + #> $ bene_aged_no_esrd 16168 + #> $ bene_total_dsb 3490 + #> $ bene_dsb_esrd 142 + #> $ bene_dsb_no_esrd 3348 + #> $ bene_total_ab 18326 + #> $ bene_ab_orig 10276 + #> $ bene_ab_ma_oth 8050 + #> $ bene_total_rx 14033 + #> $ bene_rx_pdp 6432 + #> $ bene_rx_mapd 7601 #> $ bene_rx_lis_elig 5146 #> $ bene_rx_lis_full 464 - #> $ bene_rx_lis_part 143 - #> $ bene_rx_lis_no 8274 + #> $ bene_rx_lis_part 144 + #> $ bene_rx_lis_no 8280 ### `clinicians()` @@ -299,7 +291,7 @@ open_payments(year = 2021, #> $ license_state OK #> $ physician_ownership FALSE #> $ third_party_payment "No Third Party Payment" - #> $ publish_date 2023-06-30 + #> $ publish_date 2024-01-18 #> $ publish_delay FALSE #> $ publish_dispute FALSE #> $ related_product TRUE @@ -359,7 +351,7 @@ order_refer(npi = 1043522824) ``` #> # A tibble: 4 × 4 - #> npi first last service + #> npi first last eligible #> #> 1 1043522824 JAMES SMITH Medicare Part B #> 2 1043522824 JAMES SMITH Home Health Agency @@ -407,74 +399,34 @@ prescribers(year = 2019, ``` #> Rows: 1 - #> Columns: 67 - #> $ year 2019 - #> $ npi "1003000423" - #> $ entity_type Individual - #> $ first "Jennifer" - #> $ middle "A" - #> $ last "Velotta" - #> $ gender Female - #> $ credential "MD" - #> $ specialty "Obstetrics & Gynecology" - #> $ source Medicare Specialty Code - #> $ address "11100 Euclid Ave" - #> $ city "Cleveland" - #> $ state OH - #> $ zip "44106" - #> $ fips "39" - #> $ ruca "1" - #> $ country "US" - #> $ tot_claims 199 - #> $ tot_fills 344.0667 - #> $ tot_cost 21614.75 - #> $ tot_supply 8759 - #> $ tot_benes 65 - #> $ tot_claims_ge65 150 - #> $ tot_fills_ge65 260.8667 - #> $ tot_cost_ge65 17660.51 - #> $ tot_supply_ge65 6495 - #> $ tot_benes_ge65 49 - #> $ tot_claims_brand 49 - #> $ tot_cost_brand 14343.73 - #> $ tot_claims_generic 150 - #> $ tot_cost_generic 7271.02 - #> $ tot_claims_other 0 - #> $ tot_cost_other 0 - #> $ tot_claims_mapd 78 - #> $ tot_cost_mapd 9438.54 - #> $ tot_claims_pdp 121 - #> $ tot_cost_pdp 12176.21 - #> $ tot_claims_lis 73 - #> $ tot_cost_lis 9659.24 - #> $ tot_claims_nlis 126 - #> $ tot_cost_nlis 11955.51 - #> $ tot_claims_opioid 0 - #> $ tot_cost_opioid 0 - #> $ tot_supply_opioid 0 - #> $ tot_benes_opioid 0 - #> $ rx_rate_opioid 0 - #> $ tot_claims_opioid_la 0 - #> $ tot_cost_opioid_la 0 - #> $ tot_supply_opioid_la 0 - #> $ tot_benes_opioid_la 0 - #> $ tot_claims_antibioc 14 - #> $ tot_cost_antibioc 177.68 - #> $ tot_benes_antibioc 11 - #> $ tot_claims_antipsych_ge65 0 - #> $ tot_cost_antipsych_ge65 0 - #> $ tot_benes_antipsych_ge65 0 - #> $ bene_age_avg 66.63077 - #> $ bene_age_lt65 16 - #> $ bene_age_65_74 33 - #> $ bene_race_wht 60 - #> $ bene_race_nonwht 5 - #> $ bene_race_api 0 - #> $ bene_race_nat 0 - #> $ bene_race_oth 0 - #> $ bene_dual 17 - #> $ bene_ndual 48 - #> $ hcc_risk_avg 0.8426269 + #> Columns: 27 + #> $ year 2019 + #> $ npi "1003000423" + #> $ entity_type Individual + #> $ first "Jennifer" + #> $ middle "A" + #> $ last "Velotta" + #> $ gender Female + #> $ credential "MD" + #> $ specialty "Obstetrics & Gynecology" + #> $ source Medicare Specialty Code + #> $ address "11100 Euclid Ave" + #> $ city "Cleveland" + #> $ state OH + #> $ zip "44106" + #> $ fips "39" + #> $ ruca "1" + #> $ country "US" + #> $ tot_claims 199 + #> $ tot_fills 344.0667 + #> $ tot_cost 21614.75 + #> $ tot_supply 8759 + #> $ tot_benes 65 + #> $ rx_rate_opioid 0 + #> $ hcc_risk_avg 0.8426269 + #> $ detailed [] + #> $ demographics [] + #> $ gte_65 [] ``` r prescribers(year = 2019, @@ -485,29 +437,25 @@ prescribers(year = 2019, ``` #> Rows: 1 - #> Columns: 22 - #> $ year 2019 - #> $ npi "1003000126" - #> $ last "Enkeshafi" - #> $ first "Ardalan" - #> $ city "Cumberland" - #> $ state MD - #> $ fips "24" - #> $ specialty "Internal Medicine" - #> $ source Medicare Specialty Code - #> $ brand_name "Atorvastatin Calcium" - #> $ generic_name "Atorvastatin Calcium" - #> $ tot_claims 41 - #> $ tot_fills 50 - #> $ tot_supply 1482 - #> $ tot_cost 373.6 - #> $ tot_benes 22 - #> $ tot_claims_ge65 41 - #> $ tot_fills_ge65 50 - #> $ tot_cost_ge65 373.6 - #> $ tot_supply_ge65 1482 - #> $ tot_benes_ge65 22 - #> $ level Provider + #> Columns: 18 + #> $ year 2019 + #> $ npi "1003000126" + #> $ last "Enkeshafi" + #> $ first "Ardalan" + #> $ city "Cumberland" + #> $ state MD + #> $ fips "24" + #> $ specialty "Internal Medicine" + #> $ source Medicare Specialty Code + #> $ brand_name "Atorvastatin Calcium" + #> $ generic_name "Atorvastatin Calcium" + #> $ tot_claims 41 + #> $ tot_fills 50 + #> $ tot_supply 1482 + #> $ tot_cost 373.6 + #> $ tot_benes 22 + #> $ level Provider + #> $ gte_65 [] ``` r prescribers(year = 2021, @@ -567,27 +515,54 @@ quality_payment(year = 2021, ``` #> Rows: 1 - #> Columns: 20 - #> $ year 2021 - #> $ npi "1932365699" - #> $ state CO - #> $ size 3 - #> $ specialty "Optometry" - #> $ med_years 14 - #> $ type Group - #> $ beneficiaries 555 - #> $ services 1157 - #> $ allowed_charges 112449 - #> $ final_score 60 - #> $ pay_adjust 0 - #> $ quality_score 45 - #> $ pi_score 0 - #> $ ia_score 0 - #> $ cost_score 0 - #> $ complex_bonus 2.54 - #> $ qi_bonus 0 - #> $ statuses [] - #> $ measures [] + #> Columns: 47 + #> $ year 2021 + #> $ npi "1932365699" + #> $ npi_type Individual + #> $ first "STEFAN" + #> $ middle "MICHAEL" + #> $ last "SMITH" + #> $ state CO + #> $ first_approved_date 2008-11-15 + #> $ years_in_medicare 13 + #> $ participation_type Group + #> $ beneficiaries 555 + #> $ services 1157 + #> $ charges 112449 + #> $ final_score 60 + #> $ pay_adjust 0 + #> $ quality_score 45 + #> $ pi_score 0 + #> $ ia_score 0 + #> $ cost_score 0 + #> $ complex_bonus 2.54 + #> $ qi_bonus 0 + #> $ newly_enrolled FALSE + #> $ is_maqi FALSE + #> $ org_id 1 + #> $ org_size 3 + #> $ org_name "LEE ANN HOVEN OD PC" + #> $ org_address "ADVANCED EYE CARE 1165S CAMINO DEL RIO SUITE 100" + #> $ org_city "DURANGO" + #> $ org_state CO + #> $ org_zip "81303" + #> $ org_hosp_vbp_name NA + #> $ org_facility_based FALSE + #> $ ind_lvt_status_code "BOTH" + #> $ ind_lvt_status_desc "Both the unique beneficiaries and Part B" + #> $ ind_hosp_vbp_score 0 + #> $ specialty "Optometry" + #> $ specialty_desc "Optometry" + #> $ specialty_type "Doctor of Optometry" + #> $ specialty_cat "Physicians" + #> $ ind_specialty_code "41" + #> $ ind_specialty_desc "Optometry" + #> $ ind_specialty_type "Doctor of Optometry" + #> $ ind_specialty_cat "Physicians" + #> $ qpp_status [] + #> $ qpp_measures [] + #> $ ind_status [] + #> $ grp_status [] ``` r q <- quality_payment(year = 2021, @@ -597,33 +572,18 @@ select(q, year, statuses) |> unnest(statuses) ``` - #> # A tibble: 9 × 2 - #> year category - #> - #> 1 2021 Engaged - #> 2 2021 Small Practitioner - #> 3 2021 Rural Clinician - #> 4 2021 HPSA Clinician - #> 5 2021 Extreme Hardship - #> 6 2021 Extreme Hardship (Quality) - #> 7 2021 Extreme Hardship (PI) - #> 8 2021 Extreme Hardship (IA) - #> 9 2021 Extreme Hardship (Cost) + #> Error in `select()`: + #> ! Can't select columns that don't exist. + #> ✖ Column `statuses` doesn't exist. ``` r select(q, year, measures) |> unnest(measures) ``` - #> # A tibble: 6 × 4 - #> year measure id score - #> - #> 1 2021 Quality 141 3 - #> 2 2021 Quality 014 3 - #> 3 2021 Quality 110 3 - #> 4 2021 Quality 47 3 - #> 5 2021 Quality 1 0 - #> 6 2021 Quality 117 0 + #> Error in `select()`: + #> ! Can't select columns that don't exist. + #> ✖ Column `measures` doesn't exist. ### `quality_eligibility()` @@ -634,7 +594,7 @@ quality_eligibility(year = 2021, ``` #> Rows: 1 - #> Columns: 29 + #> Columns: 30 #> $ year 2021 #> $ npi "1932365699" #> $ npi_type Individual @@ -642,12 +602,13 @@ quality_eligibility(year = 2021, #> $ middle "MICHAEL" #> $ last "SMITH" #> $ first_approved_date 2008-11-15 - #> $ pecos_year 2008 + #> $ years_in_medicare 13 #> $ newly_enrolled FALSE #> $ specialty_desc "Optometry" #> $ specialty_type "Doctor of Optometry" #> $ specialty_cat "Physicians" #> $ is_maqi FALSE + #> $ org_id 1 #> $ org_name "LEE ANN HOVEN OD PC" #> $ org_hosp_vbp_name NA #> $ org_facility_based FALSE @@ -697,53 +658,29 @@ utilization(year = 2021, glimpse() ``` - #> Rows: 1 - #> Columns: 20 - #> $ year 2021 - #> $ npi "1932365699" - #> $ entity_type Individual - #> $ first "Stefan" - #> $ middle "M" - #> $ last "Smith" - #> $ gender Male - #> $ credential "OD" - #> $ specialty "Optometry" - #> $ address "724 St. Louis Road" - #> $ city "Collinsville" - #> $ state IL - #> $ zip "62234" - #> $ fips "17" - #> $ ruca "1" - #> $ country "US" - #> $ par TRUE - #> $ performance [] - #> $ demographics [] - #> $ conditions [] + #> Error in `utilization()`: + #> ! `type` must be one of "Provider", "Service", or "Geography", not + #> "provider". + #> ℹ Did you mean "Provider"? ``` r p <- utilization(year = 2021, npi = 1932365699, type = "provider") +``` + + #> Error in `utilization()`: + #> ! `type` must be one of "Provider", "Service", or "Geography", not + #> "provider". + #> ℹ Did you mean "Provider"? +``` r select(p, year, performance) |> unnest(performance) |> glimpse() ``` - #> Rows: 1 - #> Columns: 12 - #> $ year 2021 - #> $ tot_hcpcs 19 - #> $ tot_benes 279 - #> $ tot_srvcs 475 - #> $ tot_charges 57098.8 - #> $ tot_allowed 48345.19 - #> $ tot_payment 31966.13 - #> $ tot_std_pymt 31316.51 - #> $ .copay_deduct 16379.06 - #> $ .srvcs_per_bene 1.702509 - #> $ .pymt_per_bene 114.5739 - #> $ .pymt_per_srvc 67.29712 + #> Error in eval(expr, envir, enclos): object 'p' not found ``` r select(p, year, demographics) |> @@ -751,21 +688,7 @@ select(p, year, demographics) |> glimpse() ``` - #> Rows: 1 - #> Columns: 13 - #> $ year 2021 - #> $ bene_age_avg 72 - #> $ bene_age_lt65 16 - #> $ bene_age_65_74 181 - #> $ bene_age_75_84 63 - #> $ bene_age_gt84 19 - #> $ bene_gen_female 157 - #> $ bene_gen_male 122 - #> $ bene_race_wht 245 - #> $ bene_race_nonwht 34 - #> $ bene_dual 40 - #> $ bene_ndual 239 - #> $ bene_race_detailed [] + #> Error in eval(expr, envir, enclos): object 'p' not found ``` r select(p, year, conditions) |> @@ -773,26 +696,7 @@ select(p, year, conditions) |> glimpse() ``` - #> Rows: 1 - #> Columns: 18 - #> $ year 2021 - #> $ hcc_risk_avg 0.7719 - #> $ cc_af 0.08 - #> $ cc_alz 0.07 - #> $ cc_asth 0.06 - #> $ cc_canc 0.09 - #> $ cc_chf 0.06 - #> $ cc_ckd 0.15 - #> $ cc_copd 0.06 - #> $ cc_dep 0.19 - #> $ cc_diab 0.16 - #> $ cc_hplip 0.32 - #> $ cc_hpten 0.33 - #> $ cc_ihd 0.18 - #> $ cc_opo 0.13 - #> $ cc_raoa 0.3 - #> $ cc_sz NA - #> $ cc_strk NA + #> Error in eval(expr, envir, enclos): object 'p' not found ``` r utilization(year = 2021, @@ -802,40 +706,10 @@ utilization(year = 2021, glimpse() ``` - #> Rows: 1 - #> Columns: 32 - #> $ year 2021 - #> $ npi "1932365699" - #> $ level Provider - #> $ first "Stefan" - #> $ middle "M" - #> $ last "Smith" - #> $ gender Male - #> $ credential "O.D." - #> $ specialty "Optometry" - #> $ address "724 St. Louis Road" - #> $ city "Collinsville" - #> $ state IL - #> $ zip "62234" - #> $ fips "17" - #> $ ruca "1" - #> $ country "US" - #> $ par TRUE - #> $ hcpcs "99214" - #> $ hcpcs_desc "Established patient outpatient visit, total time 30-39 m… - #> $ category "E&M" - #> $ subcategory "Office/Outpatient Services" - #> $ family "Office E&M - Established" - #> $ procedure Non-procedure - #> $ drug FALSE - #> $ pos Non-facility - #> $ tot_benes 24 - #> $ tot_srvcs 27 - #> $ tot_day 27 - #> $ avg_charge 134.7407 - #> $ avg_allowed 132.7281 - #> $ avg_payment 102.7159 - #> $ avg_std_pymt 99.46074 + #> Error in `utilization()`: + #> ! `type` must be one of "Provider", "Service", or "Geography", not + #> "service". + #> ℹ Did you mean "Service"? ``` r utilization(year = 2021, @@ -846,27 +720,10 @@ utilization(year = 2021, glimpse() ``` - #> Rows: 1 - #> Columns: 19 - #> $ year 2021 - #> $ level National - #> $ state National - #> $ hcpcs "99205" - #> $ hcpcs_desc "New patient outpatient visit, total time 60-74 minutes" - #> $ category "E&M" - #> $ subcategory "Office/Outpatient Services" - #> $ family "Office E&M - New" - #> $ procedure Non-procedure - #> $ drug FALSE - #> $ pos Facility - #> $ tot_provs 65502 - #> $ tot_benes 574426 - #> $ tot_srvcs 653339 - #> $ tot_day 653311 - #> $ avg_charge 493.5003 - #> $ avg_allowed 186.2096 - #> $ avg_payment 143.4408 - #> $ avg_std_pymt 139.6115 + #> Error in `utilization()`: + #> ! `type` must be one of "Provider", "Service", or "Geography", not + #> "geography". + #> ℹ Did you mean "Geography"? ------------------------------------------------------------------------ diff --git a/tests/testthat/_snaps/utils.md b/tests/testthat/_snaps/utils.md index 003d07c6..cfd554f2 100644 --- a/tests/testthat/_snaps/utils.md +++ b/tests/testthat/_snaps/utils.md @@ -44,14 +44,14 @@ Code file_url(fn = "c", args = args, offset = 0L) Output - [1] "https://data.cms.gov/provider-data/api/1/datastore/sql?query=%5BSELECT%20%2A%20FROM%208d6c0fbb-f534-5b1d-89ff-857d5a1f2f22%5D%5BWHERE%20NPI%20=%20%221144544834%22%5D%5BLIMIT%2010000%20OFFSET%200%5D;&show_db_columns" + [1] "https://data.cms.gov/provider-data/api/1/datastore/sql?query=%5BSELECT%20%2A%20FROM%200001f480-9905-5b83-bc03-7b33da67cd39%5D%5BWHERE%20NPI%20=%20%221144544834%22%5D%5BLIMIT%2010000%20OFFSET%200%5D;&show_db_columns" --- Code file_url(fn = "a", args = args, offset = 0L) Output - [1] "https://data.cms.gov/provider-data/api/1/datastore/sql?query=%5BSELECT%20%2A%20FROM%20d194d944-3763-53d2-8069-307be2edeca0%5D%5BWHERE%20NPI%20=%20%221144544834%22%5D%5BLIMIT%2010000%20OFFSET%200%5D;&show_db_columns" + [1] "https://data.cms.gov/provider-data/api/1/datastore/sql?query=%5BSELECT%20%2A%20FROM%205188b58f-66bd-53d0-8c22-8b46335814c5%5D%5BWHERE%20NPI%20=%20%221144544834%22%5D%5BLIMIT%2010000%20OFFSET%200%5D;&show_db_columns" # format_cli() works