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

Fix edge case where code in multiple letter chapter is not found if the numeric part is over the end digit of the chapter. #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Pooppap
Copy link

@Pooppap Pooppap commented May 10, 2023

I.e. if the ICD code is "C85.1", the previous version "in_chapter" function will return false on the "C00-D48" code block even though "C85.1" belong to that code block. This pull request proposes a fix to the issue while preserving the default behaviour for other non-edge cases.

@wbazant
Copy link

wbazant commented Oct 17, 2023

I did something slightly different, modifying the bounds check:

       if salpha == ealpha:
            return alpha == salpha and snumeric <= numeric <= enumeric
        else:
            return (salpha <= alpha < ealpha and snumeric <= numeric) or (salpha < alpha <= ealpha and numeric <= enumeric)

This was before I saw your solution to the same problem which the bounds to 100. Posted the whole code in #1 (comment).

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

Successfully merging this pull request may close these issues.

2 participants