Open sarthakgupta072 opened 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 :)
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.
Sure Alex. Will have a look and update you soon. ;)
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
. 😄
Sounds great, thanks a lot!
Hey @uniqueg. Implemented this just like trs-filer
. Please have a look. 🙂
I'll add tests if everything looks good.
Description
Fixes #26 and #25
Type of change
Please delete options that are not relevant.
Checklist: