-
Notifications
You must be signed in to change notification settings - Fork 10
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 #149 from seermedical/fix-labelgroups
FIX: only returning subset of labelgroups for study
- Loading branch information
Showing
8 changed files
with
261 additions
and
33 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
Empty file.
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,107 @@ | ||
""" | ||
Data for mocking intermediate function calls, as well as expected return values | ||
when testing the following functions: | ||
- client.get_label_groups_for_studies() | ||
- client.get_label_groups_for_studies_dataframe() | ||
""" | ||
import io | ||
import pandas as pd | ||
|
||
# Individual responses it gets from calling client.get_label_groups_for_study() | ||
individual_study_responses = [ | ||
{ | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "study1_labelgroup1_name", | ||
"description": "study1_labelgroup1_description", | ||
"id": "study1_labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 101, | ||
}, | ||
{ | ||
"name": "study1_labelgroup2_name", | ||
"description": "study1_labelgroup2_description", | ||
"id": "study1_labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 102, | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "study2_id", | ||
"name": "study2_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "study2_labelgroup1_name", | ||
"description": "study2_labelgroup1_description", | ||
"id": "study2_labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 201, | ||
}, | ||
{ | ||
"name": "study2_labelgroup2_name", | ||
"description": "study2_labelgroup2_description", | ||
"id": "study2_labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 202, | ||
} | ||
] | ||
}, | ||
] | ||
|
||
# The expected result from client.get_label_groups_for_studies() | ||
expected_seerpy_response = [ | ||
{ | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "study1_labelgroup1_name", | ||
"description": "study1_labelgroup1_description", | ||
"id": "study1_labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 101, | ||
}, | ||
{ | ||
"name": "study1_labelgroup2_name", | ||
"description": "study1_labelgroup2_description", | ||
"id": "study1_labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 102, | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "study2_id", | ||
"name": "study2_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "study2_labelgroup1_name", | ||
"description": "study2_labelgroup1_description", | ||
"id": "study2_labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 201, | ||
}, | ||
{ | ||
"name": "study2_labelgroup2_name", | ||
"description": "study2_labelgroup2_description", | ||
"id": "study2_labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 202, | ||
} | ||
] | ||
}, | ||
] | ||
|
||
csv = """ | ||
labelGroup.id,labelGroup.name,labelGroup.description,labelGroup.labelType,labelGroup.numberOfLabels,id,name | ||
study1_labelgroup1_id,study1_labelgroup1_name,study1_labelgroup1_description,default,101,study1_id,study1_name | ||
study1_labelgroup2_id,study1_labelgroup2_name,study1_labelgroup2_description,default,102,study1_id,study1_name | ||
study2_labelgroup1_id,study2_labelgroup1_name,study2_labelgroup1_description,default,201,study2_id,study2_name | ||
study2_labelgroup2_id,study2_labelgroup2_name,study2_labelgroup2_description,default,202,study2_id,study2_name | ||
""" | ||
|
||
# The expected result from client.get_label_groups_for_studies_dataframe() | ||
expected_seerpy_df = pd.read_csv(io.StringIO(csv)) |
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,70 @@ | ||
""" | ||
Data for mocking intermediate function calls, as well as expected return values | ||
when testing the following function: | ||
- client.get_label_groups_for_study() | ||
""" | ||
|
||
# Mocked paginated responses on each subsequent call of client.execute_query() | ||
# within the client.get_paginated_response() function that gets called by | ||
# client.get_label_groups_for_study() | ||
raw_paginated_responses = [ | ||
{ | ||
"study": { | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "labelgroup1_name", | ||
"description": "labelgroup1_description", | ||
"id": "labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 2, | ||
}, | ||
] | ||
} | ||
}, | ||
{ | ||
"study": { | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "labelgroup2_name", | ||
"description": "labelgroup2_description", | ||
"id": "labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 5, | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"study": { | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [] | ||
} | ||
}, | ||
] | ||
|
||
# Expected return value when calling client.get_label_groups_for_study() | ||
expected_seerpy_response = { | ||
"id": "study1_id", | ||
"name": "study1_name", | ||
"labelGroups": [ | ||
{ | ||
"name": "labelgroup1_name", | ||
"description": "labelgroup1_description", | ||
"id": "labelgroup1_id", | ||
"labelType": "default", | ||
"numberOfLabels": 2, | ||
}, | ||
{ | ||
"name": "labelgroup2_name", | ||
"description": "labelgroup2_description", | ||
"id": "labelgroup2_id", | ||
"labelType": "default", | ||
"numberOfLabels": 5, | ||
} | ||
] | ||
} |
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