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

expand_range errors out on ICD-10 decimal codes #196

Open
patrickmdnet opened this issue Mar 29, 2020 · 0 comments
Open

expand_range errors out on ICD-10 decimal codes #196

patrickmdnet opened this issue Mar 29, 2020 · 0 comments

Comments

@patrickmdnet
Copy link
Collaborator

While investigating issue #194 I was surprised to find that the expand_range function fails when using ICD-10 decimal codes. The test code in tests/testthat/test-ranges-icd10.R does not seem to cover this case.

> expand_range("C81.99", "C81.99")
Error in expand_range.icd10cm(start, end, short_code = short_code, defined = defined,  : 
  start code 'C81.99' not found
In addition: Warning message:
In icd10_children_defined_rcpp(x = x, lookup = lu, nc = nc) :

The error message is actually a lie - the problem is with the end code, not the start code.

The culprit appears to be R/ranges.R#L115:

  end_kids <- children_defined.icd10cm(end, short_code = TRUE)

since short_code is forced to TRUE, the function fails:

> icd:::children_defined.icd10cm('C81.99', short_code = TRUE)
character(0)
Warning message:
In icd10_children_defined_rcpp(x = x, lookup = lu, nc = nc) :
  None of the provided ICD-10 codes matched the lookup codes

In fact, the passed in short_code parameter value is never used.

@jackwasey can you shine some light on this?

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

1 participant