Dependent Date Shift¶
The Dependent Date Shift algorithm provides a method to manipulate dates together where a depdendency exists between the two dates that must be maintained. Examples of this include date of admission and date of discharge or date of birth and date of death. If we were to attempt to mask these dates indepdendently, we may end up with a situation where a latter date such as date of discharge, was masked to be earlier than date of admission. If we were dealing with date of birth and date of death we may end up masking the values in a way that turns an 80 year old into a 5 month old. To this end, the Dependent Date Shift algorithm provides a way to mask these dependent dates in a way that:
 maintains the relationship between the dates (ie: the later date always stays later)
 maintains an approximate interval between the dates, within a provided
intervalRange
/unit
combination
The Dependent Date Shift algorithm takes in 2 dates (designated date1
and date2
). It masks date1
based
on the provided values for minRange
, maxRange
, unit
and roll
. It then modifies the original interval
based on intervalRange
and unit to calculate date2
. If the dates differ but the returned interval is
zero (i.e.: the difference between the dates is smaller than the interval value), we assume the interval
value to be 1 if date2
is later than date1
and 1 if date1
is later than date2
.
The masked results are deterministic for each pair of inputs with the same algorithm key and date and
interval ranges. The algorithm does not allow for zero mask so all masked values will never be equal
to the input. If date1
is not provided, date2
will be masked based on the provided values for minRange
,
maxRange
, unit
and roll
.
Creating a Dependent Date Shift Algorithm via UI¶

In the upper righthand region of the Algorithm tab under Settings, click Add Algorithm.

Select DependentDateShift. The "Create Dependent Date Shift Algorithm" pane appears.

Enter an Algorithm Name.
Info
This MUST be unique.

Enter a Description.

Enter a Minimum Range. This number represents the smallest number of time units that will be added to
date1
when masking. The range is inclusive of this value. Negative values represent units of time in the past and positive values represent units of time in the future. Ifdate1
is not provided, this is applied todate2
. 
Enter a Maximum Range. This number represents the largest number of time units that will be added to
date1
when masking. The range is inclusive of this value. Negative values represent units of time in the past and positive values represent units of time in the future. Ifdate1
is not provided, this is applied todate2
. 
Enter an Interval Range. A number representing the +/ range value to shift the interval inclusive of the range value. A value of 0 will not change the interval between dates. This number may not be less than 0. If the specified unit difference between date1 and date2 is within the bound of the intervalRange, only values will be provided such that the sign of the difference is preserved. For example, if the day difference between
date1
anddate2
is 2 and the specified intervalRange is 3, only values greater than 2 will be used (i.e.: 1 to 3). Otherwise, the full range of values will be used (i.e.: 3 to 3). 
Check the Roll box to preserve all units of time larger and smaller than the specified unit. Only the value of the specified unit will change. This option is supported for units months, days, hours, minutes, and seconds. This applies when masking
date1
. Ifdate1
is not provided, this is applied todate2
. 
Choose the Unit of time from the dropdown: Years, Months, Days, Hours, Minutes, or Seconds. This represents the unit of time the range is expressed in. This unit is also used to determine the interval between
date1
anddate2
. 
When you are finished, click Save.
For information on creating Date Shift algorithms through the API, see API Calls for Creating Algorithms  Dependent Date Shift.
Examples¶
As an example, a Dependent Date Shift algorithm with a minimum value of 3 and a maximum value of 5 and an interval Range of 5 with the unit set to Days will shift the date1 input value by 3 to 5 days into the future. It will then change the interval by a range of +/5 days from the original interval to mask date2. Dates may mask as follows:
 19051210 00:00:00, 19070801 10:14:00 → 19051213 00:00:00, 19070806 00:00:00
 20010731 23:45:30, 20050412 07:13:00 → 20010803 23:45:30, 20050412 23:45:30
 20210203 12:30:00, 20210207 12:34:00 → 20210206 12:30:00, 20210214 12:30:00
With roll enabled and the same configuration, a date at the end of a month will wrap around to the beginning of the month. Dates may mask as follows:
 19051210 00:00:00, 19070801 10:14:00 → 19051213 00:00:00, 19070804 00:00:00
 20010731 23:45:30, 20050412 07:13:00 → 20010703 23:45:30, 20050318 23:45:30
 20210203 12:30:00, 20210207 12:34:00 → 20210206 12:30:00, 20210214 12:30:00
All inputs with the same value masked with the same algorithm configuration will result in the same output values.