cdisc-org / cdisc-rules-engine

Open source offering of the cdisc rules engine
MIT License
50 stars 12 forks source link

operator invalid_date causes exception for e.g. "2022-05-08T13:44:a" and misses times > 59 seconds #125

Closed JozefAerts closed 2 years ago

JozefAerts commented 2 years ago

When testing rule SENDIG66, and using operator "invalid_date" I get an exception with message "int() argument must be a string, a bytes-like object or a number, not 'NoneType'" for a invalid datetime like "2022-05-08T13:44:a".'

I also see that no violation is reported when the seconds part is larger than 59, e.g. for "2022-05-08T13:44:66".

I haven't checked yet for other things like February 30, e.g. 2022-02-20 though.

nhaydel commented 2 years ago

I tested, with the string "2022-05-08T13:44:a" and an error was reported successfully by the business rules. This likely means that the engine is having trouble processing the provided sample data. Can you include the sample data you are sending in the issue?

nhaydel commented 2 years ago

Fixes for non reported errors can be tracked here: https://github.com/cdisc-org/business-rules/pull/53

JozefAerts commented 2 years ago

Here are the test data (attached) unit-test-coreid-SENDIG_66_1-negative_causes_exceptions.xlsx

nhaydel commented 2 years ago

@JozefAerts the issue for invalid_dates is resolved. The exception you are seeing is caused by the SEQ value being populated for some records and not for others. If you populate the SEQ column in your datasets it works. I have updated the invalid_date operator to better handle missing dates. I will create another issue for the SEQ problem, but hopefully this unblocks this rule