Creating a rule to input month of diagnosis

I need help with writing a rule. I have a column in my CRF for capturing the month of diagnosis. However my client wants me to incorporate a rule wherein if the month of diagnosis is unknown they must be able to enter Unk for the month. How can I create a rule wherein I restrict the data entry person from only entering 1-12 for the month and as well as enter Unk if month of diagnosis is not available. I plan on keeping the data type as String but I want to incorporate these rules so that the data entry person does not randomly enter any number. Please help

Comments

  • ebsebs Posts: 126 ✭✭
    You can do that by adding a regular expression in the validation column of the data item
  • e74813e74813 Posts: 11
    Ebs

    I have a Month/Year of diagnosis column in my CRF. How do I tweak the PDATE datatype so that OpenClinica allows me to input UNK-YYYY (incase the month of diagnosis is unknown)? Can you help me with writing the regular expression. Think i was unclear in my previous post. This is what i am needing.
  • GerbenRienkGerbenRienk Posts: 791 ✭✭✭
    Hi,
    What do you think of:
    regexp: /(UNK|Jan|Feb|etc)-[0-9]{4}/
    ?
    Kind regards,
    Gerben Rienk
  • e74813e74813 Posts: 11
    Hi,

    Can we add an expression to the year portion so that it doesn't accept 0000-9999 for the year. I want it to only accept 1900-2029. Just incase the data entry person mistyped. Anything we can add to the above expression to prevent that instance.
  • GerbenRienkGerbenRienk Posts: 791 ✭✭✭
    That would be
    regexp: /(UNK|Jan|Feb|etc)-(19[0-9]{2}|20[0-2][0-9])/
    A great site to test these regular expressions is regexpal.com and if you're old-school like myself you use the "original" one:
    http://regexpal.com.s3-website-us-east-1.amazonaws.com/
  • e74813e74813 Posts: 11
    Hi

    The previous expression you had given me is as follows:

    regexp: /(UNK|Jan|Feb|etc)-[0-9]{4}/

    where i am able to enter UNK for the month if not known, how do i tweek this so that if month and year are unknown I can enter UNK/YYYY without any discrepency being generated ? Thanks
  • ebsebs Posts: 126 ✭✭
    Note that you specified - as the separator originally and then /

    ((UNK|Jan|Feb|etc)-([0-9]{4}))|(UNK/YYYY)

    If it is meant to be - then replace the / with -

    Cheers
    Eric
  • e74813e74813 Posts: 11
    Thank you Eric
Sign In or Register to comment.