Partial date comparison

Compare two date questions where at least one of the dates is a partial date and raise a query if the dates are not as expected.

Rule description: the AE Start Date must be on or after the Date of Informed Consent.

Note:

If any parts of the AE Start date are unknown (UNK), compare the available parts of the date.

Rule expression

//to meet the rule description criteria 'aestdt >= infconsdt' should be met
if(getDatesCompareResult(aestdt,true,infconsdt,false,">="))
 {
  return true;
 }
 else
 {
  return false;          //System sends query when return false condition is met
 }

Query message: Do not record events starting before the Date of Informed Consent. If dates are correct, move to Medical history. Otherwise, correct dates.

Definitions

aestdt

Corresponds to the AE Start Date from the rule description.

infconsdt

Corresponds to the Date of Informed Consent from the rule description.

getDatesCompareResult( )

Compares two dates (aestdt, infconsdt) using the passed in operator (>=), in this case: aestdt >= infconsdt.

Return value

Boolean

Returns either true or false. System raises query when return false condition is met.

Usage tips

  • Always use the relevant date helper function to compare dates rather than comparing the variables directly using comparison operators.
  • Use this when you want to perform a comparison for date questions where at least one of the dates is a partial date.

Verification steps

  1. Using a subject for testing, go to the given visit and form containing the date items to compare, in this example the AE start date <aestdt> and date of informed consent <infconsdt>.
  2. Update the form items aestdt and infconsdt as in the following table and verify the result is as listed:
    aestdt infconsdt Result
    Null 02-Dec-2021 No query
    02-Dec-2021 02-Dec-2021 No query
    01-Dec-2021 02-Dec-2021 Query
    UNK-Dec-2021 02-Dec-2021 No query
    UNK-Nov-2021 02-Dec-2021 Query
    03-Dec-2021 02-Dec-2021 No query
    03-Dec-2021 05-Dec-2021 Query
    03-Dec-2021 02-Dec-2021 No query
    03-Dec-2021 01-Jan-2022 Query
    03-Dec-2021 04-Dec-2021 Query
    03-Dec-2021 Null No query
    03-Dec-2021 02-Dec-2021 No query
    01-Dec-2021 02-Dec-2021 Query

Note:

Repeat the above steps if the form is present in multiple visits.

Other examples

Example 4-17 AE Start Date must not be greater than Date of Death

if(getDatesCompareResult(aestdt,true,deathdt,false,'<=')
{
  return true;
}
else
{
  return false;
}

Query message: Start date of AE is greater than date of death. Please reconcile.

Example 4-18 AE Stop Date must be greater than AE Start Date

if(getDatesCompareResult(aestpdt,true,aestdt,true,'>=')
{
  return true;
}
else
{
  return false;
}

Query message: Stop Date is prior to Start Date. Please correct.

Example 4-19 AE Stop Date must not be greater than Date of Death

if(getDatesCompareResult(aestpdt,true,deathdt,false,'<=')
{
  return true;
}
else
{
  return false;
}

Query message: Stop Date of AE is greater than date of death. Please reconcile.