Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append QPP Measure/Benchmark data to quality_payment() #30

Closed
Tracked by #31
andrewallenbruce opened this issue Oct 31, 2023 · 0 comments
Closed
Tracked by #31

Append QPP Measure/Benchmark data to quality_payment() #30

andrewallenbruce opened this issue Oct 31, 2023 · 0 comments
Assignees
Labels
addendum 👍 additional context questioning ❔ unsure if addition or change needed

Comments

@andrewallenbruce
Copy link
Owner

  • isToppedOut: Boolean that describes whether a benchmark's latter deciles repeat a value of 100 or, in the case of inverse measures, a value of 0.
  • Deciles: List of 9 numbers representing deciles of measurement values for a given measure, performance year and submission method. The 9 numbers represent the inclusive lower bounds of deciles 2 through 10. The upper and lower bounds of the measurement value range are implied to be 100 and 0 respectively for direct measures and 0 and 100 respectively for inverse measures. The range of any given decile begins at its lower bound and continues up to but does not include the subsequent decile's lower bound. If the subsequent decile's lower bound is equal to the current decile's lower bound, then that decile is undefined or, in other words, empty.
library(provider)
library(tidyverse)
library(jsonlite)

# Retrieve QPP data for a given year and NPI
df <- quality_payment(year = 2018, npi = 1366470650)

#> # A tibble: 2 × 20
#>   year     npi      state  size specialty med_years type  beneficiaries services
#>   <date_y> <chr>    <chr> <int> <chr>         <int> <chr>         <int>    <int>
#> 1 2018     1366470… GA      113 Internal…        12 Group          9378        0
#> 2 2018     1366470… GA        2 Internal…        12 MIPS…           743        0
#> # ℹ 11 more variables: allowed_charges <dbl>, final_score <dbl>,
#> #   pay_adjust <dbl>, quality_score <dbl>, pi_score <dbl>, ia_score <dbl>,
#> #   cost_score <dbl>, complex_bonus <dbl>, qi_bonus <dbl>, statuses <list>,
#> #   measures <list>

# Extract Measures
measures <- df |>
  select(year, npi, type, measures) |>
  unnest(measures) |>
  mutate(year = as.integer(year))

#> # A tibble: 34 × 6
#>     year npi        type  measure id           score
#>    <int> <chr>      <chr> <chr>   <chr>        <dbl>
#>  1  2018 1366470650 Group quality 005            9.1
#>  2  2018 1366470650 Group quality 119            7.7
#>  3  2018 1366470650 Group quality 8              7.7
#>  4  2018 1366470650 Group quality 317            6.8
#>  5  2018 1366470650 Group quality 318            6.6
#>  6  2018 1366470650 Group quality 204            6.1
#>  7  2018 1366470650 Group quality 458            4.4
#>  8  2018 1366470650 Group pi      PI_PEA_2      10  
#>  9  2018 1366470650 Group pi      PI_IACEHRT_1  10  
#> 10  2018 1366470650 Group pi      PI_PHCDRR_1   10  
#> # ℹ 24 more rows

# Import Measures data from CMS
measures_2018 <- fromJSON("C:/Users/andyb/Desktop/provider_book/data/measures-data_2018.json") |>
  tibble() |>
  mutate(year = 2018L, .before = 1)

#> Rows: 1
#> Columns: 38
#> $ year                          <int> 2018
#> $ title                         <chr> "Diabetes: Hemoglobin A1c (HbA1c) Poor C…
#> $ eMeasureId                    <chr> "CMS122v6"
#> $ nqfEMeasureId                 <chr> NA
#> $ nqfId                         <chr> "0059"
#> $ measureId                     <chr> "001"
#> $ description                   <chr> "Percentage of patients 18-75 years of a…
#> $ nationalQualityStrategyDomain <chr> "Effective Clinical Care"
#> $ measureType                   <chr> "intermediateOutcome"
#> $ primarySteward                <chr> "National Committee for Quality Assuranc…
#> $ metricType                    <chr> "singlePerformanceRate"
#> $ firstPerformanceYear          <int> 2017
#> $ lastPerformanceYear           <lgl> NA
#> $ isHighPriority                <lgl> TRUE
#> $ isInverse                     <lgl> TRUE
#> $ isIcdImpacted                 <lgl> FALSE
#> $ isToppedOutByProgram          <lgl> FALSE
#> $ category                      <chr> "quality"
#> $ isRegistryMeasure             <lgl> FALSE
#> $ isRiskAdjusted                <lgl> FALSE
#> $ submissionMethods             <list> <"claims", "electronicHealthRecord", "cm…
#> $ measureSets                   <list> <"generalPracticeFamilyMedicine", "inter…
#> $ measureSpecification          <df[,5]> <data.frame[1 x 5]>
#> $ cpcPlusGroup                  <chr> "Outcome_Measure"
#> $ eMeasureUuid                  <chr> "40280382-5abd-fa46-015b-4981e40b37e6"
#> $ strata                        <list> [<data.frame[1 x 2]>]
#> $ eligibilityOptions            <list> [<data.frame[1 x 4]>]
#> $ performanceOptions            <list> [<data.frame[5 x 2]>]
#> $ overallAlgorithm              <chr> NA
#> $ weight                        <chr> NA
#> $ isRequired                    <lgl> NA
#> $ isBonus                       <lgl> NA
#> $ objective                     <chr> NA
#> $ reportingCategory             <chr> NA
#> $ substitutes                   <list> <NULL>
#> $ exclusion                     <chr> NA
#> $ subcategoryId                 <chr> NA
#> $ cehrtEligible                 <lgl> NA

