diff --git a/peregrine/resources/submission/__init__.py b/peregrine/resources/submission/__init__.py index ec70ac04..bfe1748b 100644 --- a/peregrine/resources/submission/__init__.py +++ b/peregrine/resources/submission/__init__.py @@ -101,8 +101,8 @@ def root_graphql_query(): # if peregrine.utils.contain_node_with_category(data.json,'data_file') == False: # return flask.jsonify({ 'errors': 'No data_file node'}), 400 print("========dir(data)===========") - print(dir(data)) - res = peregrine.utils.json2tbl(data.json,'', "_" ) + print(data.data) + res = peregrine.utils.json2tbl(json.loads(data.data),'', "_" ) bag_info = {'organization': 'CDIS', 'data_type': 'TOPMed', 'date_created': datetime.date.today().isoformat()} diff --git a/peregrine/utils/pybdbag.py b/peregrine/utils/pybdbag.py index 7f709cee..c85b297c 100644 --- a/peregrine/utils/pybdbag.py +++ b/peregrine/utils/pybdbag.py @@ -26,11 +26,14 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000): header = copy.deepcopy(row) writer.writerow(row) nrow = 1 + print('==============header==========') + print(header) for row_dict in payload: row=[] + print(row_dict) for h in header: - if row_dict['_data_'+h]: - row.append(row_dict['_data_'+h]) + if row_dict.get('_data_'+h): + row.append(row_dict.get('_data_'+h)) else: row.append('None') writer.writerow(row)