Skip to main content
Skip table of contents

Dependent Date Shift (Algorithm frameworks)

The Dependent Date Shift algorithm masks two dates while maintaining a dependency between them. Examples of such dependent date pairs include:

  • date of admission and date of discharge

  • date of birth and date of death. 

If dependent date pairs are masked independently, two problems can occur. First, the chronological order of the dates might be reversed. For example, the masked date of discharge might be chronologically earlier than the masked date of admission. Second, the interval between the masked dates might be too small or too large. By interval, we mean the difference in time between two dates. For example, suppose a given patient’s record has an 80 year interval between date of birth and date of death. Independently masking the date of birth and date of death might result in a 5 month interval. This would turn an 80 year old patient into a 5 month old patient which might make the patient ineligible for certain procedures, benefits, etc. 

The Dependent Date Shift algorithm addresses these problems by masking dependent date pairs while:

  • maintaining the chronological relationship between the dates (i.e., the later date always stays later)

  • maintaining a configurable interval between the dates

The Dependent Date Shift algorithm takes as input: 

  • date1: a primary date that will be masked with the Date Shift algorithm

  • date2: a secondary (dependent) date

  • minRange, maxRange, unit, roll: parameters to the Date Shift algorithm

  • intervalRange

    • Negative values are not allowed.

    • A value of zero (0) indicates that the interval between the date1 and date2 will also be the interval between date1_masked and date2_masked. For example if the unmasked dates were 1970-01-01 and 1970-01-15, unit was Days, and the intervaleRange was 0, then the interval between the unmasked dates is 14 days and that would also be the interval between the masked dates. 

    • Values greater than zero (0) generate an inclusive set of possible interval adjustment values. For example, a value of 3 would generate the following set of possible interval adjustment values: [-3, -2, -1, 0, 1, 2, 3]. The generated set is automatically adjusted to omit any values that would change the chronological order of the dates. For example, if the interval difference between date1 and date2 is 2 and the specified intervalRange is 3, then the set of possible interval adjustment values would be [-1, 0, 1, 2, 3].

At a high level, the masking process is as follows:

  1. If date2 is not provided (null), mask date1 with Date Shift and return

  2. If date1 is not provided (null), mask date2 with Date Shift and return

  3. Calculated date1_masked by applying the Date Shift algorithm to date1

  4. Calculate the set of possible interval adjustment values using the intervalRange

  5. Using the value of date2, select an interval adjustment value from the set of possible interval adjustment values

  6. Calculate the new interval using the original interval and the selected interval adjustment value

  7. Calculate date2_masked using date1_masked and the new interval

The masked results are deterministic for the same algorithm key and inputs. The algorithm’s output will  never be equal to the input. 

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 Dependent Date Shift. 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.

  6. Enter a Maximum Range.

  7. Enter an Interval Range.

  8. Configure the Roll.

  9. Choose the Unit of time from the drop-down: Years, Months, Days, Hours, Minutes, or Seconds. .

  10. When you are finished, click Save.

For information on creating Dependent 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 Range value of 3, a Maximum Range 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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.