Skip to content

Commit

Permalink
Merge 6be213a into 67a5393
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandaBirmingham committed Jan 29, 2020
2 parents 67a5393 + 6be213a commit 8a7f9a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
1 change: 1 addition & 0 deletions ci/pip_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pyjwt[crypto]
pytest < 5.3.4
pytest-cov
coveralls
pycountry
11 changes: 6 additions & 5 deletions microsetta_private_api/api/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,13 @@ def render_consent_doc(account_id):
tl=american_gut._NEW_PARTICIPANT)


# This function simply passes its arguments on to the create_source function;
# however, it is necessary because connexion will not allow two endpoints to
# use the same implementation function (it throws an error
# "AssertionError: View function mapping is overwriting an existing endpoint
# function")
def create_human_source_from_consent(account_id, body):
# A human source's participant name becomes the source name. Note pop
# removes the existing `participant_name` key if exists, else errors.
# Not adding any error handling here because if 'participant_name' isn't
# here, we SHOULD be getting an error.
body['source_name'] = body.pop('participant_name')

# NB: Don't expect to handle errors 404, 422 in this function; expect to
# farm out to `create_source`
return create_source(account_id, body)
23 changes: 9 additions & 14 deletions microsetta_private_api/api/microsetta_private_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ paths:
properties: # each is a form field name
age_range:
$ref: '#/components/schemas/age_range'
participant_name:
$ref: '#/components/schemas/participant_name'
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:
Expand Down Expand Up @@ -201,14 +201,12 @@ paths:
source_name: "Ophelia Doe"
source_type: human
consent:
participant_name: "Ophelia Q. Doe"
participant_email: "nunnery@example.com"
age_range: "18-plus"
- source_id: "df077cd7-f2c7-42e4-b8ed-9c7e9dd47ce5"
source_name: "P. Doe"
source_type: human
consent:
participant_name: "Persephone Doe"
participant_email: "pomegranate@example.com"
age_range: "0-6"
child_info:
Expand Down Expand Up @@ -1013,13 +1011,12 @@ components:
type: string
readOnly: true # sent in GET, not in POST/PUT/PATCH
example: "b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b0"
source_name:
type: string
source_type:
type: string
enum: [human, animal, environmental]
example: human
participant_name:
type: string
example: "Hija Doe"
participant_email:
type: string
format: email
Expand Down Expand Up @@ -1048,12 +1045,14 @@ components:
source_type:
type: string
enum: [animal, environmental]
source_name:
source_description:
type: string
nullable: true
example:
source_id: "bda6867f-fb9d-4f21-ba24-5fba64976ee2"
source_name: "office windowsill"
source_type: environmental
source_description: "my office windowsill"
additionalProperties: false
human_source:
type: object
Expand All @@ -1068,8 +1067,6 @@ components:
consent:
type: object
properties:
participant_name:
$ref: '#/components/schemas/participant_name'
participant_email:
$ref: '#/components/schemas/participant_email'
age_range:
Expand Down Expand Up @@ -1229,15 +1226,13 @@ components:
source_name: "Nell Doe"
source_type: human
consent:
participant_name: "Nellie Doe"
participant_email: "nell@example.com"
age_range: "18-plus"
human_child_source:
value:
source_name: "K. Doe"
source_type: human
consent:
participant_name: "Kelly Doe"
participant_email: "kd@kidsmail.com"
age_range: "7-12"
child_info:
Expand All @@ -1249,13 +1244,13 @@ components:
value:
source_name: "Fluffy"
source_type: animal
source_description: "A fluffy cat"
human_adult_source_w_id:
value:
source_id: "5fa970c6-d36b-4d54-9bed-c45c3c85adac"
source_name: "Nell Doe"
source_type: human
consent:
participant_name: "Nellie Doe"
participant_email: "nell@example.com"
age_range: "18-plus"
human_child_source_w_id:
Expand All @@ -1264,7 +1259,6 @@ components:
source_name: "K. Doe"
source_type: human
consent:
participant_name: "Kelly Doe"
participant_email: "kd@kidsmail.com"
age_range: "7-12"
child_info:
Expand All @@ -1277,6 +1271,7 @@ components:
source_id: "42f799a8-e814-4b91-a291-2dbd50fda75d"
source_name: "Fluffy"
source_type: animal
source_description: "A fluffy cat"

securitySchemes:
Oauth2Scheme:
Expand Down

0 comments on commit 8a7f9a5

Please sign in to comment.