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

Hierarchy in HCC is not respected #188

Open
VolodymyrClarify opened this issue Nov 5, 2019 · 1 comment
Open

Hierarchy in HCC is not respected #188

VolodymyrClarify opened this issue Nov 5, 2019 · 1 comment

Comments

@VolodymyrClarify
Copy link

VolodymyrClarify commented Nov 5, 2019

Hello!

In the following example Hierarchy is not respected for diabetes (with ICD10 codes as inputs):

pts <- data.frame( patient_id = c( "1", "1", "1" ),
                   icd_code = c( "E099", "E08638", "E13641" ),
                   date = as.Date(c("2019-01-01", "2019-01-01", "2019-01-01" ) ) )

pts

comorbid_hcc( pts )  

Output:

      patient_id       date                  hcc
          1                2019-01-01        17
          1                2019-01-01        18
          1                2019-01-01        19

#######################################
Update:
It is a bug somewhere in date parameter of the function.

In the following example the hierarchy is working:

pts <- data.frame( patient_id = c( "1", "1", "1" ),
                   icd_code = c( "E099", "E08638", "E13641" ),
                   date = as.Date(c("2018-01-01", "2018-01-01", "2018-01-01" ) ) )

comorbid_hcc( pts )  

# Output
  patient_id       date               hcc
       1               2018-01-01      17

@bokov
Copy link

bokov commented Aug 29, 2020

I think the problem might be here:

icd/R/hcc.R

Line 81 in e54bb24

x$year <- as.numeric(format(x[[date_name]], "%Y"))

x$year is set from the data without validation. Also if the dates are before 2014 or after 2019 you get an empty result.

There should be a way for the user to override the year auto-guessing and apply the same year for all visits because:

  • When de-identifying health records it is a common practice to date-shift, therefore one cannot rely on the nominal date in the record to select the correct HCC version.
  • One might wish to compare past records using a common HCC version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants