Closed im-prakher closed 4 years ago
Can you elaborate about status parameter?
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.
Done in #69
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