1. GDPR process¶
This module enables the data storage to meet the GDPR compliance requirements by anonymizing historical data in the data warehouse. It consists of multiple components working together to anonymize data. It is designed to anonymize individual data that has been deleted or obscured in source systems. To function correctly, it requires a domain expert familiar with the tables, their meanings and purposes. All configurations are historically recorded to pass potential audit inspections…
1.1. Build GDPR views¶
Before registering the GDPR objects in the metadata, the application manager has to build the “Trigger” view and the “GDPR” view. The “Trigger” views show all BSK’s of an object, e.g. KUNDE, which need to be anonymized. The view contains the logic how to find these BSK’s and must return at least the distinct RED_BSK column. The “GDPR” views list all rows of the PSA object with all columns to be anonymized. The view may only contain the primary key RED_PK and the anonymizing PSA columns with the logic how the column is anonmyized, e.g. date columns are set to the first day of the year’s decade. It is possible that you can use one “Trigger” view for more than one object, but each object has a related “GDPR” view.
The advantage of building these views is that you can see the probaly results immediate without changing any productive data.
Example for a “Trigger” view
1OPEN SCHEMA REDGPR_CUS;
2
3CREATE OR REPLACE VIEW TRG_EMPLOYEES_GDPR
4AS
5WITH lastgpr AS
6 ( -- query for last GDPR run for the selected object
7 SELECT
8 NVL(MAX(gpr_finish), TO_TIMESTAMP('1800-01-01')) AS last_gpr_run
9 FROM
10 redgpr.gpr_control
11 WHERE
12 psa_schema = 'PSA_TEST'
13 AND psa_table = 'EMPLOYEES'
14 AND trg_schema = 'REDGPR_CUS'
15 AND trg_view = 'TRG_EMPLOYEES_GDPR'
16 AND gpr_error_code IS NULL
17 )
18SELECT DISTINCT
19 -- get all relevant distinct BSKs, which meet the relevant GDPR criteria
20 -- e.g. employee relation ended 7 years ago
21 e.red_bsk,
22 l.last_gpr_run,
23 e.enddatum
24FROM
25 psa_test.employees e
26JOIN
27 lastgpr l
28ON
29 e.red_tdate_from >= l.last_gpr_run
30WHERE
31 e.enddatum <= ADD_YEARS(SYSDATE, -7)
32 AND e.red_gpr_run_id IS NULL -- already anonymized data have the value of the GDPR run when anonymizing was done
33;
Example for a “GDPR” view
1OPEN SCHEMA REDGPR_CUS;
2
3CREATE OR REPLACE VIEW TEST_EMPLOYEES_GDPR
4AS
5SELECT
6 -- query all rows, by select the RED_PK column,
7 -- and all relevant columns to be anonymized and the logic for the anonymization
8 e.red_pk,
9 CAST(TO_NUMBER(NULL) AS DECIMAL(8,2)) AS gehalt,
10 CAST(TO_NUMBER(NULL) AS DECIMAL(2,2)) AS provision,
11 '*****' AS vorname,
12 '*****' AS nachname,
13 '*****' AS email,
14 '*****' AS telefon,
15 DATE_TRUNC ('year', e.einstelldatum) AS einstelldatum
16FROM
17 redgpr_cus.trg_employees_gdpr te
18 JOIN
19 psa_test.employees e
20 ON
21 e.red_bsk = te.red_bsk
22 AND e.red_tdate_from >= te.last_gpr_run -- query all data since last GDPR run
23;
When the building of the views are finished and found correctly implemented, the application manager has to add this information to the GDPR metadata using the following API’s
1.2. Adding a “Trigger” view¶
To add a “Trigger” view to the metadata use the script API_REDGPR.ADD_TRG_OBJECT. Two parameters habe to be provided, the view name of the trigger and if the trigger view is active or not.
Example
1EXECUTE SCRIPT API_REDGPR.ADD_TRG_OBJECT(
2 'TRG_KUNDE_DSGVO' -- p_trg_view
3 , FALSE -- p_active
4);
After having issued the command above an entry appears in the table GPR_TRG_OBJECTS.
TRG_SCHEMA |
TRG_VIEW |
ACTIVE |
|---|---|---|
REDGPR_CUS |
TRG_KUNDE_DSGVO |
false |
In the view REDGPR.GPR_CHECK_OBJECTS you find the “Trigger” view and its status and/or possible errors if the view is not built correctly.
1.3. Adding a PSA object¶
The second step is to add the PSA object, to be anonymized, and the relation with which “Trigger” view it is checked for GDPR compliant anonymization and which “GDPR” view is used. To add this information use the script API_REDGPR.ADD_PSA_OBJECT.
Example
1EXECUTE SCRIPT API_REDGPR.ADD_PSA_OBJECT(
2 'PSA_TEST' -- p_psa_schema
3 , 'KUNDE' -- p_psa_table
4 , 'TRG_KUNDE_DSGVO' -- p_trg_view
5 , 'KUNDE_DSGVO' -- p_gpr_view
6 , FALSE -- p_active
7);
After having issued the command above an entry for your “PSA/GDPR” defintion appears in the table GPR_PSA_OBJECTS.
PSA_SCHEMA |
PSA_TABLE |
TRG_SCHEMA |
TRG_VIEW |
GPR_SCHEMA |
GPR_VIEW |
ACTIVE |
|---|---|---|---|---|---|---|
PSA_TEST |
KUNDE |
REDGPR_CUS |
TRG_KUNDE_DSGVO |
REDGPR_CUS |
KUNDE_DSGVO |
false |
In the view REDGPR.GPR_CHECK_OBJECTS you find the “GDPR” view and its status and/or possible errors if the view is not built correctly.
1.4. Checking the GDPR¶
The execution of the GDPR process is controlled by a job, which is maintained in the ADM_JOBS table, and is executed only for active metadata definitions. As this example creates only inactive PSA/GDPR metadata, you can check the results just by querying the “Trigger” and/or “GDPR” view. This is also very helpful if you create this GDPR process in a productive environment, where you can create them as inactive, check your views, and if all if found correct, just ust the MODIFY APis to activate the “Trigger” and “PSA/GDPR” definition.