Skip to content

Dependent Date Shift

Extensible Algorithm Framework

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

  1. In the upper right-hand region of the Algorithm tab under Settings, click Add Algorithm.

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

  3. Enter an Algorithm Name.

    Info

    This MUST be unique.

  4. Enter a Description.

  5. 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. If date1 is not provided, this is applied to date2.

  6. 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. If date1 is not provided, this is applied to date2.

  7. 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 and date2 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).

  8. 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. If date1 is not provided, this is applied to date2.

  9. Choose the Unit of time from the drop-down: 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 and date2.

  10. 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:

  • 1905-12-10 00:00:00, 1907-08-01 10:14:00 → 1905-12-13 00:00:00, 1907-08-06 00:00:00
  • 2001-07-31 23:45:30, 2005-04-12 07:13:00 → 2001-08-03 23:45:30, 2005-04-12 23:45:30
  • 2021-02-03 12:30:00, 2021-02-07 12:34:00 → 2021-02-06 12:30:00, 2021-02-14 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:

  • 1905-12-10 00:00:00, 1907-08-01 10:14:00 → 1905-12-13 00:00:00, 1907-08-04 00:00:00
  • 2001-07-31 23:45:30, 2005-04-12 07:13:00 → 2001-07-03 23:45:30, 2005-03-18 23:45:30
  • 2021-02-03 12:30:00, 2021-02-07 12:34:00 → 2021-02-06 12:30:00, 2021-02-14 12:30:00

All inputs with the same value masked with the same algorithm configuration will result in the same output values.