cdisc-org / cdisc-rules-engine

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

Rule blocked: CORERULES-530 #707

Open KapiTati opened 1 month ago

KapiTati commented 1 month ago

Links to related JIRA Tickets

Rule Information

Describe the bug I noticed that 'dy' operator works incorrectly if the --DTC and RFSTDTC has different time parts, for instance, if --DTC="2022-05-19T13:50", RFSTDTC="2022-05-20T13:44", this operator returns -2 instead of -1.

Expected behavior The study day should not depend on time.

chowsanthony commented 1 month ago

The algorithm, per section 4.4.4, SDTMIG v3.4. The same applies to SENDIG:

All study day values are integers. Thus, to calculate Study Day:

--DY = (date portion of --DTC) - (date portion of RFSTDTC) + 1 if --DTC is on or after RFSTDTC --DY = (date portion of --DTC) - (date portion of RFSTDTC) if --DTC precedes RFSTDTC

This method should be used across all domains.

chowsanthony commented 1 month ago

The algorithm, per section 4.4.4, SDTMIG v3.4. The same applies to SENDIG:

All study day values are integers. Thus, to calculate Study Day: --DY = (date portion of --DTC) - (date portion of RFSTDTC) + 1 if --DTC is on or after RFSTDTC --DY = (date portion of --DTC) - (date portion of RFSTDTC) if --DTC precedes RFSTDTC This method should be used across all domains.

Programming logic appears correct in cdisc_rules_engine/operations/day_data_validator.py - @KapiTati can you please upload your test data for SEND71.1 to SharePoint so we inspect if there are other factors? TIA.

KapiTati commented 1 month ago

Sure, it's there under SENDIG\SENDIG071\positive\03\data For instance, for VSSEQ=2: "$val_dy":-2 (calculated with 'dy' operator) "RFSTDTC":"2012-11-30T20:00" "VSDTC":"2012-11-29T13:00" "VSDY":-1 (what I expect to get)

VSSEQ=3: "$val_dy":-1 (calculated with 'dy' operator) "RFSTDTC":"2012-11-30T20:00" "VSDTC":"2012-11-30" "VSDY":1 (what I expect to get)