# Import Benchmark data from CMS
bench_2018 <- fromJSON("C:/Users/andyb/Desktop/provider_book/data/measures-data_2018.json") |>
  tibble() |>
  mutate(year = 2018L, .before = 1)

#> Rows: 1
#> Columns: 38
#> $ year                          <int> 2018
#> $ title                         <chr> "Diabetes: Hemoglobin A1c (HbA1c) Poor C…
#> $ eMeasureId                    <chr> "CMS122v6"
#> $ nqfEMeasureId                 <chr> NA
#> $ nqfId                         <chr> "0059"
#> $ measureId                     <chr> "001"
#> $ description                   <chr> "Percentage of patients 18-75 years of a…
#> $ nationalQualityStrategyDomain <chr> "Effective Clinical Care"
#> $ measureType                   <chr> "intermediateOutcome"
#> $ primarySteward                <chr> "National Committee for Quality Assuranc…
#> $ metricType                    <chr> "singlePerformanceRate"
#> $ firstPerformanceYear          <int> 2017
#> $ lastPerformanceYear           <lgl> NA
#> $ isHighPriority                <lgl> TRUE
#> $ isInverse                     <lgl> TRUE
#> $ isIcdImpacted                 <lgl> FALSE
#> $ isToppedOutByProgram          <lgl> FALSE
#> $ category                      <chr> "quality"
#> $ isRegistryMeasure             <lgl> FALSE
#> $ isRiskAdjusted                <lgl> FALSE
#> $ submissionMethods             <list> <"claims", "electronicHealthRecord", "cm…
#> $ measureSets                   <list> <"generalPracticeFamilyMedicine", "inter…
#> $ measureSpecification          <df[,5]> <data.frame[1 x 5]>
#> $ cpcPlusGroup                  <chr> "Outcome_Measure"
#> $ eMeasureUuid                  <chr> "40280382-5abd-fa46-015b-4981e40b37e6"
#> $ strata                        <list> [<data.frame[1 x 2]>]
#> $ eligibilityOptions            <list> [<data.frame[1 x 4]>]
#> $ performanceOptions            <list> [<data.frame[5 x 2]>]
#> $ overallAlgorithm              <chr> NA
#> $ weight                        <chr> NA
#> $ isRequired                    <lgl> NA
#> $ isBonus                       <lgl> NA
#> $ objective                     <chr> NA
#> $ reportingCategory             <chr> NA
#> $ substitutes                   <list> <NULL>
#> $ exclusion                     <chr> NA
#> $ subcategoryId                 <chr> NA
#> $ cehrtEligible                 <lgl> NA

qpp_2018 <- full_join(measures_2018, bench_2018)

qpp_2018 |> right_join(measures, by = join_by(year, measureId == id, category == measure))

#> # A tibble: 34 × 41
#>     year title              eMeasureId nqfEMeasureId nqfId measureId description
#>    <int> <chr>              <chr>      <chr>         <chr> <chr>     <chr>      
#>  1  2018 Heart Failure (HF… CMS135v6   2907          0081  005       "Percentag…
#>  2  2018 Preventive Care a… CMS147v7   <NA>          0041  110       "Percentag…
#>  3  2018 Pneumococcal Vacc… CMS127v6   <NA>          0043  111       "Percentag…
#>  4  2018 Breast Cancer Scr… CMS125v6   <NA>          2372  112       "Percentag…
#>  5  2018 Colorectal Cancer… CMS130v6   <NA>          0034  113       "Percentag…
#>  6  2018 Diabetes: Medical… CMS134v6   <NA>          0062  119       "The perce…
#>  7  2018 Preventive Care a… CMS69v6    <NA>          0421  128       "Percentag…
#>  8  2018 Preventive Care a… CMS2v7     <NA>          0418  134       "Percentag…
#>  9  2018 Ischemic Vascular… CMS164v6   <NA>          0068  204       "Percentag…
#> 10  2018 Ischemic Vascular… CMS164v6   <NA>          0068  204       "Percentag…
#> # ℹ 24 more rows
#> # ℹ 34 more variables: nationalQualityStrategyDomain <chr>, measureType <chr>,
#> #   primarySteward <chr>, metricType <chr>, firstPerformanceYear <int>,
#> #   lastPerformanceYear <lgl>, isHighPriority <lgl>, isInverse <lgl>,
#> #   isIcdImpacted <lgl>, isToppedOutByProgram <lgl>, category <chr>,
#> #   isRegistryMeasure <lgl>, isRiskAdjusted <lgl>, submissionMethods <list>,
#> #   measureSets <list>, measureSpecification <df[,5]>, cpcPlusGroup <chr>, …

Created on 2023-10-31 with reprex v2.0.2

@andrewallenbruce andrewallenbruce added the enhancement 🤖 adds to the base functionality label Oct 31, 2023
@andrewallenbruce andrewallenbruce self-assigned this Oct 31, 2023
@andrewallenbruce andrewallenbruce added questioning ❔ unsure if addition or change needed addendum 👍 additional context and removed enhancement 🤖 adds to the base functionality labels Oct 31, 2023
@andrewallenbruce andrewallenbruce mentioned this issue Oct 31, 2023
4 tasks
@andrewallenbruce andrewallenbruce closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addendum 👍 additional context questioning ❔ unsure if addition or change needed
Projects
None yet
Development

No branches or pull requests

1 participant