Forums: Validation Rule Suggestions
Hi Staffan,
You are correct, rule SD1011 does not currently support intervals. I have updated the regular expression to support the following scenarios:
I'm just not sure whether intervals could be used in all --DUR, --ELTM, and --EVLINT variables, or just --EVLINT. I'll try to clarify this with someone from the SDTM team next week at the CDISC Interchange.
Here is the revised rule:
<val:Regex ID="SD1011" Variable="%Variables[*DUR,*ELTM,*EVLINT]%" Test="(-?P((([0-9]+(\.[0-9]+)?Y)?([0-9]+(\.[0-9]+)?M)?([0-9]+(\.[0-9]+)?D)?(T([0-9]+(\.[0-9]+)?H)?([0-9]+(\.[0-9]+)?M)?([0-9]+S)?)?)|[0-9]+(\.[0-9]+)?W))|((((([0-9][0-9][0-9][0-9])((-(([0][1-9])|([1][0-2])))((-(([0][1-9])|([1-2][0-9])|([3][0-1])))(T((([0-1][0-9])|([2][0-3]))((:([0-5][0-9]))(((:([0-5][0-9]))((\.[0-9]+)?))?)?)?((((\+|-)(([0-1][0-9])|([2][0-3])):[0-5][0-9])|(Z)))?))?)?)?))/((([0-9][0-9][0-9][0-9])((-(([0][1-9])|([1][0-2])))((-(([0][1-9])|([1-2][0-9])|([3][0-1])))(T((([0-1][0-9])|([2][0-3]))((:([0-5][0-9]))(((:([0-5][0-9]))((\.[0-9]+)?))?)?)?((((\+|-)(([0-1][0-9])|([2][0-3])):[0-5][0-9])|(Z)))?))?)?)?)))|(((([0-9][0-9][0-9][0-9])((-(([0][1-9])|([1][0-2])))((-(([0][1-9])|([1-2][0-9])|([3][0-1])))(T((([0-1][0-9])|([2][0-3]))((:([0-5][0-9]))(((:([0-5][0-9]))((\.[0-9]+)?))?)?)?((((\+|-)(([0-1][0-9])|([2][0-3])):[0-5][0-9])|(Z)))?))?)?)?))/(((\+|-)?P(((([0-9]([0-9]+)?)Y)?(([0-9]([0-9]+)?)M)?(([0-9]([0-9]+)?)D)?)(T((([0-9]([0-9]+)?)H)?(([0-9]([0-9]+)?)M)?(([0-9]([0-9]+)?)((\.[0-9]+)?)S)?)?)?|((([0-9]([0-9]+)?)W))))))|((((\+|-)?P(((([0-9]([0-9]+)?)Y)?(([0-9]([0-9]+)?)M)?(([0-9]([0-9]+)?)D)?)(T((([0-9]([0-9]+)?)H)?(([0-9]([0-9]+)?)M)?(([0-9]([0-9]+)?)((\.[0-9]+)?)S)?)?)?|((([0-9]([0-9]+)?)W)))))/((([0-9][0-9][0-9][0-9])((-(([0][1-9])|([1][0-2])))((-(([0][1-9])|([1-2][0-9])|([3][0-1])))(T((([0-1][0-9])|([2][0-3]))((:([0-5][0-9]))(((:([0-5][0-9]))((\.[0-9]+)?))?)?)?((((\+|-)(([0-1][0-9])|([2][0-3])):[0-5][0-9])|(Z)))?))?)?)?))))" Message="Invalid ISO 8601 value" Description="Duration, Elapsed Time, and Interval values must conform to the ISO 8601 international standard." Category="Format" Type="Error" Severity="High"/>
Let me know how this works out.
Thanks,
Max
If I am reading the regular expression above correctly, it appears to allow negative duration for --DUR variable. Unlike --ELTM and --EVLINT, --DUR answers "how long did something last?". Therefore, I would imagine only positive measurements would be logical.
Also, SDTMIG v3.1.2 section 4.1.4.3.1 addresses the validity of this notation for duration: YYYY-MM-DDThh:mm:ss/YYYY-MM-DDThh:mm:ss. Of which, I interpret as not permitted in SDTM (Note: That's not to say we can't use it in --*DTC variables to express uncertainty).
Thoughts?
I believe this rule is wrong:
<val:Regex ID="SD1011" Variable="%Variables[*DUR,*ELTM,*EVLINT]%" Test="-?P((([0-9]+Y)?([0-9]+M)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+S)?)?)|[0-9]+W)" Message="Invalid ISO 8601 value" Description="Duration, Elapsed Time, and Interval values must conform to the ISO 8601 international standard." Category="Format" Type="Error" Severity="High"/>
Why?
I have
CEEVLINT = '2010-06-03T08:41:58/2010-06-03T13:00:21'
and
ZBEVLINT = '2010-06-03T08:56:00/2010-06-03T12:56:00'
I get an ERROR for ZBEVLINT but not for CEEVLINT. CEEVLINT passes this rule:
<ItemDef OID="CE.CEEVLINT" Name="CEEVLINT" DataType="text" Length="200" def:Label="Evaluation Interval"/>
but ZBEVLINT is not predefined as CEEVLINT, so it get stuck in the first rule above that demands a date format (ISO 8601).
The same rule expect a duration to be in ISO 8601?