This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hashed email and phone fields to Data Labs output
We want an anonymised means to identify when the same email and phone have been used to submit multiple questions. This is done by applying a SHA256 hash function to the email and phone number fields. When doing analysis on the data these fields can be compared to identify where a single person may be skewing the data. In putting this in it is understood that it is valid for users to submit multiple questions and that that this mechanism to tag an individual question submitter is not useful if someone enters different emails/phone numbers each time. More this is put in as an additional tool to help make sense of the data submitted to help trends. To keep a reasonable degree of anonymity on the hashes they are hashed with a secret key. This is so that only owners of the secret key can identify that a particular email address has asked a question. This does unfortunately mean that we need yet another environment variable. I set this as a rather generic name, SECRET_KEY, so that it could be re-used if we need to do anything else with a secret key.
- Loading branch information
Showing
5 changed files
with
38 additions
and
10 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 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 |
---|---|---|
|
@@ -18,11 +18,17 @@ | |
end | ||
|
||
describe "#data_labs" do | ||
it "returns a csv of completed records formatted for data labs" do | ||
expect(builder.data_labs).to eq( | ||
"submission_time,region,question,question_format\n" \ | ||
"01/05/2020 09:00:00,Scotland,A question?,\"In writing, to be read out at the press conference\"\n", | ||
) | ||
let(:secret_key) { SecureRandom.uuid } | ||
let(:hashed_email) { Digest::SHA256.hexdigest("[email protected]" + secret_key) } | ||
let(:hashed_phone) { Digest::SHA256.hexdigest("+447123456789" + secret_key) } | ||
|
||
it "returns a csv of completed records with hashed emails and phone numbers for Data Labs" do | ||
ClimateControl.modify(SECRET_KEY: secret_key) do | ||
expect(builder.data_labs).to eq( | ||
"submission_time,region,question,question_format,hashed_email,hashed_phone\n" \ | ||
"01/05/2020 09:00:00,Scotland,A question?,\"In writing, to be read out at the press conference\",#{hashed_email},#{hashed_phone}\n", | ||
) | ||
end | ||
end | ||
end | ||
|
||
|
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
THIRD_PARTY_DRIVE_FOLDER: "third-party-folder-id", | ||
THIRD_PARTY_RECIPIENTS: "[email protected]", | ||
OUTPUT_DIR: tmpdir, | ||
SECRET_KEY: SecureRandom.uuid, | ||
SINCE_TIME: "2020-05-06 20:00", | ||
UNTIL_TIME: "2020-05-07 11:00") { example.run } | ||
end | ||
|
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