-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
executable file
·324 lines (301 loc) · 20.7 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import graphene
###################
# DEFINING MODELS #
###################
# This section will contain all the necessary models needed to populate the schema
class Project(graphene.ObjectType): # Graphene object for node
projectId = graphene.String(name="project_id")
primarySite = graphene.String(name="primary_site")
name = graphene.String()
studyName = graphene.String(name="study_name")
studyFullName = graphene.String(name="study_full_name")
class Pagination(graphene.ObjectType): # GDC expects pagination data for populating table
count = graphene.Int()
sort = graphene.String()
fromNum = graphene.Int(name="from")
page = graphene.Int()
total = graphene.Int()
pages = graphene.Int()
size = graphene.Int()
class CaseHits(graphene.ObjectType): # GDC defines hits as matching Project node + Case ID (in our case sample ID)
project = graphene.Field(Project)
caseId = graphene.String(name="case_id")
visitNumber = graphene.String(name="visit_number")
subjectId = graphene.String(name="subject_id")
class IndivFiles(graphene.ObjectType): # individual files to populate all files list
dataType = graphene.String(name="data_type")
fileName = graphene.String(name="file_name")
dataFormat = graphene.String(name="data_format")
access = graphene.String() # only exists for consistency with GDC
fileId = graphene.String(name="file_id")
fileSize = graphene.Int(name="file_size")
class Analysis(graphene.ObjectType):
updatedDatetime = graphene.String(name="updated_datetime")
workflowType = graphene.String(name="workflow_type")
analysisId = graphene.String(name="analysis_id")
inputFiles = graphene.List(IndivFiles, name="input_files")
class AssociatedEntities(graphene.ObjectType):
entityId = graphene.String(name="entity_id")
caseId = graphene.String(name="case_id")
entityType = graphene.String(name="entity_type")
class FileHits(graphene.ObjectType): # GDC defined file hits for data type, file name, data format, and more
dataType = graphene.String(name="data_type")
fileName = graphene.String(name="file_name")
md5sum = graphene.String()
dataFormat = graphene.String(name="data_format")
submitterId = graphene.String(name="submitter_id")
state = graphene.String()
access = graphene.String()
fileId = graphene.String(name="file_id")
dataCategory = graphene.String(name="data_category")
experimentalStrategy = graphene.String(name="experimental_strategy")
fileSize = graphene.Float(name="file_size")
cases = graphene.List(CaseHits)
associatedEntities = graphene.List(AssociatedEntities, name="associated_entities")
analysis = graphene.Field(Analysis)
class Bucket(graphene.ObjectType): # Each bucket is a distinct property in the node group
key = graphene.String()
docCount = graphene.Int(name="doc_count")
class BucketCounter(graphene.ObjectType): # List of Buckets
buckets = graphene.List(Bucket)
class Aggregations(graphene.ObjectType): # Collecting lists of buckets (BucketCounter)
# Specifying name= here overrides the automatic snake casing of graphene
file_annotation_pipeline = graphene.Field(BucketCounter, name="file_annotation_pipeline")
file_format = graphene.Field(BucketCounter, name="file_format")
file_id = graphene.Field(BucketCounter, name="file_id")
file_matrix_type = graphene.Field(BucketCounter, name="file_matrix_type")
file_type = graphene.Field(BucketCounter, name="file_type")
project_name = graphene.Field(BucketCounter, name="project_name")
project_subtype = graphene.Field(BucketCounter, name="project_subtype")
sample_biome = graphene.Field(BucketCounter, name="sample_biome")
sample_body_product = graphene.Field(BucketCounter, name="sample_body_product")
sample_body_site = graphene.Field(BucketCounter, name="sample_body_site")
sample_collection_date = graphene.Field(BucketCounter, name="sample_collection_date")
sample_env_package = graphene.Field(BucketCounter, name="sample_env_package")
sample_feature = graphene.Field(BucketCounter, name="sample_feature")
sample_fecalcal = graphene.Field(BucketCounter, name="sample_fecalcal")
sample_geo_loc_name = graphene.Field(BucketCounter, name="sample_geo_loc_name")
sample_id = graphene.Field(BucketCounter, name="sample_id")
sample_lat_lon = graphene.Field(BucketCounter, name="sample_lat_lon")
sample_material = graphene.Field(BucketCounter, name="sample_material")
sample_rel_to_oxygen = graphene.Field(BucketCounter, name="sample_rel_to_oxygen")
sample_samp_collect_device = graphene.Field(BucketCounter, name="sample_samp_collect_device")
sample_samp_mat_process = graphene.Field(BucketCounter, name="sample_samp_mat_process")
sample_samp_size = graphene.Field(BucketCounter, name="sample_samp_size")
sample_subtype = graphene.Field(BucketCounter, name="sample_subtype")
sample_supersite = graphene.Field(BucketCounter, name="sample_supersite")
study_center = graphene.Field(BucketCounter, name="study_center")
study_contact = graphene.Field(BucketCounter, name="study_contact")
study_description = graphene.Field(BucketCounter, name="study_description")
study_name = graphene.Field(BucketCounter, name="study_name")
study_srp_id = graphene.Field(BucketCounter, name="study_srp_id")
study_subtype = graphene.Field(BucketCounter, name="study_subtype")
subject_aerobics = graphene.Field(BucketCounter, name="subject_aerobics")
subject_alcohol = graphene.Field(BucketCounter, name="subject_alcohol")
subject_allergies = graphene.Field(BucketCounter, name="subject_allergies")
subject_asthma = graphene.Field(BucketCounter, name="subject_asthma")
subject_cad = graphene.Field(BucketCounter, name="subject_cad")
subject_chf = graphene.Field(BucketCounter, name="subject_chf")
subject_comment = graphene.Field(BucketCounter, name="subject_comment")
subject_contact = graphene.Field(BucketCounter, name="subject_contact")
subject_diabetes = graphene.Field(BucketCounter, name="subject_diabetes")
subject_education = graphene.Field(BucketCounter, name="subject_education")
subject_family_history = graphene.Field(BucketCounter, name="subject_family_history")
subject_father = graphene.Field(BucketCounter, name="subject_father")
subject_gallbladder = graphene.Field(BucketCounter, name="subject_gallbladder")
subject_gender = graphene.Field(BucketCounter, name="subject_gender")
subject_hyperlipidemia = graphene.Field(BucketCounter, name="subject_hyperlipidemia")
subject_hypertension = graphene.Field(BucketCounter, name="subject_hypertension")
subject_id = graphene.Field(BucketCounter, name="subject_id")
subject_illicit_drug = graphene.Field(BucketCounter, name="subject_illicit_drug")
subject_kidney = graphene.Field(BucketCounter, name="subject_kidney")
subject_liver = graphene.Field(BucketCounter, name="subject_liver")
subject_lmp = graphene.Field(BucketCounter, name="subject_lmp")
subject_mother = graphene.Field(BucketCounter, name="subject_mother")
subject_occupation = graphene.Field(BucketCounter, name="subject_occupation")
subject_osa = graphene.Field(BucketCounter, name="subject_osa")
subject_pancreatitis = graphene.Field(BucketCounter, name="subject_pancreatitis")
subject_postmenopausal = graphene.Field(BucketCounter, name="subject_postmenopausal")
subject_pvd = graphene.Field(BucketCounter, name="subject_pvd")
subject_race = graphene.Field(BucketCounter, name="subject_race")
subject_rx = graphene.Field(BucketCounter, name="subject_rx")
subject_subtype = graphene.Field(BucketCounter, name="subject_subtype")
subject_survey_id = graphene.Field(BucketCounter, name="subject_survey_id")
subject_tobacco = graphene.Field(BucketCounter, name="subject_tobacco")
subject_uuid = graphene.Field(BucketCounter, name="subject_uuid")
tag_term = graphene.Field(BucketCounter, name="tag_term")
visit_30m_gluc = graphene.Field(BucketCounter, name="visit_30m_gluc")
visit_60m_gluc = graphene.Field(BucketCounter, name="visit_60m_gluc")
visit_abdominal_pain = graphene.Field(BucketCounter, name="visit_abdominal_pain")
visit_abx = graphene.Field(BucketCounter, name="visit_abx")
visit_activity_30d = graphene.Field(BucketCounter, name="visit_activity_30d")
visit_activity_3m = graphene.Field(BucketCounter, name="visit_activity_3m")
visit_activity_change_30d = graphene.Field(BucketCounter, name="visit_activity_change_30d")
visit_activity_change_3m = graphene.Field(BucketCounter, name="visit_activity_change_3m")
visit_acute_dis = graphene.Field(BucketCounter, name="visit_acute_dis")
visit_age = graphene.Field(BucketCounter, name="visit_age")
visit_alcohol = graphene.Field(BucketCounter, name="visit_alcohol")
visit_anger = graphene.Field(BucketCounter, name="visit_anger")
visit_arthralgia = graphene.Field(BucketCounter, name="visit_arthralgia")
visit_beans = graphene.Field(BucketCounter, name="visit_beans")
visit_biscuit = graphene.Field(BucketCounter, name="visit_biscuit")
visit_bmi = graphene.Field(BucketCounter, name="visit_bmi")
visit_bowel_day = graphene.Field(BucketCounter, name="visit_bowel_day")
visit_bowel_night = graphene.Field(BucketCounter, name="visit_bowel_night")
visit_bread = graphene.Field(BucketCounter, name="visit_bread")
visit_bread_spread = graphene.Field(BucketCounter, name="visit_bread_spread")
visit_breadrolls = graphene.Field(BucketCounter, name="visit_breadrolls")
visit_breakfast_amt = graphene.Field(BucketCounter, name="visit_breakfast_amt")
visit_breakfast_food = graphene.Field(BucketCounter, name="visit_breakfast_food")
visit_breakfast_tod = graphene.Field(BucketCounter, name="visit_breakfast_tod")
visit_cancer = graphene.Field(BucketCounter, name="visit_cancer")
visit_cancer_mtc = graphene.Field(BucketCounter, name="visit_cancer_mtc")
visit_cereal = graphene.Field(BucketCounter, name="visit_cereal")
visit_cereal_type = graphene.Field(BucketCounter, name="visit_cereal_type")
visit_cheese = graphene.Field(BucketCounter, name="visit_cheese")
visit_chemo = graphene.Field(BucketCounter, name="visit_chemo")
visit_chest_pain = graphene.Field(BucketCounter, name="visit_chest_pain")
visit_chips_crisps = graphene.Field(BucketCounter, name="visit_chips_crisps")
visit_chronic_dis = graphene.Field(BucketCounter, name="visit_chronic_dis")
visit_claudication = graphene.Field(BucketCounter, name="visit_claudication")
visit_colonoscopy = graphene.Field(BucketCounter, name="visit_colonoscopy")
visit_confident = graphene.Field(BucketCounter, name="visit_confident")
visit_control = graphene.Field(BucketCounter, name="visit_control")
visit_coping = graphene.Field(BucketCounter, name="visit_coping")
visit_current = graphene.Field(BucketCounter, name="visit_current")
visit_dairy = graphene.Field(BucketCounter, name="visit_dairy")
visit_date = graphene.Field(BucketCounter, name="visit_date")
visit_diag_other = graphene.Field(BucketCounter, name="visit_diag_other")
visit_diarrhea = graphene.Field(BucketCounter, name="visit_diarrhea")
visit_diet_drinks = graphene.Field(BucketCounter, name="visit_diet_drinks")
visit_difficulties = graphene.Field(BucketCounter, name="visit_difficulties")
visit_dinner_amt = graphene.Field(BucketCounter, name="visit_dinner_amt")
visit_dinner_food = graphene.Field(BucketCounter, name="visit_dinner_food")
visit_dinner_tod = graphene.Field(BucketCounter, name="visit_dinner_tod")
visit_duration = graphene.Field(BucketCounter, name="visit_duration")
visit_dyspnea = graphene.Field(BucketCounter, name="visit_dyspnea")
visit_eggs = graphene.Field(BucketCounter, name="visit_eggs")
visit_ery_nodosum = graphene.Field(BucketCounter, name="visit_ery_nodosum")
visit_fast_gluc = graphene.Field(BucketCounter, name="visit_fast_gluc")
visit_fever = graphene.Field(BucketCounter, name="visit_fever")
visit_fish = graphene.Field(BucketCounter, name="visit_fish")
visit_fish_count = graphene.Field(BucketCounter, name="visit_fish_count")
visit_fish_oil = graphene.Field(BucketCounter, name="visit_fish_oil")
visit_fish_white = graphene.Field(BucketCounter, name="visit_fish_white")
visit_fruit = graphene.Field(BucketCounter, name="visit_fruit")
visit_fruit_count = graphene.Field(BucketCounter, name="visit_fruit_count")
visit_going_your_way = graphene.Field(BucketCounter, name="visit_going_your_way")
visit_grains = graphene.Field(BucketCounter, name="visit_grains")
visit_hbi = graphene.Field(BucketCounter, name="visit_hbi")
visit_hbi_total = graphene.Field(BucketCounter, name="visit_hbi_total")
visit_height = graphene.Field(BucketCounter, name="visit_height")
visit_hosp = graphene.Field(BucketCounter, name="visit_hosp")
visit_ice_cream = graphene.Field(BucketCounter, name="visit_ice_cream")
visit_id = graphene.Field(BucketCounter, name="visit_id")
visit_immunosupp = graphene.Field(BucketCounter, name="visit_immunosupp")
visit_interval = graphene.Field(BucketCounter, name="visit_interval")
visit_irritation = graphene.Field(BucketCounter, name="visit_irritation")
visit_juice = graphene.Field(BucketCounter, name="visit_juice")
visit_leg_edema = graphene.Field(BucketCounter, name="visit_leg_edema")
visit_lunch_amt = graphene.Field(BucketCounter, name="visit_lunch_amt")
visit_lunch_food = graphene.Field(BucketCounter, name="visit_lunch_food")
visit_lunch_tod = graphene.Field(BucketCounter, name="visit_lunch_tod")
visit_meat = graphene.Field(BucketCounter, name="visit_meat")
visit_meat_product = graphene.Field(BucketCounter, name="visit_meat_product")
visit_meat_red = graphene.Field(BucketCounter, name="visit_meat_red")
visit_meat_white = graphene.Field(BucketCounter, name="visit_meat_white")
visit_milk = graphene.Field(BucketCounter, name="visit_milk")
visit_mod_activity_days = graphene.Field(BucketCounter, name="visit_mod_activity_days")
visit_mod_activity_hours = graphene.Field(BucketCounter, name="visit_mod_activity_hours")
visit_mod_activity_minutes = graphene.Field(BucketCounter, name="visit_mod_activity_minutes")
visit_neurologic = graphene.Field(BucketCounter, name="visit_neurologic")
visit_new_meds = graphene.Field(BucketCounter, name="visit_new_meds")
visit_number = graphene.Field(BucketCounter, name="visit_number")
visit_on_top = graphene.Field(BucketCounter, name="visit_on_top")
visit_oral_contrast = graphene.Field(BucketCounter, name="visit_oral_contrast")
visit_other_food_intake = graphene.Field(BucketCounter, name="visit_other_food_intake")
visit_pastry = graphene.Field(BucketCounter, name="visit_pastry")
visit_poultry = graphene.Field(BucketCounter, name="visit_poultry")
visit_preg_plans = graphene.Field(BucketCounter, name="visit_preg_plans")
visit_pregnant = graphene.Field(BucketCounter, name="visit_pregnant")
visit_prior = graphene.Field(BucketCounter, name="visit_prior")
visit_probiotic = graphene.Field(BucketCounter, name="visit_probiotic")
visit_psychiatric = graphene.Field(BucketCounter, name="visit_psychiatric")
visit_pyo_gangrenosum = graphene.Field(BucketCounter, name="visit_pyo_gangrenosum")
visit_rash = graphene.Field(BucketCounter, name="visit_rash")
visit_salt = graphene.Field(BucketCounter, name="visit_salt")
visit_sccai = graphene.Field(BucketCounter, name="visit_sccai")
visit_sccai_total = graphene.Field(BucketCounter, name="visit_sccai_total")
visit_self_assess = graphene.Field(BucketCounter, name="visit_self_assess")
visit_self_condition = graphene.Field(BucketCounter, name="visit_self_condition")
visit_shellfish = graphene.Field(BucketCounter, name="visit_shellfish")
visit_snacks_amt = graphene.Field(BucketCounter, name="visit_snacks_amt")
visit_snacks_food = graphene.Field(BucketCounter, name="visit_snacks_food")
visit_snacks_tod = graphene.Field(BucketCounter, name="visit_snacks_tod")
visit_soda = graphene.Field(BucketCounter, name="visit_soda")
visit_starch = graphene.Field(BucketCounter, name="visit_starch")
visit_starch_type = graphene.Field(BucketCounter, name="visit_starch_type")
visit_stool_blood = graphene.Field(BucketCounter, name="visit_stool_blood")
visit_stool_soft = graphene.Field(BucketCounter, name="visit_stool_soft")
visit_stopped_meds = graphene.Field(BucketCounter, name="visit_stopped_meds")
visit_stress = graphene.Field(BucketCounter, name="visit_stress")
visit_stress_def = graphene.Field(BucketCounter, name="visit_stress_def")
visit_study_disease_comment = graphene.Field(BucketCounter, name="visit_study_disease_comment")
visit_study_disease_description = graphene.Field(BucketCounter, name="visit_study_disease_description")
visit_study_disease_disease_ontology_id = graphene.Field(BucketCounter, name="visit_study_disease_disease_ontology_id")
visit_study_disease_mesh_id = graphene.Field(BucketCounter, name="visit_study_disease_mesh_id")
visit_study_disease_name = graphene.Field(BucketCounter, name="visit_study_disease_name")
visit_study_disease_nci_id = graphene.Field(BucketCounter, name="visit_study_disease_nci_id")
visit_study_disease_status = graphene.Field(BucketCounter, name="visit_study_disease_status")
visit_study_disease_umls_concept_id = graphene.Field(BucketCounter, name="visit_study_disease_umls_concept_id")
visit_subtype = graphene.Field(BucketCounter, name="visit_subtype")
visit_sugar = graphene.Field(BucketCounter, name="visit_sugar")
visit_sugar_drinks = graphene.Field(BucketCounter, name="visit_sugar_drinks")
visit_surgery = graphene.Field(BucketCounter, name="visit_surgery")
visit_sweets = graphene.Field(BucketCounter, name="visit_sweets")
visit_sweets_count = graphene.Field(BucketCounter, name="visit_sweets_count")
visit_upset = graphene.Field(BucketCounter, name="visit_upset")
visit_urgency_def = graphene.Field(BucketCounter, name="visit_urgency_def")
visit_uveitis = graphene.Field(BucketCounter, name="visit_uveitis")
visit_veg = graphene.Field(BucketCounter, name="visit_veg")
visit_veg_green = graphene.Field(BucketCounter, name="visit_veg_green")
visit_veg_raw = graphene.Field(BucketCounter, name="visit_veg_raw")
visit_veg_root = graphene.Field(BucketCounter, name="visit_veg_root")
visit_vig_activity_days = graphene.Field(BucketCounter, name="visit_vig_activity_days")
visit_vig_activity_hours = graphene.Field(BucketCounter, name="visit_vig_activity_hours")
visit_vig_activity_minutes = graphene.Field(BucketCounter, name="visit_vig_activity_minutes")
visit_walking_days = graphene.Field(BucketCounter, name="visit_walking_days")
visit_walking_hours = graphene.Field(BucketCounter, name="visit_walking_hours")
visit_walking_minutes = graphene.Field(BucketCounter, name="visit_walking_minutes")
visit_water = graphene.Field(BucketCounter, name="visit_water")
visit_weight = graphene.Field(BucketCounter, name="visit_weight")
visit_weight_change = graphene.Field(BucketCounter, name="visit_weight_change")
visit_weight_diff = graphene.Field(BucketCounter, name="visit_weight_diff")
visit_work_missed = graphene.Field(BucketCounter, name="visit_work_missed")
visit_yogurt = graphene.Field(BucketCounter, name="visit_yogurt")
class SBucket(graphene.ObjectType): # Same idea as early bucket but used for summation (pie charts)
key = graphene.String()
docCount = graphene.Int(name="doc_count")
caseCount = graphene.Int(name="case_count")
fileSize = graphene.Float(name="file_size")
class SBucketCounter(graphene.ObjectType): # List of SBuckets
buckets = graphene.List(SBucket)
class FileSize(graphene.ObjectType): # total aggregate file size of current set of chosen data
value = graphene.Float()
class IndivSample(graphene.ObjectType): # individual sample model for populating the particular sample page
sample_id = graphene.String(name="sample_id")
body_site = graphene.String(name="body_site")
subject_id = graphene.String(name="subject_id")
rand_subject_id = graphene.String(name="rand_subject_id")
subject_gender = graphene.String(name="subject_gender")
study_center = graphene.String(name="study_center")
project_name = graphene.String(name="project_name")
files = graphene.List(IndivFiles, name="files")
class PieCharts(graphene.ObjectType): # individual sample model for populating the particular sample page
sample_body_site = graphene.Field(SBucketCounter, name="sample_body_site")
project_name = graphene.Field(SBucketCounter, name="project_name")
subject_gender = graphene.Field(SBucketCounter, name="subject_gender")
file_format = graphene.Field(SBucketCounter, name="file_format")
file_type = graphene.Field(SBucketCounter, name="file_type")
study_name = graphene.Field(SBucketCounter, name="study_name")
fs = graphene.Field(FileSize)