Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions app/Meta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This is the Meta module and supports all the REST actions for the yaba.yaml
This is the Meta module and supports all the REST actions for the yaba.yaml
"""
# Importing modules
import os
Expand Down Expand Up @@ -58,7 +58,7 @@ def insert_experiments(username,fileName,status=True):
#Checking necessary columns are there.
columns=data.columns.values.tolist()
accepted_columns=['name','start_date','end_date','description']
if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Experiments'}
Expand Down Expand Up @@ -149,7 +149,7 @@ def insert_sites(fileName,shp_file,dbf_file,prj_file,shx_file,status=True):
poly = Polygon(flat_list)
data.loc[index, 'geometry'] = poly

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Sites'}
Expand Down Expand Up @@ -226,7 +226,7 @@ def insert_treatments(username,fileName,status=True):
columns=data.columns.values.tolist()
accepted_columns=['name','definition','control']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Treatments'}
Expand Down Expand Up @@ -288,7 +288,7 @@ def insert_cultivars(fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['name','species','ecotype','notes']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Cultivars'}
Expand Down Expand Up @@ -356,7 +356,7 @@ def insert_citations(username,fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['author','year','title','journal','vol','pg','url','pdf','doi']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Citations'}
Expand Down Expand Up @@ -413,7 +413,7 @@ def insert_experimentSites(fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['experiment_name','sitename']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Experiments_sites'}
Expand Down Expand Up @@ -474,7 +474,7 @@ def insert_experimentTreatments(fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['experiment_name','treatment_name']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Experiments_treatments'}
Expand Down Expand Up @@ -534,7 +534,7 @@ def insert_sitesCultivars(fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['sitename','cultivar_name','specie_id']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Sites_cultivars'}
Expand Down Expand Up @@ -595,7 +595,7 @@ def insert_citationsSites(fileName, status=True):
columns=data.columns.values.tolist()
accepted_columns=['author','year','title','sitename']

if(all(x in columns for x in accepted_columns)):
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Citations_sites'}
Expand Down Expand Up @@ -632,4 +632,4 @@ def insert_citationsSites(fileName, status=True):
# Logs the error appropriately
logging.error(traceback.format_exc())
msg = {'Message' : 'Error' + str(e)}
return make_response(jsonify(msg), 410)
return make_response(jsonify(msg), 410)
1 change: 0 additions & 1 deletion app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WSGIserver
gevent
pandas==0.24.2
connexion==2.2.0
jsonschema==3.2.0
Flask==1.0
Werkzeug==0.15.3
SQLAlchemy==1.3.0
Expand Down