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 algorithmdate2
: a secondary (dependent) dateminRange
,maxRange
,unit
,roll
: parameters to the Date Shift algorithmintervalRange
:Negative values are not allowed.
A value of zero (0) indicates that the interval between the
date1
anddate2
will also be the interval betweendate1_masked
anddate2_masked
. For example if the unmasked dates were 1970-01-01 and 1970-01-15,unit
was Days, and theintervaleRange
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 betweendate1
anddate2
is 2 and the specifiedintervalRange
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:
If
date2
is not provided (null
), maskdate1
with Date Shift and returnIf
date1
is not provided (null
), maskdate2
with Date Shift and returnCalculated
date1_masked
by applying the Date Shift algorithm todate1
Calculate the set of possible interval adjustment values using the
intervalRange
Using the value of
date2
, select an interval adjustment value from the set of possible interval adjustment valuesCalculate the new interval using the original interval and the selected interval adjustment value
Calculate
date2_masked
usingdate1_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
In the upper right-hand region of the Algorithm tab under Settings, click Add Algorithm.
Select Dependent Date Shift. The "Create Dependent Date Shift Algorithm" pane appears.
Enter an Algorithm Name.
Info: This MUST be unique.
Enter a Description.
Enter a Minimum Range.
Enter a Maximum Range.
Enter an Interval Range.
Configure the Roll.
Choose the Unit of time from the drop-down: Years, Months, Days, Hours, Minutes, or Seconds. .
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