-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pipeline): cleanup pii detection
* Simplify personal email detection. More false positives in favour of simplicity and speed. * Add unit tests
- Loading branch information
Showing
16 changed files
with
169 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: int__plausible_personal_emails | ||
|
||
- name: int__union_adresses | ||
data_tests: | ||
- check_adresse: | ||
|
@@ -183,8 +181,29 @@ models: | |
min_value: 0 | ||
max_value: 1 | ||
|
||
- name: int__courriels_personnels | ||
columns: | ||
- name: courriel | ||
data_tests: | ||
- not_null | ||
- dbt_utils.not_empty_string | ||
|
||
unit_tests: | ||
- name: test_courriels_personnels | ||
model: int__courriels_personnels | ||
given: | ||
- input: ref('int__union_contacts') | ||
rows: | ||
- {courriel: [email protected]} | ||
- {courriel: [email protected]} | ||
- {courriel: [email protected]} | ||
- input: ref('stg_insee__prenoms') | ||
rows: | ||
- {prenom: jean} | ||
expect: | ||
rows: | ||
- {courriel: [email protected]} | ||
|
||
- name: test_geocodages_full_refresh_mode | ||
model: int__geocodages | ||
overrides: | ||
|
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
pipeline/dbt/models/intermediate/extra/int_extra__insee_prenoms_filtered.sql
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
pipeline/dbt/models/intermediate/int__courriels_personnels.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
WITH contacts AS ( | ||
SELECT * FROM {{ ref('int__union_contacts') }} | ||
), | ||
|
||
insee_prenoms AS ( | ||
SELECT * FROM {{ ref('stg_insee__prenoms') }} | ||
), | ||
|
||
final AS ( | ||
SELECT DISTINCT contacts.courriel | ||
FROM contacts | ||
INNER JOIN insee_prenoms | ||
ON STARTS_WITH(contacts.courriel, (insee_prenoms.prenom || '.')) | ||
WHERE | ||
-- focus on mainstream email providers | ||
SPLIT_PART(SPLIT_PART(contacts.courriel, '@', 2), '.', -2) -- 2nd level domain | ||
IN ( | ||
-- list compiled by looking at most common domains in the dataset | ||
'free', | ||
'gmail', | ||
'hotmail', | ||
'laposte', | ||
'nordnet', | ||
'orange', | ||
'outlook', | ||
'sfr', | ||
'wanadoo', | ||
'yahoo' | ||
) | ||
-- ignore common patterns for non personal emails | ||
AND NOT SPLIT_PART(contacts.courriel, '@', 1) ~ 'mairie|commune|adil|services|ccas' | ||
) | ||
|
||
SELECT * FROM final |
56 changes: 0 additions & 56 deletions
56
pipeline/dbt/models/intermediate/int__plausible_personal_emails.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.