elixir-cloud-aai / drs-filer

Lightweight, flexible Flask/Gunicorn-based GA4GH DRS implementation
Apache License 2.0
5 stars 8 forks source link

feat: add "POST ../access" & "PUT ../{access_id}" #32

Open sarthakgupta072 opened 3 years ago

sarthakgupta072 commented 3 years ago

Description

Fixes #26 and #25

Type of change

Please delete options that are not relevant.

Checklist:

sarthakgupta072 commented 3 years ago

Hey @uniqueg. Tried something different in this code (not similar to POST and PUT in object registration). Please do have a look.

The main reason for this was that I was not able to cover some corner cases with other approaches that I had in mind. If you have any other ideas for implementation, please do suggest.

TIA :)

uniqueg commented 3 years ago

Thanks @sarthakgupta072. Should be able to look at this soon. But before I start: would you mind explaining in a bit more detail what you mean by "Tried something different" and "some corner cases"? Please also have a look at TRS-Filer where a very similar thing is already taken care of (objects & access methods vs tools & versions). Perhaps this will help. Not saying though that this is how it has to work. If you feel that your solution does the job and is elegant enough, I'll be happy to review that.

sarthakgupta072 commented 3 years ago

Sure Alex. Will have a look and update you soon. ;)

sarthakgupta072 commented 3 years ago

Hey @uniqueg. I'll just compare both trs-filer approach, and the approach used by me.

Consider the case, where the id of (access_method/version) is provided, but it is not already there in the (object/tool). In trs-filer, we are using a while loop to generate unique ids for versions, so that even if there is not a unique id available, it will be made available in the next few iterations, but in my case, I am beforehand generating a unique id and inserting the access_method in the drs object.

Now, when I analyze both the approaches, I feel the approach in trs-filer is much better in terms of time complexity and follows the Python principle of EAFP.

So, I'll make changes according to trs-filer repo, which will also maintain consistency between both code bases of trs-filer and drs-filer. 😄

uniqueg commented 3 years ago

Sounds great, thanks a lot!

sarthakgupta072 commented 3 years ago

Hey @uniqueg. Implemented this just like trs-filer. Please have a look. 🙂

I'll add tests if everything looks good.