Skip to content

Commit

Permalink
tests - providers, quality_payment
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Nov 4, 2023
1 parent 79147ec commit 71ea67d
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 0 deletions.
240 changes: 240 additions & 0 deletions tests/testthat/test-cols.R
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,246 @@ test_that("cols_pros() works", {
expect_equal(cols_pros(x), y)
})

test_that("cols_qpp() works", {

x <- dplyr::tibble(
year = 1,
npi = 1,
practice_state_or_us_territory = 1,
practice_size = 1,
clinician_specialty = 1,
years_in_medicare = 1,
participation_type = 1,
medicare_patients = 1,
services = 1,
allowed_charges = 1,
final_score = 1,
payment_adjustment_percentage = 1,
quality_category_score = 1,
promoting_interoperability_pi_category_score = 1,
ia_score = 1,
cost_score = 1,
complex_patient_bonus = 1,
quality_improvement_bonus = 1,
quality_bonus = 1,
engaged = 1,
opted_into_mips = 1,
small_practitioner = 1,
rural_clinician = 1,
hpsa_clinician = 1,
ambulatory_surgical_center = 1,
hospital_based_clinician = 1,
non_patient_facing = 1,
facility_based = 1,
extreme_hardship = 1,
extreme_hardship_quality = 1,
extreme_hardship_pi = 1,
pi_hardship = 1,
pi_reweighting = 1,
pi_bonus = 1,
pi_cehrt_id = 1,
extreme_hardship_ia = 1,
ia_study = 1,
extreme_hardship_cost = 1,
quality_measure_id_1 = 1,
quality_measure_id_2 = 1,
quality_measure_id_3 = 1,
quality_measure_id_4 = 1,
quality_measure_id_5 = 1,
quality_measure_id_6 = 1,
quality_measure_id_7 = 1,
quality_measure_id_8 = 1,
quality_measure_id_9 = 1,
quality_measure_id_10 = 1,
quality_measure_score_1 = 1,
quality_measure_score_2 = 1,
quality_measure_score_3 = 1,
quality_measure_score_4 = 1,
quality_measure_score_5 = 1,
quality_measure_score_6 = 1,
quality_measure_score_7 = 1,
quality_measure_score_8 = 1,
quality_measure_score_9 = 1,
quality_measure_score_10 = 1,
pi_measure_id_1 = 1,
pi_measure_id_2 = 1,
pi_measure_id_3 = 1,
pi_measure_id_4 = 1,
pi_measure_id_5 = 1,
pi_measure_id_6 = 1,
pi_measure_id_7 = 1,
pi_measure_id_8 = 1,
pi_measure_id_9 = 1,
pi_measure_id_10 = 1,
pi_measure_id_11 = 1,
pi_measure_score_1 = 1,
pi_measure_score_2 = 1,
pi_measure_score_3 = 1,
pi_measure_score_4 = 1,
pi_measure_score_5 = 1,
pi_measure_score_6 = 1,
pi_measure_score_7 = 1,
pi_measure_score_8 = 1,
pi_measure_score_9 = 1,
pi_measure_score_10 = 1,
pi_measure_score_11 = 1,
ia_measure_id_1 = 1,
ia_measure_id_2 = 1,
ia_measure_id_3 = 1,
ia_measure_id_4 = 1,
ia_measure_score_1 = 1,
ia_measure_score_2 = 1,
ia_measure_score_3 = 1,
ia_measure_score_4 = 1,
cost_measure_id_1 = 1,
cost_measure_id_2 = 1,
cost_measure_score_1 = 1,
cost_measure_score_2 = 1)

y <- dplyr::tibble(
year = 1,
npi = 1,
state = 1,
size = 1,
specialty = 1,
med_years = 1,
type = 1,
beneficiaries = 1,
services = 1,
allowed_charges = 1,
final_score = 1,
pay_adjust = 1,
quality_score = 1,
pi_score = 1,
ia_score = 1,
cost_score = 1,
complex_bonus = 1,
qi_bonus = 1,
ind_quality_bonus = 1,
ind_engaged = 1,
ind_opted_into_mips = 1,
ind_small_practitioner = 1,
ind_rural = 1,
ind_hpsa = 1,
ind_asc = 1,
ind_hospital_based = 1,
ind_non_patient_facing = 1,
ind_facility_based = 1,
ind_extreme_hardship = 1,
ind_extreme_hardship_quality = 1,
ind_extreme_hardship_pi = 1,
ind_pi_hardship = 1,
ind_pi_reweighting = 1,
ind_pi_bonus = 1,
pi_cehrt_id = 1,
ind_extreme_hardship_ia = 1,
ind_ia_study = 1,
ind_extreme_hardship_cost = 1,
quality_measure_id_1 = 1,
quality_measure_id_2 = 1,
quality_measure_id_3 = 1,
quality_measure_id_4 = 1,
quality_measure_id_5 = 1,
quality_measure_id_6 = 1,
quality_measure_id_7 = 1,
quality_measure_id_8 = 1,
quality_measure_id_9 = 1,
quality_measure_id_10 = 1,
quality_measure_score_1 = 1,
quality_measure_score_2 = 1,
quality_measure_score_3 = 1,
quality_measure_score_4 = 1,
quality_measure_score_5 = 1,
quality_measure_score_6 = 1,
quality_measure_score_7 = 1,
quality_measure_score_8 = 1,
quality_measure_score_9 = 1,
quality_measure_score_10 = 1,
pi_measure_id_1 = 1,
pi_measure_id_2 = 1,
pi_measure_id_3 = 1,
pi_measure_id_4 = 1,
pi_measure_id_5 = 1,
pi_measure_id_6 = 1,
pi_measure_id_7 = 1,
pi_measure_id_8 = 1,
pi_measure_id_9 = 1,
pi_measure_id_10 = 1,
pi_measure_id_11 = 1,
pi_measure_score_1 = 1,
pi_measure_score_2 = 1,
pi_measure_score_3 = 1,
pi_measure_score_4 = 1,
pi_measure_score_5 = 1,
pi_measure_score_6 = 1,
pi_measure_score_7 = 1,
pi_measure_score_8 = 1,
pi_measure_score_9 = 1,
pi_measure_score_10 = 1,
pi_measure_score_11 = 1,
ia_measure_id_1 = 1,
ia_measure_id_2 = 1,
ia_measure_id_3 = 1,
ia_measure_id_4 = 1,
ia_measure_score_1 = 1,
ia_measure_score_2 = 1,
ia_measure_score_3 = 1,
ia_measure_score_4 = 1,
cost_measure_id_1 = 1,
cost_measure_id_2 = 1,
cost_measure_score_1 = 1,
cost_measure_score_2 = 1)

z <- dplyr::tibble(
year = 1,
npi = 1,
state = 1,
size = 1,
specialty = 1,
med_years = 1,
type = 1,
beneficiaries = 1,
services = 1,
allowed_charges = 1,
final_score = 1,
pay_adjust = 1,
quality_score = 1,
pi_score = 1,
ia_score = 1,
cost_score = 1,
complex_bonus = 1,
qi_bonus = 1,
pi_cehrt_id = 1,
statuses = 1,
measures = 1)

zz <- dplyr::tibble(
year = 1,
npi = 1,
state = 1,
size = 1,
specialty = 1,
med_years = 1,
type = 1,
beneficiaries = 1,
services = 1,
allowed_charges = 1,
final_score = 1,
pay_adjust = 1,
quality_score = 1,
pi_score = 1,
ia_score = 1,
cost_score = 1,
complex_bonus = 1,
qi_bonus = 1,
# pi_cehrt_id = 1,
statuses = 1,
measures = 1)

expect_equal(cols_qpp(x, step = "tidy"), y)
expect_equal(cols_qpp(z, step = "nest"), zz)
})

test_that("cols_reas() works", {

x <- dplyr::tibble(
Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/test-providers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
httptest2::without_internet({
test_that("providers() returns correct request URL", {
httptest2::expect_GET(
providers(npi = 1497796718,
pac = 2961314075,
enid = "I20031105000487",
specialty_code = "14-93",
specialty_description = "PRACTITIONER - EMERGENCY MEDICINE",
first = "REGINALD",
middle = "D",
last = "SMITH",
state = "GA",
gender = "M"),
'https://data.cms.gov/data.json')
})
})
11 changes: 11 additions & 0 deletions tests/testthat/test-quality_payment.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
httptest2::without_internet({
test_that("quality_payment() returns correct request URL", {
httptest2::expect_GET(
quality_payment(year = 2020,
npi = 1144544834,
state = "GA",
specialty = "Physician Assistant",
type = "Group"),
'https://data.cms.gov/data.json')
})
})

0 comments on commit 71ea67d

Please sign in to comment.