Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for missing data columns in validation #74

Open
KristinaRiemer opened this issue Dec 10, 2020 · 2 comments
Open

Check for missing data columns in validation #74

KristinaRiemer opened this issue Dec 10, 2020 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@KristinaRiemer
Copy link
Contributor

KristinaRiemer commented Dec 10, 2020

In app/Meta.py currently, when tables are being added it is only checked to see if the columns present are in the list of accepted columns. For example, see lines 265-296 for the cultivars table. Some of these columns are required and so should return an error if they aren't there.

BETYdb-YABA/app/Meta.py

Lines 265 to 296 in 62702b8

def insert_cultivars(fileName, status=True):
"""
This function responds to a request for /yaba/v1/cultivars
with csv file
:fileName: CSV file with cultivars meta data
:return: 201 on success
400 if file is unsuitable or does not contain appropriate columns
409 Intregrity or Constraint error : 23503 foreign_key_violation | 23505 unique_violation
500 Database Connection Error
401 Unauthorized | No user exists
410 Default error.See logs for more information
"""
try:
data = pd.read_csv(fileName,delimiter = ',')
specie_id=fetch_specie_id(data['species'][0])
#Checking necessary columns are there.
columns=data.columns.values.tolist()
accepted_columns=['name','species','ecotype','notes']
if(all(x in accepted_columns for x in columns)):
if status == False:
msg = {'Message' : 'Successfully Validated',
'Table' : 'Cultivars'}
return make_response(jsonify(msg), 200)

@im-prakher im-prakher added the good first issue Good for newcomers label Feb 3, 2021
@eshantri
Copy link
Contributor

I want to work on this issue. Can you assign this to me?

@im-prakher
Copy link
Contributor

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants