ellessenne / comorbidity

An R package for computing comorbidity scores.
https://ellessenne.github.io/comorbidity/
GNU General Public License v3.0
78 stars 21 forks source link

Renal Dx not captured in score #12

Closed cornflakegrl closed 4 years ago

cornflakegrl commented 5 years ago

CCI: The ICD-9 code 583.0 is not being flagged as a Renal disease (cat 13) Also, ICD9 codes have a leading "0" for codes below 100. I think that codes like 016.72 are being counted as 167.2 because the leading zero was lost.

ellessenne commented 5 years ago

Hi, the code 583.0 is actually detected using the latest version of comorbidity (0.4.1):

library(comorbidity)
data <- data.frame(id = 1, code = "583.0")
comorbidity::comorbidity(x = data, id = "id", code = "code", score = "charlson", icd = "icd9", assign0 = FALSE)
#>    id ami chf pvd cevd dementia copd rheumd pud mld diab diabwc hp rend
#> 1 res   0   0   0    0        0    0      0   0   0    0      0  0    1
#>   canc msld metacanc aids score index wscore windex
#> 1    0    0        0    0     1   1-2      2    1-2

Created on 2019-07-02 by the reprex package (v0.3.0)

Could you elaborate further on your issue, or provide a reproducible example?

Also, regarding the leading zeros: my understanding is that would be a problem of how the data is recorded or am I misunderstanding the issue?

cornflakegrl commented 5 years ago

Here is my raw data. The DX tab has the patient id, dx code and cci and eci categories. The CCI tab has the scores that I calculated. Please calculate the scores for my data and compare. comorbid_error.xlsx

ellessenne commented 5 years ago

I am still not sure what is the problem, could you provide more information? What are the differences that you think are wrong?

cornflakegrl commented 5 years ago

Take a look at the Compare tab. I have highlighted the places where your calculation differs from mine. comorbid_error.xlsx

ellessenne commented 5 years ago

I had a look at it and:

  1. The output that I obtain by running comorbidity on your data differs from what is in your Excel file, see:
library(readxl)
library(comorbidity)
df <- readxl::read_excel(path = "~/Downloads/comorbid_error-2.xlsx")
#> New names:
#> * `` -> ...5
names(df) <- make.names(names(df))
comorbidity::comorbidity(x = df, id = "PT_ID", code = "ICD.9_CODE", score = "charlson", icd = "icd9", assign0 = FALSE)
#>   PT_ID ami chf pvd cevd dementia copd rheumd pud mld diab diabwc hp rend
#> 1     2   0   0   0    0        0    0      0   1   0    0      0  0    1
#> 2     3   0   0   0    0        0    0      0   0   0    0      0  0    0
#> 3     4   0   0   0    0        0    0      0   1   0    0      0  0    0
#> 4   112   0   0   0    0        0    0      0   0   0    0      0  0    0
#> 5   141   0   0   0    0        0    0      0   0   0    0      0  0    0
#> 6   153   0   0   0    0        0    1      0   0   0    0      0  0    0
#>   canc msld metacanc aids score index wscore windex
#> 1    0    0        0    0     2   1-2      3    3-4
#> 2    0    0        0    0     0     0      0      0
#> 3    0    0        0    0     1   1-2      1    1-2
#> 4    0    0        0    0     0     0      0      0
#> 5    0    0        0    0     0     0      0      0
#> 6    0    0        0    0     1   1-2      1    1-2

Created on 2019-07-04 by the reprex package (v0.3.0)

  1. Your calculations seem incorrect to me at times, for instance you assign 093.20 and 093.23 to comorbidities, but I could not find any matching category - what did you based your calculations on?
ellessenne commented 5 years ago

@cornflakegrl did you sort this out? If so, could you close this issue? Thanks!