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

?! doesn't work #153

Open
samlipworth opened this issue Feb 14, 2022 · 3 comments
Open

?! doesn't work #153

samlipworth opened this issue Feb 14, 2022 · 3 comments

Comments

@samlipworth
Copy link

Trying to code a custom scheme (diabetes complication severity) - trying to use ?! as not followed by - the visualise command recognises this correctly but then I get an error when trying to run - any ideas?

Classification based on: icd10
Error in grepl(paste(cc[[attr(cc, "regexpr")]], collapse = "|"), codified$code) :
invalid regular expression '^(E08(31|32|33|36|37|38|39)|E09(31|32|33|36|37|38|39)|E10(31|32|33|36|37|38|39)|E11(31|32|33|36|37|38|39)|E13(31|32|33|36|37|38|39))|^(H350)|^(H3535)|^(H35(6|8|9))|^(H33)|^(E08(34|35)|E09(34|35)|E10(34|35)|E11(34|35)|E13(34|35))|^(H54)|^(H431)|^(E08(21|22|29)|E09(21|22|29)|E10(21|22|29)|E11(21|22|29)|E13(21|22|29))|^(N00)|^(N04)|^(N03)|^(N05)|^(N18(1|2|3|9))|^(N18(4|5|6))|^(N19)|^(E08(4)|E09(4)|E10(4)|E11(4)|E13(4))|^(G90(09|8|9)|G99)|^(G56)|^(G57)|^(G609)|^(G733)|^(G9001)|^(H49)|^(I951)|^(K3184)|^(K591)|^(N319)|^(M316)|^(S04)|^(G45)|^(I6(1|3|5|6)|I6781)|^(I2(4|0|5(?!2)))', reason 'Invalid regexp'
In addition: Warning message:
In grepl(paste(cc[[attr(cc, "regexpr")]], collapse = "|"), codified$code) :
TRE pattern compilation error 'Invalid regexp'

@samlipworth
Copy link
Author

e.g.
group,icd10,dcsi
CV_IHD,I2(4|0|5(?!2)),1

@samlipworth
Copy link
Author

samlipworth commented Feb 14, 2022

looks like this is a wider problem - R regex doesn't do lookaheads - could add an option to turn on perl? Workaround for now is to filter out any excluded codes before running CodeR.

@eribul
Copy link
Contributor

eribul commented Feb 15, 2022

Thank you very much for your report! You are right that perl is turned off (as stated in the details section of ?classcodes).
This is unfortunate! I remember that this was not true initially and that many of the included regex:s included \\d and \\w etc. For some reasons this didn't work. I remember that I did try to fix this but didn't succed. Unfortenately, I did not document this. In the end, I just decided to turn off perl as a quick and dirty solution which worked. I am currently on parental leave with limited possibilities to investigate this further. But please feel free to submit a pull request if you would have the time!

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