-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #453 from Ram6911/ramp_remove_email_field_on_source
Removing Participant Email field from Source submitting page
- Loading branch information
Showing
13 changed files
with
22 additions
and
69 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
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
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 |
---|---|---|
|
@@ -170,7 +170,7 @@ paths: | |
|
||
'/accounts/{account_id}/check_duplicate_source': | ||
post: | ||
operationId: microsetta_private_api.api.check_duplicate_source_name_email | ||
operationId: microsetta_private_api.api.check_duplicate_source_name | ||
tags: | ||
- Account | ||
summary: Get information about duplicate source | ||
|
@@ -185,11 +185,8 @@ paths: | |
properties: | ||
participant_name: # Field is named participant_name, but contents are used to fill source's name | ||
$ref: '#/components/schemas/source_name' | ||
participant_email: | ||
$ref: '#/components/schemas/participant_email' | ||
required: | ||
- participant_name | ||
- participant_email | ||
responses: | ||
'200': | ||
description: Successfully returned source information | ||
|
@@ -277,8 +274,6 @@ paths: | |
type: string | ||
participant_name: | ||
type: string | ||
participant_email: | ||
type: string | ||
participant_parent_1: | ||
type: string | ||
participant_parent_2: | ||
|
@@ -325,8 +320,6 @@ paths: | |
$ref: '#/components/schemas/age_range' | ||
participant_name: # Field is named participant_name, but contents are used to fill source's name | ||
$ref: '#/components/schemas/source_name' | ||
participant_email: | ||
$ref: '#/components/schemas/participant_email' | ||
parent_1_name: | ||
$ref: '#/components/schemas/parent_1_name' | ||
parent_2_name: | ||
|
@@ -340,7 +333,6 @@ paths: | |
required: | ||
- age_range | ||
- participant_name | ||
- participant_email | ||
responses: | ||
'201': | ||
description: Successfully created new human source based on consent form | ||
|
@@ -393,13 +385,11 @@ paths: | |
source_name: "Ophelia Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "18-plus" | ||
- source_id: "df077cd7-f2c7-42e4-b8ed-9c7e9dd47ce5" | ||
source_name: "P. Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "0-6" | ||
child_info: | ||
parent_1_name: "Demeter Doe" | ||
|
@@ -2911,10 +2901,6 @@ components: | |
type: string | ||
enum: [human, animal, environmental] | ||
example: human | ||
participant_email: | ||
type: string | ||
format: email | ||
example: "[email protected]" | ||
age_range: | ||
type: string | ||
enum: ["0-6", "7-12", "13-17", "18-plus", "legacy"] | ||
|
@@ -2963,8 +2949,6 @@ components: | |
consent: | ||
type: object | ||
properties: | ||
participant_email: | ||
$ref: '#/components/schemas/participant_email' | ||
age_range: | ||
$ref: '#/components/schemas/age_range' | ||
child_info: | ||
|
@@ -3269,14 +3253,12 @@ components: | |
source_name: "Nell Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "18-plus" | ||
human_child_source: | ||
value: | ||
source_name: "K. Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "7-12" | ||
child_info: | ||
parent_1_name: "Maman Doe" | ||
|
@@ -3294,15 +3276,13 @@ components: | |
source_name: "Nell Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "18-plus" | ||
human_child_source_w_id: | ||
value: | ||
source_id: "b06825c2-e808-4606-8819-861b0fa8a5ce" | ||
source_name: "K. Doe" | ||
source_type: human | ||
consent: | ||
participant_email: "[email protected]" | ||
age_range: "7-12" | ||
child_info: | ||
parent_1_name: "Maman Doe" | ||
|
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 |
---|---|---|
|
@@ -112,7 +112,6 @@ | |
'source_name': 'Bo', | ||
'source_type': 'human', | ||
'consent': { | ||
'participant_email': '[email protected]', | ||
'age_range': "18-plus" | ||
}, | ||
} | ||
|
@@ -968,8 +967,6 @@ def test_account_scrub_success(self): | |
|
||
self.assertEqual(response_obj['source_name'], | ||
'scrubbed') | ||
self.assertEqual(response_obj['consent']['participant_email'], | ||
'[email protected]') | ||
|
||
# pull the sample details | ||
response = self.client.get( | ||
|
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 |
---|---|---|
|
@@ -182,7 +182,7 @@ def setup_test_data(): | |
ACCT_ID, | ||
Source.SOURCE_TYPE_HUMAN, | ||
"Bo", | ||
HumanInfo("[email protected]", False, None, None, | ||
HumanInfo(False, None, None, | ||
False, datetime.datetime.utcnow(), None, | ||
"Mr. Obtainer", | ||
"18-plus") | ||
|
@@ -940,7 +940,6 @@ def test_create_human_source(self): | |
data=json.dumps( | ||
{"age_range": "18-plus", | ||
"participant_name": "Joe Schmoe", | ||
"participant_email": "[email protected]", | ||
"parent_1_name": "Mr. Schmoe", | ||
"parent_2_name": "Mrs. Schmoe", | ||
"deceased_parent": 'false', | ||
|
@@ -987,7 +986,6 @@ def test_delete_source(self): | |
data=json.dumps( | ||
{"age_range": "18-plus", | ||
"participant_name": "Joe Schmoe", | ||
"participant_email": "[email protected]", | ||
"parent_1_name": "Mr. Schmoe", | ||
"parent_2_name": "Mrs. Schmoe", | ||
"deceased_parent": 'false', | ||
|
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 |
---|---|---|
|
@@ -16,7 +16,6 @@ def _source_to_row(s): | |
s.account_id, | ||
s.source_type, | ||
s.name, | ||
getattr(d, 'email', None), | ||
getattr(d, 'is_juvenile', None), | ||
getattr(d, 'parent1_name', None), | ||
getattr(d, 'parent2_name', None), | ||
|
@@ -31,7 +30,6 @@ def _source_to_row(s): | |
|
||
def _row_to_human_info(r): | ||
return HumanInfo( | ||
r['participant_email'], | ||
r['is_juvenile'], | ||
r['parent_1_name'], | ||
r['parent_2_name'], | ||
|
@@ -67,14 +65,14 @@ def __init__(self, transaction): | |
super().__init__(transaction) | ||
|
||
read_cols = "id, account_id, " \ | ||
"source_type, source_name, participant_email, " \ | ||
"source_type, source_name, " \ | ||
"is_juvenile, parent_1_name, parent_2_name, " \ | ||
"deceased_parent, date_signed, date_revoked, " \ | ||
"assent_obtainer, age_range, description, " \ | ||
"creation_time, update_time" | ||
|
||
write_cols = "id, account_id, source_type, " \ | ||
"source_name, participant_email, " \ | ||
"source_name, " \ | ||
"is_juvenile, parent_1_name, parent_2_name, " \ | ||
"deceased_parent, date_signed, date_revoked, " \ | ||
"assent_obtainer, age_range, description" | ||
|
@@ -155,7 +153,7 @@ def create_source(self, source): | |
cur.execute("INSERT INTO source (" + SourceRepo.write_cols + ") " | ||
"VALUES(" | ||
"%s, %s, %s, " | ||
"%s, %s, " | ||
"%s, " | ||
"%s, %s, %s, " | ||
"%s, %s, %s, " | ||
"%s, %s, %s)", | ||
|
@@ -233,7 +231,6 @@ def scrub(self, account_id, source_id): | |
|
||
name = "scrubbed" | ||
description = "scrubbed" | ||
email = "[email protected]" | ||
parent1_name = "scrubbed" | ||
parent2_name = "scrubbed" | ||
assent_obtainer = "scrubbed" | ||
|
@@ -242,15 +239,14 @@ def scrub(self, account_id, source_id): | |
with self._transaction.cursor() as cur: | ||
cur.execute("""UPDATE source | ||
SET source_name = %s, | ||
participant_email = %s, | ||
description = %s, | ||
parent_1_name = %s, | ||
parent_2_name = %s, | ||
date_revoked = %s, | ||
assent_obtainer = %s, | ||
update_time = %s | ||
WHERE id = %s""", | ||
(name, email, description, parent1_name, parent2_name, | ||
(name, description, parent1_name, parent2_name, | ||
date_revoked, assent_obtainer, date_revoked, | ||
source_id)) | ||
|
||
|
@@ -259,17 +255,16 @@ def scrub(self, account_id, source_id): | |
else: | ||
return True | ||
|
||
def get_duplicate_source_name_email(self, account_id, source_name, email): | ||
def get_duplicate_source_name(self, account_id, source_name): | ||
|
||
with self._transaction.dict_cursor() as cur: | ||
cur.execute("SELECT " + SourceRepo.read_cols + | ||
" FROM " | ||
"source " | ||
"WHERE " | ||
"source.account_id = %s " | ||
"AND (source.participant_email ILIKE %s OR" | ||
" source.source_name ILIKE %s)", | ||
(account_id, email, source_name,)) | ||
"AND source.source_name ILIKE %s ", | ||
(account_id, source_name)) | ||
r = cur.fetchone() | ||
if r is None: | ||
return {'source_duplicate': False} | ||
|
Oops, something went wrong.