Skip to content

Commit b82f374

Browse files
committed
API access issues and query updates
1 parent f1f6ac5 commit b82f374

3 files changed

Lines changed: 34 additions & 7 deletions

File tree

‎DH_Queries.py‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
listSubmissions(status: $status){
1919
submissions{
2020
_id
21+
accessedAt
2122
name
2223
submitterID
2324
submitterName
@@ -252,4 +253,28 @@
252253
}
253254
}
254255
"""
255-
256+
'''study_query = """
257+
{
258+
getMyUser {
259+
userStatus
260+
studies {
261+
_id
262+
controlledAccess
263+
createdAt
264+
dbGaPID
265+
studyName
266+
studyAbbreviation
267+
}
268+
}
269+
}"""
270+
'''
271+
study_query = """
272+
{
273+
getMyUser{
274+
_id
275+
studies{
276+
_id
277+
}
278+
}
279+
}
280+
"""

‎QueryTesting.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,18 @@ def apiQuery(tier, query, variables, queryprint = False):
3737
return(f"HTTP Error: {e}")
3838

3939
#Get a list of projects and put in df
40-
TIER = 'STAGE'
41-
studyjson = apiQuery(TIER, dhq.org_query, None)
40+
#TIER = 'STAGE'
41+
TIER = 'PROD'
42+
#studyjson = apiQuery(TIER, dhq.org_query, None)
43+
studyjson = apiQuery(TIER, dhq.study_query, None)
4244
study_df = pd.DataFrame(studyjson['data']['getMyUser']['studies'])
43-
print(study_df.head())
45+
print(f"GetMyUser results from {TIER}:\n{study_df}")
4446

4547
queryterm = '4f1a7385-bda6-4c07-abd0-49e21ec3c1ce'
4648

4749
subjson = apiQuery(TIER, dhq.list_sub_query, {"status":["All"]})
4850
sub_df = pd.DataFrame(subjson['data']['listSubmissions']['submissions'])
49-
print(sub_df.head)
51+
print(f"ListSubmission results from {TIER}:\n{sub_df}")
5052

51-
working_df = sub_df.loc[sub_df['studyID'] == queryterm]
52-
print(working_df.head)
53+
#working_df = sub_df.loc[sub_df['studyID'] == queryterm]
54+
#print(working_df.head)
109 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)