Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sanitise script #2539

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/analytics_hidden_pii.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- family_name
- given_names
- registration_number
- dqt_match
:assessments:
- recommendation_assessor_note
:further_information_request_items:
Expand Down
68 changes: 62 additions & 6 deletions db/scripts/sanitise.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SET
date_of_birth = '2000-01-01',
alternative_given_names = '',
alternative_family_name = '',
dqt_match = '{}',
registration_number = '';

-- AssessmentSectionFailureReason
Expand All @@ -25,7 +26,18 @@ SET
-- no update required

-- Assessment
-- no update required
UPDATE "assessments"
SET
recommendation_assessor_note = CASE WHEN recommendation_assessor_note IS NULL THEN NULL ELSE '[sanitised]' END,
age_range_note = CASE WHEN age_range_note IS NULL THEN NULL ELSE '[sanitised]' END,
qualifications_assessor_note = CASE WHEN qualifications_assessor_note IS NULL THEN NULL ELSE '[sanitised]' END,
subjects_note = CASE WHEN subjects_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- ConsentRequest
UPDATE "consent_requests"
SET
verify_note = CASE WHEN verify_note IS NULL THEN NULL ELSE '[sanitised]' END,
review_note = CASE WHEN review_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- Countries
-- no update required
Expand All @@ -50,18 +62,31 @@ UPDATE "feature_flags_features"
UPDATE "further_information_request_items"
SET
failure_reason_assessor_feedback = CASE WHEN failure_reason_assessor_feedback IS NULL THEN NULL ELSE '[sanitised]' END,
response = CASE WHEN response IS NULL THEN NULL ELSE '[sanitised]' END;
response = CASE WHEN response IS NULL THEN NULL ELSE '[sanitised]' END,
contact_email = CASE WHEN contact_email IS NULL THEN NULL ELSE '[email protected]' END,
contact_name = CASE WHEN contact_name IS NULL THEN NULL ELSE '[sanitised]' END;

-- FurtherInformationRequest
UPDATE "further_information_requests"
SET
failure_assessor_note = CASE WHEN failure_assessor_note IS NULL THEN NULL ELSE '[sanitised]' END;
failure_assessor_note = CASE WHEN failure_assessor_note IS NULL THEN NULL ELSE '[sanitised]' END,
review_note = CASE WHEN review_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- MailDeliveryFailure
DELETE FROM "mail_delivery_failures";

-- Note
UPDATE "notes"
SET
text = CASE WHEN text IS NULL THEN NULL ELSE '[sanitised]' END;

-- ProfessionalStandingRequests
UPDATE "professional_standing_requests"
SET
location_note = CASE WHEN location_note IS NULL THEN NULL ELSE '[sanitised]' END,
review_note = CASE WHEN review_note IS NULL THEN NULL ELSE '[sanitised]' END,
verify_note = CASE WHEN verify_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- Qualification
UPDATE "qualifications"
SET
Expand All @@ -71,11 +96,30 @@ SET
complete_date = '01/01/2002',
certificate_date = '01/01/2002';

-- QualificationRequest
UPDATE "qualification_requests"
SET
review_note = CASE WHEN review_note IS NULL THEN NULL ELSE '[sanitised]' END,
verify_note = CASE WHEN verify_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- Region
-- no update required

-- ReferenceRequest
-- no update required
UPDATE "reference_requests"
SET
additional_information_response = CASE WHEN additional_information_response IS NULL THEN NULL ELSE '[sanitised]' END,
children_comment = CASE WHEN children_comment IS NULL THEN NULL ELSE '[sanitised]' END,
contact_comment = CASE WHEN contact_comment IS NULL THEN NULL ELSE '[sanitised]' END,
dates_comment = CASE WHEN dates_comment IS NULL THEN NULL ELSE '[sanitised]' END,
hours_comment = CASE WHEN hours_comment IS NULL THEN NULL ELSE '[sanitised]' END,
lessons_comment = CASE WHEN lessons_comment IS NULL THEN NULL ELSE '[sanitised]' END,
misconduct_comment = CASE WHEN misconduct_comment IS NULL THEN NULL ELSE '[sanitised]' END,
reports_comment = CASE WHEN reports_comment IS NULL THEN NULL ELSE '[sanitised]' END,
review_note = CASE WHEN review_note IS NULL THEN NULL ELSE '[sanitised]' END,
satisfied_comment = CASE WHEN satisfied_comment IS NULL THEN NULL ELSE '[sanitised]' END,
verify_note = CASE WHEN verify_note IS NULL THEN NULL ELSE '[sanitised]' END,
slug = CASE WHEN slug IS NULL THEN NULL ELSE concat('slug-', id) END;

-- ReminderEmail
-- no update required
Expand Down Expand Up @@ -107,16 +151,27 @@ SET
UPDATE "teachers"
SET
email = CASE WHEN email IS NULL THEN NULL ELSE CONCAT('teacher', id, '@example.com') END,
canonical_email = CASE WHEN email IS NULL THEN NULL ELSE CONCAT('teacher', id, '@example.com') END,
gov_one_email = CASE WHEN email IS NULL THEN NULL ELSE CONCAT('teacher', id, '@example.com') END,
email_domain = CASE WHEN email IS NULL THEN NULL ELSE '@example.com' END,
access_your_teaching_qualifications_url = CASE WHEN access_your_teaching_qualifications_url IS NULL THEN NULL ELSE '[sanitised]' END,
current_sign_in_ip = '0.0.0.0',
last_sign_in_ip = '0.0.0.0';

-- TimelineEvent
UPDATE "timeline_events"
SET
annotation = CASE WHEN annotation IS NULL THEN NULL ELSE '[sanitised]' END;
annotation = CASE WHEN annotation IS NULL THEN NULL ELSE '[sanitised]' END,
age_range_note = CASE WHEN age_range_note IS NULL THEN NULL ELSE '[sanitised]' END,
new_value = CASE WHEN new_value IS NULL THEN NULL ELSE '[sanitised]' END,
old_value = CASE WHEN old_value IS NULL THEN NULL ELSE '[sanitised]' END,
note_text = CASE WHEN note_text IS NULL THEN NULL ELSE '[sanitised]' END,
subjects_note = CASE WHEN subjects_note IS NULL THEN NULL ELSE '[sanitised]' END;

-- Uploads
-- no update required
UPDATE "uploads"
SET
filename = CASE WHEN filename IS NULL THEN NULL ELSE '[sanitised]' END;

-- WorkHistory
UPDATE "work_histories"
Expand All @@ -125,4 +180,5 @@ SET
city = '[sanitised]',
job = '[sanitised]',
contact_email = '[email protected]',
canonical_contact_email = '[email protected]',
contact_name = '[sanitised]';
Loading