PecanProject / BETYdb-YABA

Yet Another BETYdb API (for metadata upload)
BSD 3-Clause "New" or "Revised" License
5 stars 18 forks source link

Modifying client routes for data validation #44

Closed im-prakher closed 4 years ago

im-prakher commented 4 years ago

The goal of this issue is to implement data validation for shapefiles, spreadsheets before API data ingestion by modifying existing API routes functionality.

https://github.com/PecanProject/BETYdb-YABA/blob/64b540ef21838d5b47469896b95672bb4ac00f48/app/Meta.py#L52-L72 #

Like, the code in this function responds to /yaba/v1/experiments (for inserting experiments in the BETY database), we can modify this, by accepting one more parameter as status(which can be true or false), if false then return a valid response after validating data otherwise continue with data insertion. In this example, we can check the status after line 64, if true we can return a response from there only and stop further execution otherwise continue with data insertion.

if(all(x in accepted_columns for x in columns)): >> if(status == false) >>>> msg = {'Message' : true } >>>> return make_response(jsonify(msg), 200)

So, what do you say? @dlebauer @KristinaRiemer @saurabh1969 @Chris-Schnaufer

saurabh1969 commented 4 years ago

Can you elaborate about status parameter?

im-prakher commented 4 years ago

It will be a Boolean. A false value indicates that data should be only validated and a response should be returned accordingly, while a true value tells us that data should also be inserted.

im-prakher commented 4 years ago

Done in #69